Consensus Mechanisms
Module 2 of Blockchain Fundamentals
What Is Consensus?
Consensus is how distributed nodes agree on a single version of truth without a central authority.
The challenge: Nodes can be slow, offline, or malicious. How do honest nodes agree?
The Sybil Problem
In digital systems, identities are free. One attacker could create millions of fake identities.
Sybil attack: Overwhelm a vote-based system with fake identities.
Solution: Make creating an identity costly.
- Proof of Work: Cost = computation/electricity
- Proof of Stake: Cost = locked capital
- Proof of Authority: Cost = reputation
Proof of Work (PoW)
How It Works
- Transactions are broadcast to the network
- Miners collect transactions into a block
- Miners race to find a valid hash (computationally expensive)
- First miner to find it broadcasts the block
- Other nodes verify and add to their chain
- Miner receives block reward + fees
The Mining Puzzle
Find a nonce such that:
SHA256(block_header + nonce) < target
Example target: 0000000000000000000abc...
Hash must start with many zeros
Properties:
- Hard to find (brute force only)
- Easy to verify (one hash check)
- Difficulty adjusts to maintain ~10 min blocks (Bitcoin)
Security Model
Attack cost = cost to acquire 51% of hash power
Current Bitcoin security:
- ~400 EH/s network hashrate
- Would cost billions to attack
- Attack would likely crash BTC price (self-defeating)
Advantages
- Battle-tested (15+ years)
- Simple and elegant
- No stake grinding attacks
- Fair launch possible (anyone can mine from day 1)
Disadvantages
- High energy consumption (~100 TWh/year for Bitcoin)
- Mining centralization (economies of scale)
- Slow finality (need 6+ confirmations)
- Hardware arms race (ASICs)
Proof of Stake (PoS)
How It Works
- Validators lock up stake (collateral)
- Protocol selects validator to propose block
- Other validators attest to validity
- Valid blocks are added to chain
- Validator receives rewards
- Misbehavior → stake is slashed (destroyed)
Selection Mechanisms
| Method | How It Works | Used By |
|---|---|---|
| Random selection | Weighted by stake | Ethereum |
| Coin age | Stake × time held | Peercoin |
| Round robin | Validators take turns | Some private chains |
| Delegated | Token holders vote for validators | EOS, Cosmos |
Security Model
Attack cost = cost to acquire 33%+ of staked tokens
Ethereum security:
- ~30M ETH staked
- Would cost $60B+ to attack
- Attacker's stake would be slashed
Advantages
- ~99.9% less energy than PoW
- Lower barrier to participation (no special hardware)
- Faster finality possible
- Native slashing for misbehavior
Disadvantages
- "Nothing at stake" problem (partially solved)
- Long-range attacks (checkpoints solve this)
- Wealth concentration (rich get richer)
- More complex than PoW
PoW vs PoS Comparison
| Property | Proof of Work | Proof of Stake |
|---|---|---|
| Sybil resistance | Computation | Capital |
| Energy use | Very high | Very low |
| Hardware | Specialized (ASICs) | Consumer grade |
| Finality | Probabilistic | Economic/Deterministic |
| Attack cost | Buy/build hardware | Buy tokens |
| Fair launch | Possible | Difficult |
| Decentralization | Mining pools | Stake concentration |
Other Consensus Mechanisms
Delegated Proof of Stake (DPoS)
Token holders vote for a small set of validators (21-100).
Used by: EOS, Tron, BSC
Tradeoff: Faster/cheaper, but more centralized.
Proof of Authority (PoA)
Known, trusted validators (identity = stake).
Used by: Private chains, testnets
Tradeoff: Fast and cheap, but requires trust.
Proof of Space/Storage
Stake = allocated disk space.
Used by: Chia, Filecoin
Tradeoff: Less energy than PoW, repurposes hardware.
Proof of History (PoH)
Cryptographic clock for ordering without consensus.
Used by: Solana
Tradeoff: Very fast, but adds complexity.
Byzantine Fault Tolerance (BFT)
Classical consensus for known validator sets.
PBFT (Practical BFT)
- Leader proposes block
- Validators exchange "prepare" messages
- Validators exchange "commit" messages
- Block is finalized (no reverts)
Properties:
- Instant finality
- Tolerates f failures with 3f+1 nodes
- Doesn't scale well (O(n²) messages)
Tendermint
PBFT variant optimized for blockchain.
Used by: Cosmos ecosystem
Properties:
- Instant finality
- Better performance than classic PBFT
- Requires 2/3 honest validators
Finality
When is a transaction "final" (irreversible)?
Probabilistic Finality (PoW)
Never truly final, but increasingly unlikely to revert.
Confirmations Probability of Revert
1 ~10%
3 ~1%
6 ~0.01%
100 Effectively zero
Economic Finality (PoS)
Reverting would cost attackers more than they'd gain.
Ethereum:
After 2 epochs (~13 min): Would cost 1/3 of stake to revert
After finalization: Cannot revert without social consensus
Absolute Finality (BFT)
Once committed, mathematically impossible to revert.
Tendermint: Finality in ~6 seconds
The Blockchain Trilemma
Vitalik Buterin's observation: Hard to optimize all three simultaneously.
Security
/\
/ \
/ \
/ Pick \
/ 2 \
/ \
/____________\
Decentralization Scalability
| Chain | Security | Decentralization | Scalability |
|---|---|---|---|
| Bitcoin | High | High | Low (~7 TPS) |
| Ethereum | High | Medium | Medium (~30 TPS) |
| Solana | Medium | Low | High (~65k TPS) |
| BSC | Medium | Low | High |
L2 solutions attempt to break the trilemma by inheriting L1 security while scaling.
Key Takeaways
- Consensus solves the Sybil problem by making identities costly
- PoW uses energy, PoS uses capital — both create security
- Finality varies: Probabilistic, economic, or absolute
- Tradeoffs are unavoidable — the blockchain trilemma
- No perfect consensus — choose based on requirements
- Hybrid approaches are emerging (Ethereum's PoS + checkpoints)
Questions to Consider
- Is PoW's energy use justified by its security properties?
- Does PoS centralize power with wealthy stakeholders?
- How many confirmations do you wait for large transactions?
- Can the blockchain trilemma ever be solved?