is that this right?
Sure, the commentary about main and trailing zeroes similar to endianness seems right to me.
So does getblockheader (verbose = false) return little-endian hex:
I feel it returns the header in Bitcoin’s community serialization, which has most integer values in little-endian byte-order. This conflicts with Web requirements however that is the way in which Satoshi Nakamoto wished it.
and getblockhash […] return big-endian hex,
Sure. I imagine Satoshi Nakamoto and different builders most popular to current particular person integers in big-endian as that makes most sense to conventionally educated folks the place fifteen is written as 15 not 51 as a result of ten is greater than 5.
Why is not every part the identical endianness?
I doubt anybody actually is aware of Satoshi Nakamoto’s intent right here. He was conscious of endianness issues in porting Bitcoin code between architectures (and I feel discouraged use of PPC because of this).
I think a few of this springs from traits of C and C++ programming and habits widespread in that group. These points won’t come up in community functions written in different programming languages and written to adapt to Web RFC requirements.
RFC1700 by Reynolds and Postel in 1994 says
When a multi-octet amount is transmitted essentially the most vital octet is transmitted first.
Bitcoin violates that rule.
The consequence is that, in Bitcoin, I discover it’s important to pay particular consideration to endianness and thoroughly code round it. I additionally discover that many individuals are tripped up by this.

















