A block is a timestamped and validated set of transactions. These transactions are usually cryptocurrency transfers but may also constitute interactions with contracts or contain arbitrary data. The blocks are linked together in such a way as to form a linear structure called the chain of blocks, or blockchain.
How are the Blocks Constructed?
The blockchain forms the ledger of all cryptocurrency transactions and is shared among members of a distributed network of computers. This chain is a linear set of blocks, starting with a first block considered valid by default, which is called a genesis block.
Blocks are built and chained according to precise rules, called consensus rules, which are defined by the network. For example, blocks are usually limited in size by these rules to prevent denial of service (DDoS) attacks and to keep the network decentralized.
The validator (called a “miner” in the case of Bitcoin) prepares its block by fetching new transactions, verifying that they follow the rules, and including them in the block. Then it proceeds to the validation. In Bitcoin and other proof-of-work systems, the validator must expend energy in order to find the solution to a mathematical problem, and that solution links the block to the chain. In systems using Proof of Stake or Proof of Authority, the validator need only produce a digital signature which authenticates it to the network. Since the block must contain the identifier of the previous block, the new block is chained to the latter.
At commit time, it adds a timestamp to that block, i.e. the approximate date and time the block was found. This allows the network to have its own time and to ensure that the time between each block is neither too short nor too long: in Bitcoin, this time should theoretically be 10 minutes on average.
The data written in the blocks is considered to be very difficult to change, and they become tamper-proof after a certain time. A transaction is considered confirmed when it is included in a validated block. When an additional block is added following this block, we speak of two confirmations, and so on. The more confirmations a transaction has, the more confidence one can have in its irreversibility.
Each block has an identifier, which is a unique cryptographic fingerprint resulting from the hash of the data that this block contains: for example, 000000000000000000024bead8df69990852c202db0e0097c1a12ea637d7e96d. It can also be found thanks to its position in the chain, which is called its height: the genesis block is thus considered as block 0, the block following block 1, etc. On May 11, 2020, Bitcoin’s chain reached block number 630,000.
The Structure of a Block in Bitcoin
In Bitcoin, a block consists of two components: a header (block header) and transactions, which build a Merkle tree (Merkle tree). Let’s focus on the transactions before we dwell on the header.
The Transactions
Transactions are placed one after the other in the block. The only rule to follow is that the first transaction must be the reward transaction (also called coinbase transaction ) which remunerates the miner. This transaction creates new bitcoins: this amount is currently 6.25 bitcoins per block. It also collects transaction fees from block transactions.
The reward transaction also contains a set of additional information. In particular, mining cooperatives ( mining pools ) often indicate their name in a special field of the transaction so that users have an idea of the distribution of mining (this is a convention and is not mandatory). For example, since we find the message Mined by AntPoolin block 630,000, we can deduce that it was probably mined by the Chinese cooperative Antpool.
Merkle’s Tree
Transactions are placed in a certain order within the block and are the basis of a structure called the Merkle tree or hash tree. It involves hashing the transactions (the “leaves”), then gathering the resulting hashes (hashes) two by two and hashing them, and so on until you get a single hash called the Merkle root of the ‘tree. The hash function used to build this tree is double SHA-256.
Let’s take the example of a block containing 6 transactions, and use letters to identify them: First, we hash these transactions to obtain their respective hashes. Note in passing that these fingerprints represent the identifiers of the transactions allowing them to be found on the blockchain.txAtxBhAhB
Then, we combine (by concatenation ) the hashes obtained two by two, and we reuse the hash function for each of these combinations: the combination of and is hashed to obtain the hash, is obtained from and, and is obtained at from and .hAhBhABhCDhChDhEFhEhF
The process is then repeated. If the number of hashes to be combined is odd, we combine the last hash with itself: thus, in our example, we must combine with itself to calculate .hEFhEFEF
Finally, once there is only one hash left (the Merkle root), that hash is placed in the block header, for example, b191f5f973b9040e81c4f75f99c7e43c92010ba8654718e3dd1a4800851d300d.
If any of the transactions are modified, the root of Merkle is modified. This structure, therefore, ensures that transactions cannot be changed without altering the blockchain. In addition, it allows light transaction verification for wallets.
Note that, since the activation of SegWit on August 24, 2017, each block consists of two Merkle trees: the transaction tree (without signatures) described here and the witness tree (which is the tree of transactions including signatures of SegWit transactions). The root of the witness tree is placed in the reward transaction, so the main Merkle root depends on it.
The Block Header
A block always starts with an 80-byte header. This consists of the following data:
- The version of the block. In addition to its pure role of versioning, this field allows minors to indicate their approval (or not) for a change in the protocol.
- The identifier of the previous block, which allows the header to be chained to the header of the previous block.
- The Merkle root, whose role is to link the header to the rest of the block, as seen above.
- The timestamp: the date and time of the mining.
- A piece of data indicating the mining difficulty of the block.
- The proof-of-work nonce.
The Block Identifier
The block identifier has a particular role: in addition to being used to simply find the block, it constitutes the proof of work itself. This can be seen by the number of zeros with which it begins: the block 630,000, for example, has the identifier 000000000000000000024bead8df69990852c202db0e0097c1a12ea637d7e96d.
How is it obtained? It is simply the result of hashing the header by the double SHA-256. However, this is not easy to find since Bitcoin requires the resulting number to be less than a target value defined in the header, in accordance with the difficulty of the network. To do this, the miner varies the nonce (this field only exists for this purpose) in the header until it finds a solution. This solution constitutes proof that he spent energy in order to calculate all these hashes.
Note that the nonce provided by Satoshi Nakamoto is only coded on 4 bytes and only allows testing of 4.3 billion possibilities, which is too little for the current computing power. This is why miners also vary additional nonce within the reward transaction.
Summary
Here is a summary diagram of what a block of Bitcoin contains (since the activation of SegWit):
In blue is represented the identifier of the previous block, which is the result of two hashes by the SHA-256 function of the header of the previous block. This is what makes it possible to link the blocks together so as to obtain a chain of proof of work.
In red is represented the Merkle tree of transactions provided with their witness (signature). The fingerprints of these transactions are their SegWit identifier (wtxidor witness transaction identifier). The root of this Merkle tree is written in the block’s reward transaction ( ) so that the signatures are tied to the rest of the block.tx0
In green is represented the Merkle tree of transactions without their witness. The fingerprints of these transactions are their classic identifier (txid). The root of this Merkle tree is written within the block header. Since everything is linked, it is impossible to modify a transaction or its signature without modifying the header and, therefore, without altering the proof-of-work chain.
Conclusion
A block is an organized set of transactions, which contains a timestamp (the time and date of validation) and a proof (of work, of stake, of authority) included by the validator. The blocks are linked together from a first reference block so as to form a chain, the chain of blocks.
The blockchain is, thanks to its structure, a reputedly tamper-proof register: once a transaction is included in a block and a certain number of other blocks are added in succession, it can be considered irreversible.






