Validated, staking on eth2: #2 - Two ghosts in a trench coat
The Evolution of Consensus: Unpacking Eth2's Hybrid Approach
In the world of blockchain and distributed systems, consensus mechanisms are the backbone of any decentralized network. They ensure that all nodes agree on the state of the network, preventing forks and maintaining the integrity of the data. Eth2, the upcoming upgrade to the Ethereum network, has taken a novel approach to consensus by combining two mechanisms: Greedy Heaviest Observed Subtree (GHOST) and Casper the Friendly Finality Gadget (Casper FFG). In this article, we'll delve into the intricacies of Eth2's consensus mechanism, exploring its strengths, weaknesses, and implications.
The Trilemma: Safety, Liveness, and Asynchrony
In distributed systems, achieving consensus is a delicate balance between safety, liveness, and asynchrony. The FLP impossibility theorem states that it's impossible to simultaneously have all three properties unless some unreasonable assumptions are made about the system. Safety ensures that decisions cannot be unmade, liveness captures the notion that new things can be decided, and asynchrony means that there's no bound on how long a message may take to get delivered.
GHOST: The Fork-Choice Rule
Eth2 uses GHOST as its fork-choice rule, which selects the head of the chain by choosing the fork with the most votes. Each time there's a fork, GHOST considers all the votes for each fork block and their respective child blocks. The algorithm continues until it reaches a block with no children. GHOST has the benefit of reducing the efficacy of attacks during times of high network latency and minimizing the depth of chain reorgs when compared to the longest-chain rule.
LMD-GHOST: The Adaptation for PoS
In a Proof of Stake (PoS) context, GHOST is adapted to LMD-GHOST, which considers only the latest vote made by each validator, not any of the votes made in the past. This dramatically decreases the computation required when running GHOST, as the number of forks that need to be considered is not greater than the number of validators.
The Lack of Safety
GHOST's live and fully asynchronous nature means that it can't be safe, according to the FLP impossibility theorem. This presents itself in the form of reorgs, where a chain can suddenly switch between forks of arbitrary depth. Eth1 deals with this by having users make assumptions about how long miners' blocks will take to be communicated with the rest of the network, taking the form of waiting for a certain number of confirmations. Eth2, by contrast, makes no such assumptions.
Casper FFG: The Friendly Finality Gadget
Casper FFG is a mechanism that favors safety over liveness when making decisions. It's a crypto-economic adaptation of the classic Practical Byzantine Fault Tolerant (PBFT) protocol, which has phases where nodes first indicate that they'd like to agree on something (justification) and then agree that they've seen each other agreeing (finalization). Eth2 doesn't try to justify and finalize every slot but instead only every 32 slots, collectively called an epoch.
Two Ghosts in a Trench Coat
Consensus within Eth2 relies on both LMD-GHOST and Casper FFG. GHOST adds new blocks and decides what the head of the chain is, while Casper FFG makes the final decision on which blocks are and are not a part of the chain. The two protocols are merged by running GHOST from the last finalised block as decided upon by Casper FFG. By construction, the last finalised block is always a part of the chain, which means GHOST doesn't need to consider earlier blocks.
Implications and Forward-Looking Thoughts
Eth2's hybrid consensus mechanism offers a unique approach to achieving safety and liveness in a decentralized network. While it's still an experimental protocol, it has the potential to provide a more robust and scalable solution for large-scale blockchain networks. As the Ethereum network continues to evolve, it's essential to monitor the performance and security of Eth2 and make adjustments as needed to ensure its long-term success.
In conclusion, Eth2's consensus mechanism is a complex and innovative solution that combines the strengths of GHOST and Casper FFG. While it's still in its early stages, it has the potential to revolutionize the way we think about consensus in decentralized networks. As the blockchain space continues to evolve, it's essential to stay up-to-date with the latest developments and advancements in consensus mechanisms.
Source: https://blog.ethereum.org/en/2020/02/12/validated-staking-on-eth2-2-two-ghosts-in-a-trench-coat




