Education › Blockchain › Stage 1: Foundations — how it works

Blocks, chains and consensus

How blocks link into a tamper-evident chain, and how a network agrees: proof of work versus proof of stake.

Beginner ~33 min read Module 3 of 16

You now know the two primitives — hashing and signatures. This lesson assembles them into the structure the technology is named after: the chain of blocks, and the mechanism that lets thousands of strangers agree on a single version of it. That agreement mechanism, consensus, is the real breakthrough. We will see how blocks link into a tamper-evident chain, why that alone isn't enough, and how proof of work and proof of stake solve the genuinely hard problem: getting a leaderless network to agree without trusting anyone.

After this module you can
  • Explain how blocks link together into a tamper-evident chain
  • State the core problem consensus solves: agreement without a central authority
  • Compare proof of work and proof of stake at a working level
  • Explain finality, forks, and why 'longer chain wins'

From blocks to a chain

A block is a bundle of transactions plus a small header. The header's key ingredient is the hash of the previous block. Because each block embeds the previous block's fingerprint, the blocks form an ordered chain reaching back to the very first one. This is what makes history tamper-evident: if someone alters a transaction in an old block, that block's hash changes, which no longer matches the 'previous hash' stored in the next block, which breaks the link — and so on for every block after it. To rewrite one old transaction you'd have to redo every block since. The chain of hashes turns 'edit one entry' into 'redo all of history,' which is the whole point.

text
block {
  height:     500
  prev_hash:  00a3...f19c     // fingerprint of block 499
  transactions: [ ...signed txs... ]
  timestamp:  1735689600
  nonce:      42817
  hash:       0091...b2d7     // this block's own fingerprint
}
// Block 501 will store prev_hash = 0091...b2d7.
// Change any tx here -> this hash changes -> the link to 501 breaks.

Why chaining isn't enough: the agreement problem

Linking blocks by hashes makes tampering *detectable*, but it does not, by itself, decide which chain everyone should follow. In a decentralised network, many participants might each propose the next block at the same moment. Without a central authority to pick the winner, how does a leaderless network of anonymous strangers — some of whom may be dishonest — agree on one shared history? This is the deep problem blockchains had to solve, and it is why the technology is genuinely novel. The mechanism that solves it is called consensus, and it must make honest agreement the easy, profitable path and cheating prohibitively expensive.

Note

Consensus is the real invention. Chaining blocks with hashes is simple. Getting a trustless, leaderless, global network to agree on one version of that chain — while resisting attackers — is the hard part, and it's what every consensus mechanism (proof of work, proof of stake) exists to do.

Proof of work: agreement by spending energy

Proof of work (PoW), used by Bitcoin, makes adding a block deliberately expensive. To propose a block, a participant (a miner) must find a special number, the nonce, such that hashing the block produces a hash below a target — many leading zeros, say. Because hashes are unpredictable, the only way to find such a nonce is to try billions of them, which costs real computing power and electricity. The first miner to find it broadcasts the block and, by the network's rules, earns a reward. Everyone else can *verify* the solution instantly by hashing once. So work is hard to produce but trivial to check.

This solves agreement because rewriting history would mean redoing all that work faster than the rest of the network combined — needing more than half the world's mining power, which is astronomically expensive. Honesty is cheaper than attacking. The costs, though, are real: PoW consumes a great deal of energy, which is the main criticism of Bitcoin and the reason many newer chains chose a different mechanism.

Proof of stake: agreement by putting money at risk

Proof of stake (PoS), which Ethereum now uses, replaces burned energy with money at risk. Instead of miners racing to solve puzzles, validators lock up a deposit of the chain's currency — their stake — for the right to propose and attest to blocks. The network picks validators to create blocks in a way weighted by their stake. The security comes from slashing: if a validator tries to cheat — proposing conflicting blocks or attesting to invalid ones — the network destroys part of their staked deposit. So attacking the chain means putting your own money on the line to lose it. PoS reaches the same goal — making honesty the profitable choice — without the enormous energy cost, which is why Ethereum switched to it.

AspectProof of WorkProof of Stake
Who proposes blocksMiners with computing powerValidators with staked coins
Cost of participatingHardware and electricityLocking up capital as stake
Cost of cheatingOut-compute the whole networkLose your staked deposit (slashing)
Energy useVery highVery low
Used byBitcoinEthereum (since 2022)

Forks, finality and 'longest chain wins'

Occasionally two valid blocks appear at nearly the same time and the chain temporarily forks into two branches. The network resolves this with a rule for which branch is canonical — classically, the chain with the most accumulated work (loosely, the 'longest chain') wins, and the other branch's block is orphaned. This is why a transaction becomes more trustworthy as blocks pile on top of it: reversing it would mean out-building all those blocks. In Bitcoin, waiting for several confirmations (blocks added after yours) is how you gain confidence. Proof-of-stake systems like Ethereum add explicit finality: after a couple of blocks are attested by validators, they are treated as irreversible, so you don't wait as long.

Tip

Practical takeaway: a transaction isn't truly settled the instant it appears in a block — it settles as blocks build on top (confirmations) or as validators finalise it. For anything valuable, wait for the confirmations or finality your chain recommends before treating a payment as done.

Hands-on practice

Trace how a chain resists tampering

  1. Draw three blocks in a row, each storing the previous block's hash, and label the links.
  2. Show what happens to the hashes and links if you change a transaction in the first block.
  3. Explain why an attacker would have to redo every block after the one they altered.
  4. Compare, in your own words, how proof of work and proof of stake each make cheating too costly.
  5. Describe why waiting for confirmations (or finality) makes a payment safer to rely on.
Cheat sheet

Blocks, chains and consensus — at a glance

Main things to focus on

  • Each block stores the previous block's hash, chaining them so tampering breaks the links.
  • Chaining makes tampering detectable; consensus decides which chain everyone follows.
  • Proof of work: find a costly nonce; security from out-working the network being infeasible.
  • Proof of stake: validators risk a staked deposit; cheating gets it slashed.
  • Forks resolve by a canonical-chain rule; the heaviest/longest chain wins.
  • A transaction settles as confirmations build on it or validators finalise it.

The chain

blocka bundle of transactions plus a header
prev_hashthe previous block's fingerprint in the header
tamper-evidentchanging a block breaks every link after it
noncethe number miners search for in PoW

Proof of work

minersearches for a valid nonce
hard to makebillions of tries cost energy
easy to verifyone hash checks the solution
51% costcheating needs most of the network's power

Proof of stake

validatorproposes/attests blocks
stakea locked deposit of the currency
slashingcheating destroys part of the stake
low energyno puzzle-solving race

Settlement

forktwo valid blocks at once, briefly
longest chainthe canonical branch wins
confirmationa block added on top of yours
finalityvalidators mark blocks irreversible

Common pitfalls

  • Thinking hash-chaining alone decides which chain is canonical — consensus does that.
  • Believing a transaction is fully settled the instant it lands in a block.
  • Assuming proof of work and proof of stake differ only in energy — the cost of cheating differs too.
  • Confusing a miner (proof of work) with a validator (proof of stake).
  • Ignoring recommended confirmations or finality before treating a payment as final.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →