Mining and Proof of Stake
How blockchains agree on the next block: proof of work mining, proof of stake validation, and the trade-offs between the two.
A blockchain is a shared record kept by thousands of independent computers. None of them is in charge, yet they all need to agree on which transactions happened and in what order. The set of rules that lets them reach this agreement is called a consensus mechanism. The two most widely used ones are proof of work (PoW), which relies on mining, and proof of stake (PoS), which relies on validators who lock up coins.
Why a blockchain needs consensus
Imagine anyone could add a block whenever they liked. Two people could publish conflicting versions of history, or one person could try to spend the same coins twice. A consensus mechanism solves this by making it costly to propose blocks and by giving everyone a clear rule for which chain is the valid one. The cost is what makes cheating unattractive: an attacker would need to spend enormous resources to rewrite history.
Proof of work: mining
Proof of work was introduced by Bitcoin, and Bitcoin still uses it today.
How mining works
Miners gather pending transactions into a candidate block. To add it to the chain, they must find a number that, combined with the block's data and run through a hash function, produces a result below a certain target. There is no shortcut: the only way to find such a number is to try huge numbers of guesses. Specialized hardware does this billions of times per second.
The first miner to find a valid answer broadcasts the block. Other nodes can check the answer instantly, even though finding it was hard. The winning miner receives the block reward, which consists of newly created coins plus transaction fees.
Difficulty
If more miners join, blocks would be found faster. To prevent that, the network adjusts the difficulty of the puzzle. On Bitcoin this happens about every 2,016 blocks, keeping the average block time near 10 minutes.
Strengths and criticisms of PoW
- Strengths: a long track record, simple and well-studied security model, and security tied to real-world resources that are hard to fake.
- Criticisms: high electricity consumption, and mining tends to concentrate where hardware and power are cheapest. Large mining pools also combine the work of many participants.
Proof of stake: validators
Proof of stake replaces computing power with economic commitment. Instead of buying machines and paying for electricity, participants lock up the network's own coins as a stake.
How validation works
Participants who stake coins become validators. The protocol selects validators to propose new blocks, and other validators check and vote on them, which are called attestations on Ethereum. Selection is random but weighted by stake. Validators who follow the rules receive rewards from the protocol and from fees.
Slashing
The key to proof of stake security is that misbehavior is punished. If a validator tries to cheat, for example by signing two conflicting blocks, the protocol can destroy part of its stake. This is called slashing. Validators that are simply offline may also lose small amounts. So an attacker would need to acquire a very large share of all staked coins and would risk losing them.
Ethereum as the main example
Ethereum launched in 2015 using proof of work. In September 2022 it switched to proof of stake in an upgrade called The Merge. To run a validator on its own, a participant stakes 32 ETH. People with less, or who do not want to run a server, often use staking services or pools, which adds trust in a third party and its own set of risks.
Strengths and criticisms of PoS
- Strengths: far lower energy use, no need for specialized hardware, and penalties that directly target attackers' funds.
- Criticisms: those who hold more coins have more influence, large staking providers may concentrate control, and the design is more complex and younger than proof of work.
Comparing the two
- Resource spent: electricity and hardware in PoW, locked coins in PoS
- Who produces blocks: miners in PoW, validators in PoS
- Punishment: wasted energy for a losing miner in PoW, slashing of stake in PoS
- Main examples: Bitcoin for PoW, Ethereum for PoS
A note on rewards
Both mining and staking come with rewards, but neither guarantees a profit. Mining income depends on hardware, electricity costs and competition. Staking rewards change with network conditions, and staked coins can lose value or be slashed. Staking through a third party also means trusting that service with your funds.
Key points
- Consensus mechanisms let independent computers agree on one shared history.
- Proof of work secures the chain with computing power; Bitcoin uses it.
- Proof of stake secures the chain with locked coins and penalties; Ethereum has used it since The Merge in 2022.
- Each approach has its own trade-offs in energy, decentralization and complexity.