Opening up a Block of Ethereum
The following article covers the structure of a block on Ethereum and is one in of a series articles covering The Basics of Ethereum following the Introduction to Ethereum article.
What is a Block
A block in Ethereum is a batch of transactions with the hash of the previous block at the top of the block. The blocks are linked together in a chain (called a blockchain). Analogy wise, the block can be thought of as a page in a ledger (the blockchain). The hash is are derived from the contents in the block as an input and a hashing function (Keccak-256) as the output.
Any one change in a block will generate an entirely new hash. This makes the chain fraud resistent since one change in any block in history would invalidate all the subsequent blocks.
Here are the key features of an Ethereum block:
- In Ethereum the time between blocks being added to the blockchain is roughly 14 seconds.
- Ethereum block’s have a size limit based on the gas limit which is a measure for complexity of operations on the network. Currently the maximum block size in Ethereum is around 15,000,000 Gas (as of April 19/20/21).
- The block gas limit can be dynamically adjusted by miners. In each block, miners can increase or decrease the block size by a maximum of the previous block size divided by 1024 (so roughly 0.1% in either direction).
- EIP proposals are raised for significant block size increases.
Each block contains the Block Header, Transaction List and Ommer List (Uncle Block List).
There will be a future article covering Uncle Blocks in more technical detail. An article on what a trie is in Ethereum will be written on this blog.
- parentHash — a hash of the parent block’s (the block that came before) header.
- ommersHash — a hash of the Ommer list in this block.
- beneficiary — the account address that receives the fees for mining this block (the miner’s address).
- stateRoot — the hash of the root node of the state trie (used by light nodes to verify the state of the system: account balances, contract storage, contract code).
- transactionsRoot — the hash of the root node of the trie that contains all transactions listed in this block. The transaction list for the block is assembled into the leaf nodes for the transaction trie and then the transaction root is calculated off of the hash of all the child nodes.
- receiptsRoot — the hash of the root node of the trie that contains the receipts of all transactions listed in this block. The receipt is generated for every transaction containing information specific to the transaction such as gas used and transaction hash.
- logsBloom — Ethereum like any computer program allows logging. A contract can generate a log by defining the “events” to be logged. A log might contain the logger’s account address, a series of topics that represent various events carried out by this transaction, and any data associated with these events. A very detailed look into logs. On the fileter: definition straight from the yellow paper “The Bloom filter composed from indexable information (logger address and log topics) contained in each log entry from the receipt of each transaction in the transactions list”.
- difficulty — a scalar value that quantifies the difficulty level of this block. The genesis block has a difficulty value of 131,072, with every blocks afterward having the block difficulty calculated off of this value (reference the yellow paper for the calculation). The expected time to find a solution is proportional to the difficulty. The protocol can adjust the difficulty to impact the validation time of a block and aims to maintain a constant rate of one block every 15 seconds.
- number — the count of current block in the blockchain. The genesis block (first ethereum block on the blockchain) is 0.
- gasLimit — the current gas limit per block.
- gasUsed — the total gas used by transactions in this block.
- timestamp — the unix timestamp at this block’s inception (coincides with when mining ends and this block is added).
- extraData — optional field for extra data relevant to this block.
- mixHash — a hash that, when combined with the nonce, proves that this block has gone through proof of work.
- nonce — a number that is calculated when mining a block, using the proof-of-work algorithm.
You can explore the Ethereum blockchain using Etherscan.