Consensus Mechanisms

Concepts: Why Consensus, Proof of Work, Proof of Stake, The Merge, PoW vs PoS, DPoS/PoA/PoH, Finality, Attacks

:::section{mins=2} Why Consensus Matters :::

:::lead Every second, participants propose competing versions of history. [[gloss:consensus|Consensus]] is the mechanism that picks one version — and rejects the rest. :::

:::p Imagine 10,000 independent [[gloss:node|nodes]] maintaining the same [[gloss:blockchain|blockchain]] ledger — with no central coordinator. Someone sends money: everyone can record and verify the same [[gloss:transaction|transaction]]. :::

:::p Now the hard part: two participants propose different next [[gloss:block|blocks]]. A third deliberately edits its copy to claim funds it doesn't have. Who wins? Which history becomes “real”? :::

:::p [[gloss:consensus|Consensus]] is the rule that answers that question. It doesn't assume honesty — it makes cheating unprofitable (wasted electricity in [[gloss:proof of work|PoW]] or lost collateral via [[gloss:slashing|slashing]] in [[gloss:proof of stake|PoS]]). For you as a user this translates directly into confirmation speed, fees, and reliability. :::

:::howto{label="How to think about this"}

  • Consensus is not “nodes agreeing.” It is designing incentives so cheating costs more than honesty.
  • [[gloss:proof of work|PoW]] security comes from real-world cost: hardware + electricity. You can’t fake it.
  • [[gloss:proof of stake|PoS]] security comes from locked capital. Break rules → lose it ( [[gloss:slashing|slashing]] ). :::

:::callout{icon=💡} Mental model: a council vote. Even if some members are corrupt, the outcome stays correct as long as the honest majority is large enough. :::

:::keypoints{label="Key points"}

  • [[gloss:consensus|Consensus]] decides which version of [[gloss:blockchain|blockchain]] history is correct
  • Dishonest actors don’t “break” the network — they get rejected or pay real costs
  • Security depends on what your vote costs: electricity (PoW) or locked collateral (PoS) :::

:::details{badge=Advanced title="Why “one-third” keeps showing up"} :::p Many distributed systems are built to tolerate up to ~1/3 bad actors. That’s the classic Byzantine Fault Tolerance threshold: to safely outvote dishonest participants you need enough honest voting weight. ::: :::

:::quiz{label="Check yourself" correct=2 explanation="Consensus doesn’t rely on goodwill. It makes dishonesty economically irrational — via wasted electricity (PoW) or slashed collateral (PoS)."} Why does consensus make cheating unprofitable — not just technically hard?

  • The government monitors all transactions
  • Participants voluntarily agreed to follow the rules
  • Cheating costs more than playing fair — by design
  • The majority always makes the right decision :::

:::section{mins=3} Proof of Work (Bitcoin) :::

:::lead [[gloss:bitcoin|Bitcoin]] uses [[gloss:proof of work|Proof of Work]]: to add a [[gloss:block|block]], miners solve a hard puzzle. First to solve broadcasts the block and earns BTC. That’s mining. :::

:::p The puzzle is simple to describe: find a number (a nonce) such that the [[gloss:hash|hash]] of the block starts with N zeros. There’s no shortcut — you just try huge amounts of random nonces until one works. :::

:::p The key asymmetry: finding the answer is expensive; verifying is cheap. Anyone can instantly check that a miner really did the work. That’s why PoW is secure: proving effort is hard, checking it is trivial. :::

:::callout{icon=💡} PoW is like a lottery where each ticket costs electricity. More hashrate = more tickets. You can’t fake tickets. :::

:::keypoints{label="Key points"}

  • Miners compete to find a nonce that makes the block [[gloss:hash|hash]] meet difficulty
  • Difficulty retarget keeps block time stable (Bitcoin ~10 min)
  • Security = economic cost of recreating more work than the honest network :::

:::details{badge=Advanced title="Pools & centralization pressure"} :::p Solo mining is statistically pointless for most miners, so they join pools and share rewards. Pools increase payout stability but also concentrate transaction selection and block-building influence. ::: :::

:::quiz{label="Check yourself" correct=1 explanation="The asymmetry is the core: huge work to find, trivial to verify. A cheating miner wastes electricity and still gets rejected."} Why is Proof of Work secure despite being just brute force?

  • Because miners sign their blocks with a private key
  • Finding a valid hash is expensive, but verifying it is instant — cheating isn’t worth it
  • The network monitors miners in real time
  • Only trusted nodes can propose blocks :::

:::section{mins=3} Proof of Stake (Ethereum) :::

:::lead [[gloss:ethereum|Ethereum]] uses [[gloss:proof of stake|Proof of Stake]]: instead of spending electricity, [[gloss:validator|validators]] lock ETH as collateral. Honest behavior earns rewards. Dishonest behavior triggers [[gloss:slashing|slashing]]. :::

:::p To become a validator, you lock 32 ETH (or join a staking pool). Every 12 seconds, the protocol picks a proposer to create the next [[gloss:block|block]]. Other validators attest (vote) whether it’s valid. :::

:::p If a validator tries to cheat — for example, votes for conflicting blocks — the protocol destroys part of the stake. That penalty is [[gloss:slashing|slashing]]. The more you stake, the more you can lose, so security scales with capital at risk. :::

:::callout{icon=💡} PoS is like posting a huge security deposit to participate. Break the rules → the deposit gets cut automatically. :::

:::keypoints{label="Key points"}

  • [[gloss:proof of stake|PoS]] replaces electricity cost with locked collateral
  • 12-second slots: proposer proposes a block, others attest
  • [[gloss:slashing|Slashing]] makes double-voting economically suicidal :::

:::details{badge=Advanced title="Fork-choice vs finality"} :::p Ethereum has a fork-choice rule (which chain to follow right now) and [[gloss:finality|finality]] (when history becomes economically irreversible). Finality is what makes reorgs extremely expensive. ::: :::

:::quiz{label="Check yourself" correct=3 explanation="That’s [[gloss:slashing|slashing]]: punishment is enforced by code, making double-voting irrational."} What happens to a validator's stake if they vote for two competing blocks?

  • They get a smaller reward
  • They are temporarily banned from the network
  • Nothing — votes are anonymous
  • The protocol automatically burns part of their stake :::

:::section{mins=2} The Merge :::

:::lead September 15, 2022: Ethereum switched from [[gloss:proof of work|PoW]] to [[gloss:proof of stake|PoS]]. Energy use dropped ~99.95% — one of the biggest upgrades in crypto history. :::

:::p For users it was mostly invisible: wallets, balances, and [[gloss:transaction|transaction]] history stayed the same. What changed was the [[gloss:consensus|consensus]] mechanism under the hood. :::

:::keypoints{label="Key points"}

  • The Merge was a consensus upgrade, not a scaling upgrade
  • Block time stabilized around 12 seconds (slots)
  • Security moved from electricity cost (PoW) to collateral + [[gloss:slashing|slashing]] (PoS) :::

:::quiz{label="Check yourself" correct=1 explanation="The Merge changed the consensus mechanism. Scaling and fee reductions came via separate upgrades (L2s, blobs, etc.)."} What did The Merge primarily change?

  • It made gas fees 100× cheaper overnight
  • It switched Ethereum’s consensus from PoW to PoS
  • It moved Ethereum transactions off-chain
  • It removed smart contracts :::

:::section{mins=3} PoW vs PoS :::

:::lead [[gloss:proof of work|PoW]] and [[gloss:proof of stake|PoS]] solve the same problem: how to choose the next [[gloss:block|block]] without trusting anyone. They just price “voting power” differently. :::

:::p PoW prices votes in electricity + hardware. PoS prices votes in locked capital. In both cases, an attacker must control a majority of the resource to reliably rewrite history. :::

:::keypoints{label="Key points"}

  • PoW: attacks require sustained energy spend and hardware access
  • PoS: attacks require buying/controlling large stake and risk losing it via [[gloss:slashing|slashing]]
  • Both trade off decentralization pressures differently (mining pools vs staking providers) :::

:::quiz{label="Check yourself" correct=2 explanation="In [[gloss:proof of stake|PoS]], voting power comes from locked capital; misbehavior can be punished with [[gloss:slashing|slashing]]."} What is the main security “resource” in PoS?

  • Electricity
  • GPU memory
  • Locked collateral (stake)
  • Government permission :::

:::section{mins=2} Other Mechanisms :::

:::lead Not every chain uses pure [[gloss:proof of work|PoW]] or [[gloss:proof of stake|PoS]]. There are hybrids and delegated models — usually trading decentralization for speed. :::

:::p Examples you’ll see in the wild: Delegated Proof of Stake (DPoS), Proof of Authority (PoA), Proof of History (PoH), and various BFT-style voting systems. :::

:::keypoints{label="Key points"}

  • Fewer decision-makers often means faster blocks — but more trust assumptions
  • Read the fine print: who can become a validator, and what happens when they misbehave? :::

:::quiz{id=q-1-3-s6 correct=2 explanation="Correct. The consensus trilemma: optimize any two of three — speed, security, decentralization — and the third suffers. Ethereum chose decentralization + security. Solana chose speed + security. BNB Chain chose speed + security with fewer validators. None is wrong — they're optimized for different use cases."} Why do dozens of consensus mechanisms exist instead of one universal solution?

  • Because developers can't agree on one standard
  • Because older mechanisms have bugs that newer ones fix
  • Because you can't optimize for speed, security, and decentralization simultaneously
  • Because each mechanism works only in one country :::

:::section{mins=2} Finality :::

:::lead [[gloss:finality|Finality]] means: at some point, history becomes practically irreversible. Different chains reach it differently — probabilistically or economically. :::

:::p Bitcoin finality is probabilistic: every additional block makes a reorg less likely. Ethereum PoS finality is economic: reverting finalized history requires destroying a large fraction of stake. :::

:::keypoints{label="Key points"}

  • Finality is about when you can treat a transaction as “done forever”
  • Different consensus mechanisms imply different confirmation best-practices :::

:::quiz{id=q-1-3-s7 correct=2 explanation="Correct. Bitcoin has probabilistic finality: after 6 blocks (~60 min), reversing the transaction would cost more than any realistic gain. For small amounts 1–3 confirmations is fine. For large amounts — wait for 6."} You're accepting a $50,000 payment in Bitcoin. How long should you wait before considering it final?

  • A few seconds — once it appears in the mempool
  • 1 confirmation (~10 min) is enough
  • 6 confirmations (~60 min) — after which reversal is economically irrational
  • 24 hours — only then is Bitcoin truly final :::

:::section{mins=3} Attacks on Consensus :::

:::lead Consensus can be attacked. The most famous in [[gloss:proof of work|PoW]] is a “51% attack”: if an attacker controls majority hashrate, they can outpace honest miners and rewrite recent history. :::

:::p In practice, the primary goal is usually double-spend: pay a merchant, receive goods, then reorganize the chain to remove that payment. Big chains make this economically irrational; small PoW chains can be cheap to attack. :::

:::callout{icon=🧪} Open the simulation below and move the attacker share past 51%. You’ll see why “majority decides” becomes dangerous. :::

:::keypoints{label="Key points"}

  • 51% attack is about controlling the majority of the consensus resource
  • Large networks are safer mostly because attacks are expensive :::

:::quiz{id=q-1-3-s8 correct=1 explanation="Correct. Attacking Ethereum Classic costs thousands per hour. Attacking Bitcoin costs millions. Same math — different scale. Security is directly proportional to the value at stake."} Why do 51% attacks happen on small networks like Ethereum Classic but not on Bitcoin or Ethereum?

  • Small networks have weaker encryption
  • The cost of attack scales with network size — small networks are cheap to attack
  • Large networks have government protection
  • Bitcoin and Ethereum use a different consensus mechanism :::

:::section{mins=3} MEV: The Hidden Block Economy :::

:::lead [[gloss:mev|MEV]] is the “hidden economy” of block production: whoever builds the block can profit by reordering transactions (arbitrage, liquidations, sandwich attacks). :::

:::p MEV exists because the mempool is public and block builders can choose ordering. In PoS Ethereum, builder-proposer separation (MEV-Boost) pushed much of block-building into specialized builders. :::

:::keypoints{label="Key points"}

  • MEV is a consequence of transaction ordering control
  • Mitigating MEV is an active research and ecosystem area :::

:::quiz{id=q-1-3-s9 correct=0 explanation="Correct. Front-running: spot a trade, get in front. A sandwich attack goes further — before AND after the victim. Arbitrage exploits price differences between exchanges. All three are forms of MEV."} A bot spots your large token swap in the mempool and inserts a buy order before it. What is this called?

  • Front-running
  • Sandwich attack
  • Arbitrage
  • Slashing :::