Block is a place in a blockchain where data is stored. In the case of cryptocurrency blockchains, the data stored in a block are transactions. These blocks are chained together by adding the previous block's hash to the next block's header. It keeps the order of the blocks intact and makes the data in the blocks immutable.
The structure of a block is different for every blockchain. However, a general structure of a block is as follows:
A block consists of the following two main parts:
A block's header contains information about the block and the miner. It is further divided into subparts which are as follows:
This is the hash of the previous block. It chains the blocks together and makes the data in the previous blocks immutable. If data in the previous blocks is changed, then the hash of that block will change causing the unchaining of the blockchain.
These fields can vary depending on the different requirements of different blockchains. Some of the common fields are as follows:
Nonce: This is an integer that a miner changes to change the hash of the block to achieve the network's difficulty.
Timestamp: This is the time at which the block was mined. It is usually in the
Difficulty: It is the current difficulty level of the network. It is stored in different formats in every blockchain.
Merkel root hash: Hashes pair off transactions until only one hash remains, called a root hash or a Merkel root hash.
Block height: The number of blocks mined between the genesis block and the current block.
It includes all the data stored in the block, such as transactions. Every blockchain has a different format for storing transactions. An array of transactions is stored in the body of the block.