Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion in endianess #63

Open
pinheadmz opened this issue Jan 30, 2025 · 1 comment
Open

Confusion in endianess #63

pinheadmz opened this issue Jan 30, 2025 · 1 comment

Comments

@pinheadmz
Copy link

https://bitcoindevs.xyz/decoding/endianness

In this section:

    Big-endian is used for network communication (called network byte order).
    Little-endian is used for internal storage in Bitcoin.

In Bitcoin all integers are encoded little-endian. This applies to bytes on the wire as well as how data is stored serialized on disk. I'm not sure what the Big-endian statement here applies to?

@pinheadmz
Copy link
Author

Also worth noting, block hashes are interpreted as little endian integers during proof of work verification, but the term "endian" only applies to integers, not hashes. Somewhere in Bitcoin's history when the first human readable API was added, block hashes were reversed so they would look like big endian integers to humans. In my opinion this was an early mistake that just lead to decades of confusion ;-) Transaction hashes are also reversed for human consumption, but for no reason except that block hashes were being reversed already and at least there's some consistency!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant