0

If I understand correctly, transaction IDs and block digests are typically hex-encoded in the bitcoin ecosystem including bitcoin-core RPC calls, block explorers, etc.

Meanwhile, bech32 encoding would result in smaller strings and also provides checksums.

I am wondering if there is any technical reason for hex encoding, or it is just a status-quo situation.

In other words, if bitcoin-core were to be written from scratch today, would we likely choose hex, bech32, base58, or something else for encoding hashes, eg block and transaction?

1 Answer 1

4

Bitcoin has used the same hex encoding for hashes since the very beginning. Any software written since then therefore also expects that same hex encoding. Bech32 was introduced nearly a decade into Bitcoin's life. To change all of the existing encodings to something else would simply break all software written for Bitcoin up to that point. That is simply not a reasonable tradeoff for something that is relatively unimportant.

Also bech32 is not much shorter than hex for representing 32 bytes of data. Although base32 is, bech32 includes a human readable part and a checksum, both of which make the length almost as long as the hex encoding, and neither of those is particularly useful to users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.