Consensus: how thousands of computers agree on one truth
Thousands of nodes must agree on which block comes next. Two dominant approaches:
- Proof of Work (PoW) — miners compete to solve a computationally expensive puzzle (find a hash below a target). The winner proposes the next block. Attacking the chain requires controlling majority hash power.
- Proof of Stake (PoS) — validators lock up collateral ("stake"). A validator is selected (often weighted by stake) to propose the next block; dishonest validators can be "slashed" (lose stake). Attacking requires controlling majority stake.
Consensus mini-simulator
A toy network of 6 nodes. In PoW the winner is random weighted by hash power; in PoS the proposer is picked at random, weighted by stake. Adjust weights and run rounds to see who proposes the next block.
Node 1
hash power: 28
proposed: 0
proposing
Node 2
hash power: 22
proposed: 0
proposing
Node 3
hash power: 18
proposed: 0
proposing
Node 4
hash power: 16
proposed: 0
proposing
Node 5
hash power: 10
proposed: 0
proposing
Node 6
hash power: 6
proposed: 0
proposing
Round 0
Note: real consensus is far more complex (forks, finality, slashing, attestation). This is a toy to build intuition, not a simulation.