# Ethereum Consensus Layer ## The Beacon Chain The **Beacon Chain** is the coordination layer of Ethereum’s **Proof of Stake (PoS)** system. It manages: - **Validators** - **Staking** - **Finalization of blocks** Unlike **Proof of Work (PoW)**, where miners compete to produce blocks, the Beacon Chain introduces **validators** who participate in block production and finalization. Ethereum’s **Proof of Stake (PoS)** consensus is based on the **Ethereum Consensus Specification**, which defines the rules that validators follow to **propose, attest, and finalize blocks**. The two key components of Ethereum’s consensus mechanism are: - **Casper FFG** (Finality Gadget) - **LMD-GHOST** (Fork-Choice Rule) ## LMD-GHOST: The Fork Choice Rule - LMD-GHOST stands for **Latest Message Driven, Greedy Heaviest Observed Subtree**. - It is the **fork-choice rule** used to determine the head of the chain. ### How LMD-GHOST Works: - The block with the **most validator attestations** is selected as the next head of the chain. - Instead of selecting the **longest chain** (as in PoW), nodes choose the chain with the **most recent votes** (attestations) from validators. - Validators cast **votes (attestations)** for blocks, and the fork choice rule follows the branch with the **heaviest accumulated weight**. ## Casper FFG: The Finality Mechanism Casper FFG ensures that **decisions made on the blockchain are final** and cannot be changed. It works by having **checkpoints** that are confirmed by validators. Once a **checkpoint is finalized**, it cannot be reverted without **slashing validators**. ## Epochs and Checkpoints Ethereum operates in **epochs**, where: - **1 epoch = 32 slots** - **1 slot = 12 seconds** - **1 epoch ≈ 6.4 minutes** ### Checkpoint Process: 1. The **first block** in an epoch is selected as a **checkpoint**. 2. Validators vote to **justify** a checkpoint. 3. If a checkpoint receives **2/3 of the total stake**, it becomes **justified**. 4. If a **justified checkpoint** is confirmed in the next epoch, it becomes **finalized**. ## Block Proposal - A **validator** is randomly selected via **RANDAO and VRF** to propose a block **every 12 seconds**. - **VRF (Verifiable Random Function)** ensures that the randomness is **cryptographically secure**. ## Attestation Process Validators participate in **each slot** by attesting to blocks based on: - **Source**: The last **justified checkpoint**. - **Target**: The **current checkpoint**. - **Head**: The **best block** according to LMD-GHOST. ## Summary Table | **Component** | **Role** | |---------------|---------| | **LMD-GHOST** | Determines the canonical chain by selecting the block with the most validator votes. | | **Casper FFG** | Ensures economic finality by justifying and finalizing checkpoints. | | **Validators** | Propose blocks, attest to checkpoints, and follow slashing rules. | | **Epochs & Slots** | Blocks are produced every **12 seconds** and reach finality in **6 minutes**. | | **Finality Rule** | A block is **finalized** when it is part of a **checkpoint** that is **justified** and confirmed in the next epoch. |