What are Blocks?

Blocks

Blocks are batches of transactions with a hash of the previous block in the chain. This links blocks together (in a chain) because hashes are cryptographically derived from the block data. This prevents fraud, because one change in any block in history would invalidate all the following blocks as all subsequent hashes would change and everyone running the blockchain would notice.

Prerequisites

Blocks are a very beginner-friendly topic. But to help you better understand this page, we recommend you first read Accounts, Transactions, and our Introduction to the Electroneum Smart Chain.

Why blocks?

To ensure that all participants on the Electroneum network maintain a synchronised state and agree on the precise history of transactions, we batch transactions into blocks. This means dozens (or hundreds) of transactions are committed, agreed on, and synchronised all at once.

Diagram adapted from Ethereum EVM illustrated↗

By spacing out commits, we give all network participants enough time to come to consensus: even though transaction requests occur dozens of times per second, blocks are only created and committed on the Electroneum Smart Chain once every five seconds.

How blocks work

To preserve the transaction history, blocks are strictly ordered (every new block created contains a reference to its parent block), and transactions within blocks are strictly ordered as well. Except in rare cases, at any given time, all participants on the network are in agreement on the exact number and history of blocks, and are working to batch the current live transaction requests into the next block.

Once a block is put together by a selected validator on the network, it is propagated to the rest of the network; all nodes add this block to the end of their blockchain, and a new validator is selected to create the next block. The exact block-assembly process and commitment/consensus process is currently specified by Electroneum’s “IBFT” protocol.

IBFT PROTOCOL

IBFT means the following:

  • In every slot (spaced five seconds apart) a validator is selected to be the block proposer in a round-robin fashion. They bundle transactions together, execute them and determine a new ‘state’. They wrap this information into a block and pass it around to other validators.

  • Other validators who hear about the new block re-execute the transactions to ensure they agree with the proposed change to the global state. Assuming the block is valid, they add it to their own database and include their signature in the proposed block.

  • Once the proposed block has signatures from two thirds or more of the validators, this block is canonically added to the chain and is considered final.

More on IBFT

What’s in a block?

There is a lot of information contained within a block. At the highest level a block contains the following fields:

  • timestamp – the time when the block was validatedpriority.

  • blockNumber – the length of the blockchain in blocks.

  • baseFeePerGas - the minimum fee per gas required for a transaction to be included in the block.

  • difficulty – always 1 in IBFT.

  • mixHash – a unique identifier for that block.

  • parentHash – the unique identifier for the block that came before (this is how blocks are linked in a chain).

  • transactions – the transactions included in the block.

  • stateRoot – the entire state of the system: account balances, contract storage, contract code and account nonces are inside.

  • extra – contains the set of allowed validators public keys

Block time

Block time refers to the time separating blocks. In Electroneum, time is divided up into five second units called ‘slots’. In each slot a single validator is selected to propose a block. Assuming all validators are online and fully functional there will be a block in every slot, meaning the block time is 5s. However, occasionally validators might be offline when called to propose a block, meaning slots can sometimes go empty.

This implementation differs from proof-of-work based systems where block times are probabilistic and tuned by the protocol’s target mining difficulty.

Block size

A final important note is that blocks themselves are bounded in size. Each block has a target size of 15 million gas but the size of blocks will increase or decrease in accordance with network demands, up until the block limit of 30 million gas (2x target block size). The total amount of gas expended by all transactions in the block must be less than the block gas limit. This is important because it ensures that blocks can’t be arbitrarily large. If blocks could be arbitrarily large, then less performant full nodes would gradually stop being able to keep up with the network due to space and speed requirements. The larger the block, the greater the computing power required to process them in time for the next slot. This is a centralising force, which is resisted by capping block sizes.

RELATED TOPICS

3 Likes