Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Mention Bitcoin's RPC Hash Byte Order #583
Conversation
saivann
and 1 other
commented on an outdated diff
Oct 1, 2014
| +0000000000000</b>ab0aaa377ca3f49b1545e2ae6b0667a08f42e72d8c24ae\ | ||
| +237140e28f14f3bb7c6bcc6d536c890019edd83ccf</pre> | ||
| + | ||
| +However Bitcoin RPCs use the reverse byte order for hashes, so if you | ||
| +want to get information about block 300,000 using the `getblock` RPC, | ||
| +you need to reverse the byte order: | ||
| + | ||
| + > bitcoin-cli getblock \ | ||
| + 000000000000000082ccf8f1557c5d40b21edabb18d2d691cfbf87118bac7254 | ||
| + | ||
| +(Note: hex representation uses two characters to display each byte of | ||
| +data, which is why the reversed string looks somewhat mangled.) | ||
| + | ||
| +The rational for the reversal is unknown, but it likely stems from | ||
| +Bitcoin's use of hash digests (which are byte arrays in C++) as integers | ||
| +for the purpose of determing whether the hash is below the network |
|
|
|
Mmh, I can't help review this one. Is a more knowledgeable developer available to take a quick look? |
|
@SergioDemianLerner Do you have some time to review the changes and tell if the pull req fixes your issue #580 (to the best of your understanding)? |
jgarzik
commented
Oct 23, 2014
|
Huzzah! Thank you for documenting this. |
|
Rebased to fix merge conflict; also lowercased Merkle as per discussion in pull #589. This seems ready to merge to me, and we do have a highly-visible disclaimer on the page, so if nobody spots any errors by 19:00 UTC Saturday (48 hours from now), I'll merge it. |
|
@harding Thanks! |
SergioDemianLerner
commented
Oct 23, 2014
|
Documentation looks consistent. Good! |
|
@SergioDemianLerner Thanks for taking the time to come back and comment, this is very useful and appreciated. |
harding commentedSep 30, 2014
Preview: http://dg1.dtrt.org/en/developer-reference#hash-byte-order
hashes in Bitcoin Core and other software.
differences
@SergioDemianLerner do you think this describes the situation sufficiently well for other people to figure out what's going on?