Wednesday, January 7, 2026
HomeBitcoinIn what format does a block retailer the transaction information?

In what format does a block retailer the transaction information?

Bitcoin core shops the information within the community format for blocks and for the transactions in these blocks.


Instance

Block 170 comprises the primary transaction aside from coinbase transactions. In it Satoshi Nakamoto paid Hal Finney 10 BTC. This was the primary time one particular person paid one other particular person in Bitcoin.

For the reason that information is in binary, we should use a printable illustration of it to make it viewable on this web-page. I select hexadecimal:

0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25
857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f
4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd1290
9d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b0000000043
4104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa2
8414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6c
d84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a
382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b
64f9d4c03f999b8643f656b412a3ac00000000

Some weeks in the past I believed it might be neat to work out by hand what that meant. this is how far I received earlier than shedding curiosity:

Hex Knowledge That means
01000000 Model 1 (little endian uint32)
01 Variety of transaction inputs (compact-int)
First enter
c997a5e56e104102 fa209c6a852dd906 60a20b2d9c352423 edce25857fcd3704 Hash of referenced transaction (32 octets)
00000000 index of output in referenced transaction (uint32)
48 size of unlocking script (compact-int). 48 hex is 72 decimal.
47304402204e45e1 6932b8af514961a1 d3a1a25fdf3f4f77 32e9d624c6c61548 ab5fb8cd41022018 1522ec8eca07de48 60a4acdd12909d83 1cc56cbbac462208 2221a8768d1d0901 unlocking script (72 octets)
ffffffff sequence
02 Variety of outputs
First output
00ca9a3b00000000 quantity 1000000000 satoshi i.e. 10 BTC (int64)
43 size of locking script
4104ae1a62fe09c5 f51b13905f07f06b 99a2f7159b2225f3 74cd378d71302fa2 8414e7aab37397f5 54a7df5f142c21c1 b7303b8a0626f1ba ded5c72a704f7e6c d84cac locking script
Second output
00286bee00000000 quantity 40 BTC. That is change.
43 size of locking script
410411db93e1dcdb 8a016b49840f8c53 bc1eb68a382e97b1 482ecad7b148a690 9a5cb2e0eaddfb84 ccf9744464f82e16 0bfa9b8b64f9d4c0 3f999b8643f656b4 12a3ac locking script
00000000 lock time = unlocked (4 octets)

Decoding Scripts

I ought to most likely decode the locking scripts on the outputs. 41 is OP_PUSHDATA for 4116 bytes. Then now we have the 4116 bytes of knowledge to be pushed onto the stack and eventually ac is OP_CHECKSIG which expects a signature and public key on the stack which it takes off the stack and checks. This script solely actually will get executed when the cash is spent.

For historic causes locking-scripts had been referred to as pubkey scripts, unlocking scripts had been referred to as signature scripts. However these older names are deceptive for newer transaction sorts.

Compact Integers and Varints

The compact type of integers utilized by Bitcoin is typically referred to as varint (variable-length integer) however it is a potential supply of confusion as there are different issues named varint IIRC.

Little-Endian numbers

You may examine the little endian numbers by reversing them byte-wise (two hex digits at a time) into a giant endian illustration and feeding that into Home windows Calculator in programmer mode – this is that second output quantity (00286bee00000000LE -> 00000000ee6b2800BE):

Calculator

That is how we all know 00286bee00000000 means 40000000000 Satoshi. Which is 40 BTC.

Transaction Varieties

This early transaction is an early kind often known as Pay to Public Key (P2PK). It’s the easiest kind. Widespread sorts used these days are extra difficult.

Blockchain explorers

You may, in fact, slightly simply get a JSON illustration of this transaction utilizing most blockchain explorers. I discover {that a} bit unsatisfactory as they typically introduce some synthetic components (e.g. each ‘hex’ and ‘asm’ representations of the script) so that you’re by no means sure how precisely the JSON gadgets correspond to elements of the underlying information. Therefore the above decoding try.


Associated questions

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments