Sub topic 3
How Networks Agree: Proof of Work and Proof of Stake
This chapter assumes you understand hashes, public and private keys, and the basic idea of a blockchain as a replicated ledger. The focus here is how a network chooses valid blocks when participants do not fully trust one another.
Why consensus is necessary
A blockchain has many copies. Each copy must agree on the order of transactions and reject conflicting transactions. This agreement is called consensus.
Consensus must solve two problems:
- Sybil resistance: stopping one person from creating thousands of fake identities to gain control.
- Chain selection: deciding which valid history to follow when two blocks appear at nearly the same time.
Proof of work and proof of stake solve these problems with different scarce resources.
Proof of work
In proof of work, a miner gathers transactions into a candidate block and repeatedly changes a small value called a nonce. Each attempt hashes the block header. The miner succeeds when the resulting hash is below the network's target.
Because hashes are unpredictable, the practical way to find a valid result is to try many possibilities. The network adjusts the target so blocks arrive at a roughly predictable rate.
Other nodes can verify a solution quickly. They do not need to repeat the miner's work. When competing histories exist, nodes generally follow the valid chain with the greatest accumulated work, sometimes described informally as the longest chain.
A successful attack requires controlling enough mining capacity to produce blocks faster than honest miners. This is often called a 51% attack. It does not let an attacker create coins from nothing or spend another user's coins without keys, but it can enable transaction censorship and reversal of the attacker's recent payments.
Proof of work provides strong, open participation, but it consumes substantial electricity and favors access to specialized hardware, cheap energy, and large mining operations.
Proof of stake
In proof of stake, validators lock the network's native asset as collateral. The protocol chooses validators to propose blocks and other validators to check, or attest to, those blocks. Selection usually uses pseudorandomness and stake-weighted rules, although exact designs differ.
A validator that signs conflicting histories or breaks protocol rules can lose some of its locked stake. This penalty is called slashing. Honest validators earn rewards or fees for useful participation, while offline validators may lose rewards or face smaller penalties.
Instead of buying electricity and hardware, an attacker must acquire and control a large amount of the asset. That makes an attack financially expensive and exposes the attacker to losses if the asset's price falls or the protocol punishes the behavior.
Proof-of-stake systems need defenses against problems such as validators signing multiple competing chains, old private keys being used to create an alternative history, and stake becoming concentrated among exchanges or large providers. Checkpoints, withdrawal delays, slashing rules, and special finality mechanisms address these risks. They reduce some attack paths but add protocol complexity and governance decisions.
Comparing the mechanisms
| Criterion | Proof of work | Proof of stake |
|---|---|---|
| Scarce resource | Computation and electricity | Locked economic stake |
| Block producer | Miner | Validator |
| Main penalty | Lost operating costs | Lost stake or rewards |
| Energy use | Generally high | Generally lower |
| Main concentration risk | Mining pools and hardware access | Large holders and staking providers |
Neither mechanism proves that a cryptocurrency is safe or valuable. Consensus protects a particular ledger under assumptions about participants, network communication, and economic incentives. You must still examine the software, governance, custody model, and distribution of control.
Exercise
A proof-of-stake validator signs two conflicting blocks to support two histories. What protocol feature can punish this behavior, and what is the punishment called?
Show answer
The protocol can identify the conflicting signatures and destroy part of the validator's locked collateral. This punishment is called slashing.