Skip to content

Consensus Layer

Consensus Layer

After Ethereum transitioned from Proof of Work to Proof of Stake, the Ethereum protocol began to consist of two core components: the Consensus Layer and the Execution Layer, each responsible for different functions and tasks.

The consensus layer is responsible for ensuring the security and integrity of the network. It enables all participants to agree on the current state of the network and reach consensus on which transactions should be added to the next block.

The consensus layer's work involves several parts: becoming a validator, participating in attestation and block production, and slashing for malicious behavior.

How It Works

In PoS, validators are key participants. They stake 32 ETH as collateral to participate in securing the network. When depositing ETH, users enter a validator activation queue. Once activated, validators need to run both an execution client and a consensus client for block verification and production. Validators receive new blocks from peer nodes on the Ethereum network, and they check and sign votes on certain blocks to confirm their validity (this is called attestation).

Time on Ethereum is counted in 12-second units called "slots." 32 slots make up an epoch, which can be understood as a complete round (an epoch is approximately 6.4 minutes). At the beginning of each round, the entire validator set is randomly divided (using RANDAO for random assignment) into 32 committees, corresponding to the 32 slots of the upcoming epoch.

Dividing the validator set into committees is critical for keeping network load manageable. Committees partition the validator set into different groups, with each slot having a dedicated committee assigned to it, so that every active validator attests in each epoch without needing to do so in every slot.

In each slot, one validator is randomly selected from the committee as the block proposer. This validator is responsible for creating a new block and broadcasting it to other nodes on the network. If a validator fails to stay online and perform their computational duties, that validator's block rewards will be moderately reduced, incentivizing validators to remain online as much as possible. If a validator attempts to maliciously attack the network (i.e., validating incorrect data history), all or part of that validator's staked 32 ETH will be slashed.

At the end of each epoch, validators evaluate the proposals and attestations from the previous epoch. This evaluation affects validator rewards and penalties, and finality checkpoints are used to confirm the state of the blockchain. The first block of each epoch is typically used as a checkpoint. Finality is managed through "checkpoint" blocks. If a checkpoint attracts votes representing at least two-thirds of the total staked ETH (across two epochs), the checkpoint is upgraded to Finalized.

Because only a subset of active validators attests in each slot, but all active validators attest in each epoch, it takes 2 epochs to demonstrate a "supermajority vote" (i.e., 66% of the total staked ETH on the network agrees on two checkpoints).

On block explorers, three states are typically displayed: Unfinalized -> Safe (after one epoch) -> Finalized (after two epochs)