-
Book Overview & Buying
-
Table Of Contents
Solidity Programming Essentials - Second Edition
By :
Blocks are an important concept in Ethereum. They are containers for a transaction. A block contains multiple transactions. Each block has a different number of transactions based on the gas limit and block size. The 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:
Figure 1.12 – A typical block in Ethereum
There are a lot of properties associated with a block, providing insights and metadata about it, and the following are some of the important properties along with their descriptions:
difficulty property determines the complexity of the puzzle/challenge given to miners for this block.gasLimit property determines the maximum gas allowed. This helps in determining how many transactions can be part of the block.gasUsed property refers to the actual gas used for this block for executing all transactions in it.hash property refers to the hash of the block.nonce property refers to the number that helps in solving the challenge.miner property is the account identifier of the miner, also known as coinbase or etherbase.number property is the sequential number of this block on the chain.parentHash property refers to the parent block's hash.receiptsRoot, stateRoot, and transactionsRoot properties refer to the Merkle trees discussed during the mining process.transactions property refers to an array of transactions that are part of this block.totalDifficulty property refers to the total difficulty of the chain.