From 65c02db6d78b5f05b965460a8f2b476dc96c54e0 Mon Sep 17 00:00:00 2001 From: LeezeeUwakwe <75491900+LeezeeUwakwe@users.noreply.github.com> Date: Sat, 12 Apr 2025 15:39:03 +0100 Subject: [PATCH] Added task_answers dir. and added session5_answer.md --- tasks_answers/session5_answer.md | 85 ++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tasks_answers/session5_answer.md diff --git a/tasks_answers/session5_answer.md b/tasks_answers/session5_answer.md new file mode 100644 index 0000000..b74043f --- /dev/null +++ b/tasks_answers/session5_answer.md @@ -0,0 +1,85 @@ +# Ethereum Consensus Mechanisms: Casper LMD-GHOST, Checkpoint Sync, and Consensus Specifications + +## Introdution + +Ethereum consensus mechanism is the system that ensures all nodes in the network agree on the state of the blockchain. Here’s a closer look at three key parts of how Ethereum’s Proof-of-Stake (PoS) consensus works: + +1. **Casper LMD-GHOST**: The fork-choice rule used by Ethereum's consensus layer. It determines which block is the "head" of the chain. +2. **Checkpoint Sync**: A fast Synchronization method allowing new nodes to join the network efficiently. +3. **Consensus Specifications**: Rules governing consensus + +## Casper LMD-GHOST + +Casper LMD-GHOST (Latest Message Driven Greedy Heaviest Observed SubTree) is the fork-choice rule and finality mechanism used by Ethereum's consensus layer, it determines which block is the "head" of the chain, i.e., the block that validators should build on top of + +## How it works: + +1. **Validators Vote on Blocks:** + Validators cast votes (called attestations) for the blocks they believe should be part of the canonical chain. Each validator’s vote includes the block they think is the best based on the information they’ve seen + +2. **Fork-Choice Decision** + LMD-GHOST (Latest Message Driven – Greediest Heaviest Observed SubTree) uses these attestations to recursively select the next block by choosing the child block with the most total voting weight at each level, starting from the last justified checkpoint. + +3. **Finality** + Although LMD-GHOST helps decide which block to build on, it doesn’t provide finality. That’s handled by Casper FFG, which finalizes blocks when 2/3 of validators agree on them through checkpoint voting + +## Diagram: + +![Fd8ivDeVEAAf3Gr](https://hackmd.io/_uploads/BJAN7azAke.png) + +## Checkpoint Sync + +Checkpoint synchronization (or state sync) is a mechanism used in blockchain networks to accelerate node synchronization and improve network efficiency. It enables blockchain nodes to quickly join a network by syncing to a specific, verified state (a "checkpoint") rather than downloading and validating the entire blockchain history from the genesis block. + +## How it works + +- Nodes download a checkpoint, which is a snapshot of the blockchain's state at a specific point in time. +- They then verify the checkpoint's validity against the network's consensus rules +- Once the checkpoint is verified, the node can start processing new blocks and transactions from that point onward. + +## Benefits: + +1. **Faster initial sync:** Checkpoint sync significantly reduces the time it takes for a new node to join the network. +2. **Reduced storage requirements:** Nodes don't need to store the entire blockchain history, saving storage space. +3. **Faster recovery:** Nodes can recover from failures or outages by syncing from the latest checkpoint, rather than starting from scratch + +## Diagram: + +![checkpoint](https://hackmd.io/_uploads/r1jOGpGRkg.png) + +## Consensus Specification + +## Overview + +Ethereum’s Consensus Specifications are rules that define how the consensus layer works, including how validators operates, how blocks are proposed, attested, and how finality is reached. + +## Components of Ethereum Consensus + +1. Validator Roles + + - Replace miners in PoS. Responsible for proposing and attesting to blocks. + +2. Block Finalization + + - **Two-Stage Finality:** + + i. Justification: 2/3 of validators attest to a checkpoint. + + ii. Finalization: The next checkpoint is justified → prior checkpoint finalizes. Finalized blocks are irreversible + +3. Slashing & Penalties + + **What Triggers Slashing?** + + - **Double Block Proposal:** Signing two different blocks in the same slot. + - **Double Voting:** Attesting to two conflicting blocks in the same epoch. + +## References + +- Ethereum Consensus Specs (Main Repo):https://github.com/ethereum/consensus-specs + +--- + +## Conclusion + +Ethereum’s consensus specifications defines a secure, slashing-enforced, Proof-of-Stake system. It is decentralized, economically and secured.