I am currently looking into the structure of bitcoin transactions. As an example, I took the hex dump of this transaction:


Looking at the JSON format, the transaction version should be 1.

I've read that the first 4 bytes of a transaction encode the version number (source).

2 hex characters are one byte, so 4 bytes are 8 hex characters. So the version is 01000000. But that would be 16777216, not 1.

What am I doing wrong?

1 Answer 1


From https://en.bitcoin.it/wiki/Protocol_documentation#Transaction_Verification we learn :

Almost all integers are encoded in little endian. Only IP or port number are encoded big endian.

You should look at the https://en.m.wikipedia.org/wiki/Endianness and flip the order of the bitstring to have the bit at the correct position

Using an online hex converter like this one https://www.scadacore.com/tools/programming-calculators/online-hex-converter/ you can actually see that the hex interpreted as uint32 results to 1

enter image description here

  • 1
    You gave me the information that I need to change the order of the chars in the hexstring from "01234567" to "67452301". That was very helpful. Thank you 🤗 Commented Apr 3, 2021 at 5:41

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.