Bitcoin - What's in a block?

What exactly does a Bitcoin block contain? What data is “hashed” by minors?

BLOCK

A block has several parts. The Coinbase, the transactions, the header (the “header”) and some other information. But only the data contained in the header is hashed.

This is what the genesis block (the very first block mined by Satoshi Nakamoto) looks like expressed in hexadecimal.

The two number systems useful for “reading” the innards of Bitcoin are binary numbers (0 or 1, i.e. a base 2 system) and hexadecimal numbers (base 16 with 0,1,2 ,3,4,5,6,7,8,9,a,b,c,d,e,f)

The Coinbase section is on the right. Miners use it to pay themselves their reward. This section can contain arbitrary data. This is where Satoshi inscribed the famous newspaper headline The Times: “Chancellor on brink of second bailout for banks”.

The header is standardized. It weighs 80 bytes and consists of six sections:

Version Number / Previous Block Hash / Merkle Tree Root Hash / Time Stamp / Hash Target Value / Nonce

Header

The SHA-256 algorithm hashes all the information included in the six sections of the header. Here is their description:

– Protocol version number (4 bytes)

The version number indicates the set of block validation rules to follow. We have been on version 4 since 2015.

-Hash of previous block

A block always contains in its header the hash of the previous block. Clearly, each block is linked to the previous one. Hence the term “blockchain”.

– Merkle tree root hash (32 bytes)

This hash results from the concatenation of all the transactions contained in the block. It is thanks to the Merkle tree that we list and lock the transactions of a block.

-Time Stamp, or timestamp (4 bytes)

timestamp in time Unix. UNIX time is the number of seconds since January 1, 1970. We were at 1,679,647,534 seconds at the time of this writing.

-Hash target value (mining difficulty) (4 bytes)

The block hash value must be less than or equal to the target hash value to be valid. Basically, the hash must start with a certain number of zeros. This difficulty adjustment (which takes place every 2016 blocks) ensures the rhythm of one block every 10 minutes or so.

-Nonce (4 bytes)

The nonce (short for “number only used once”) is a number that the miner varies until it finds a hash starting with a valid number of zeros.

The section offers a space of 4 bytes, which gives us approximately 4.3 billion possible nonces. This is not much when you know that all miners produce 400 billion billion hashes per second (400 ExaHash):

The miners therefore vary other data such as the time stamp, the transactions (which will change the root of the Merkle tree) or the Coinbase data to create more randomness.

What else in a block?

We obviously find the hash of the block in question. But also :

-The number of transactions and the transactions themselves

The number of transactions varies from block to block. Since the SegWit soft fork, the largest block of transactions was 2.3 million bytes (2.3 MB), knowing that a transaction weighs on average 500 bytes (a handful of thousands of transactions per block).

-Reward per block

The reward per block is currently 6.25 BTC. It is this reward that incentivizes miners to secure the network.

It was at the very beginning of 50 BTC per block and halves every 210,000 blocks (every four years). This reward will disappear around 2140. The reward is awarded via the Coinbase transaction of each block. It is a one-time transaction by which bitcoins are created ex nihilo.

– Block height

Also known as block number. Each block is numbered in its order of appearance. Around 144 new blocks are created every day. As of this writing, we are at block number 782,762, mined by the F2Pool mining pool.

– Block size:

In the case of block 782 762, the block size was 2.48 Vbytes (we count in Vbytes, or “virtual bytes” since SegWit). The block size includes header data and transaction information contained in the block.

-The number is divided into magic:

In computing, magic numbers are used to identify a type of data. A program checks the magic number to immediately know the type of file/data structure given to it. Bitcoin blocks all start with the same magic number: 0xD9B4BEF9

And that’s pretty much all there is in a block. Nevertheless, it is possible to look at the transactions side (in the witness section). There you will find Monkey JPEGs. Ordinal fashion…

Receive a digest of news in the world of cryptocurrencies by subscribing to our new service of newsletter daily and weekly so you don’t miss any of the essential Tremplin.io!

Similar Posts