Blocks are an important concept in Ethereum. Blocks are containers for a transaction. A block contains multiple transactions. Each block has a different number of transactions based on gas limit and block size. Gas limit will be explained in detail in later sections. The blocks are chained together to form a blockchain. Each block has a parent block and it stores the hash of the parent block in its header. Only the first block, known as the genesis block, does not have a parent.
A typical block in Ethereum is shown in the following screenshot:
There are a lot of properties associated with a block, providing insights and metadata about it, and following are some of important properties along with their descriptions:
- The difficulty property determines the complexity of the puzzle/challenge given to miners for this block.
- The gasLimit property determines the maximum gas allowed. This helps in determining how many transactions can be part of the block.
- The gasUsed property refers to the actual gas used for this block for executing all transactions in it.
- The hash property refers to the hash of the block.
- The nonce property refers to the number that helps in solving the challenge.
- The miner property is the account identifier of the miner, also known as coinbase or etherbase.
- The number property is the sequential number of this block on the chain.
- The parentHash property refers to the parent block's hash.
- The receiptsRoot, stateRoot, and transactionsRoot properties refer to Merkle trees discussed during the mining process.
- The transactions property refers to an array of transactions that are part of this block.
- The totalDifficulty property refers to the total difficulty of the chain.