What is the endianness of the hex strings returned by getblockhash and getblockheader?
What is the endianness of the values returned by bitcoin-cli RPC commands getblockhash and getblockheader (verbose = false)?
Bitcoin Wiki's "Block hashing algorithm" page says the header is comprised of "little-endian values in hex notation". It continues (§ "Endianess"):
Note that the hash, which is a 256-bit number, has lots of leading zero bytes when stored or printed as a big-endian hexadecimal constant, but it has trailing zero bytes when stored or printed in little-endian.
Is this correct?
So does getblockheader (verbose = false) return little-endian hex:
$ bitcoin-cli getblockheader 00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d false
0100000081cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122bc7f5d74df2b9441a42a14695
and getblockhash:
$ bitcoin-cli getblockhash 125552
00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
return big-endian hex, ∵ it has lots of leading zeros?
Why isn't everything the same endianness?
from Recent Questions - Bitcoin Stack Exchange https://ift.tt/SIMXBbj
via IFTTT