It is possible to extract the raw hex of a transaction from the blockchain to get the raw hex of a block. We can use blockchain.info and request the data in hex using format=hex. You construct the URL as follows, with TXID being the full transaction ID:

blockchain.info/rawtx/?format=hex

https://blockchain.info/rawtx/61635d927796c87164fa919ac21367fd7b67afc57ab40b4984130a18f33fd7a3?format=hex

This simple example transaction gives us the following result:

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d892fe7815ef5e15a993561cf86060000006b483045022100cff7025f087cf3615120f82946a4d7cef09cdd745d90dc086f78437a3d8189bb02206050b45d6e758def8ab358edda74c644d2c4c54bcb47ab306bb395cddd0603ad01210307c6dabe1509bddcbdb984b10b9a092bd0c4323edb2cfab90cb6d2654e5a24aafeffffff026a480301000000001976a91401990fc0ff0b73e0b00073b5aac229e7778a41bb88ac548ff900000000001976a914e66df7b370eb31be3316e64cf13534b4e12d830f88ac80770700

Transactions are very difficult to deconstruct by hand because they can have multiple inputs and outputs, but some fields are quite easy to find.

There is a second output value in this transaction. Once again, if we look at the raw data, we will find another 16-hex-digit value, including a string of zeros. The Internal Byte Order string is 548ff90000000000. If we convert this value to decimal, we get a total value of the second output of 16355156 satoshis:

Software Version Used in the Transaction—Little Endian
The result here is version 2:

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d8

Number of Inputs to a Transaction—Big-Endian

The result is just 1 input:

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d8

Hash of the Previous Transaction

It’s interesting that although all the blockchain viewers show the input values and output values, the input values do not exist in the actual transaction hex, just the link to the previous transaction where the amount will exist in the outputs. This is in Internal Byte Order and translates to 86cf6135995ae1f55e81e72f894d4bc2bffcbedf9231464e3aeef6795533ea08:

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d892fe7815ef5e15a993561cf86

Output Index Number

​The next value is the output index number from the previous transaction. In this example, it is 6, meaning it was the sixth output of the previous transaction recorded in Little Endian format:

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d892fe7815ef5e15a993561cf86060000006b4

Output Values
The next value that we can ascertain is the total value of the 1st output from the transaction. This value is recorded in Internal Byte Order and decodes to the value in satoshis. In our example, the value is 16992362 satoshis. How do we locate and calculate this value? These values often stand out because of the many zeros that usually exist in the value. The value is 16 hex digits or 8 bytes long, and you can start at the final zero and work back, in this example, from 00 to 6a. Hence, 6a48030100000000 in Internal Byte Order translates to 16992362 satoshis. The zeros will never be used up as the value would be more than all the bitcoins that can ever be mined.

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d892fe7815ef5e15a993561cf86060000006b483045022100cff7025f087cf3615120f82946a4d7cef09cdd745d90dc086f78437a3d8189bb02206050b45d6e758def8ab358edda74c644d2c4c54bcb47ab306bb395cddd0603ad01210307c6dabe1509bddcbdb984b10b9a092bd0c4323edb2cfab90cb6d2654e5a24aafeffffff026a480301000000001976a91401990fc0ff0b73e0b00073b5aac229e7778a41bb88ac548ff900000000001976a914e66df7b370eb31be3316e64cf13534b4e12d830f88ac80770700

nLockTime This value sets when the transaction should be triggered. It can either be a UNIX time value or a block height. In this instance, the block height is 489344. The value is encoded in Internal Byte Order as follows:

020000000108ea335579f6ee3a4e463192dfbefcbfc24b4d892fe7815ef5e15a993561cf86060000006b483045022100cff7025f087cf3615120f82946a4d7cef09cdd745d90dc086f78437a3d8189bb02206050b45d6e758def8ab358edda74c644d2c4c54bcb47ab306bb395cddd0603ad01210307c6dabe1509bddcbdb984b10b9a092bd0c4323edb2cfab90cb6d2654e5a24aafeffffff026a480301000000001976a91401990fc0ff0b73e0b00073b5aac229e7778a41bb88ac548ff900000000001976a914e66df7b370eb31be3316e64cf13534b4e12d830f88ac80770700

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment