Blockchains and Consensus
A blockchain is a shared ledger that thousands of strangers keep identical copies of, with no one in charge. The hard part is not storing the data, it is agreeing on the order of it, and that is what consensus rules buy.
Every payment system in history has had a referee. When you send money, your bank debits one row and credits another, and the reason nobody argues is that the bank's copy of the ledger is the copy that counts. Take the referee away and an awkward problem appears immediately: if I hold a digital coin, I can copy the message that spends it and send it to two different people at the same instant. Both look perfectly valid. Which one happened first? Nobody can say, because there is no "first" without someone whose clock everyone trusts.
Picture a village with no bank, just a notebook nailed to a post in the square, and everyone keeps their own copy of it. Copying is easy. The trouble starts when two people scribble a line at the same moment and the copies diverge. What the village needs is not better paper, it is a rule that everyone can apply on their own and still land on the same answer about which page came next. That rule is consensus, and a blockchain is the ledger format built to make it work.
Blockchains solve ordering, not storage. Any database can hold balances. The achievement is getting mutually suspicious strangers to agree on the sequence of transactions without trusting a referee.
Blocks, and why they are chained
Transactions are gathered into blocks, roughly a page of the notebook. Each block carries a hash of the block before it, a short fingerprint computed from that block's entire contents. Change one character anywhere in an old block and its fingerprint changes completely, so the pointer stored in the next block no longer matches, and the mismatch cascades all the way to the tip.
That is the whole trick behind the word "immutable". Nothing physically stops you from editing an old page. It is that editing it invalidates every page after it, so anyone can check the chain in seconds and see the forgery. Hashing, Merkle Trees and Block Headers covers how the fingerprints are built.
Consensus: making the right to write expensive
Chaining stops silent edits, but it does not decide who gets to add the next page. If writing were free, an attacker would simply spin up a million fake identities and outvote everyone. So every workable design makes writing costly in a way that cannot be faked.
Proof of work makes it cost electricity. Miners race to find a number that, hashed together with their block, produces a fingerprint below a target. There is no shortcut; you guess trillions of times a second. Whoever wins publishes the block and collects a reward, and the network follows whichever chain has the most accumulated work behind it. Proof of stake makes it cost capital instead. Validators lock up coins as a bond, are chosen to propose blocks in proportion to that stake, and lose part of the bond if they sign contradictory histories. See Proof of Stake and Staking Yields.
Worked example: why six confirmations
Suppose an attacker controls a fraction of the hash power, with the honest network on . They want to reverse a payment buried blocks deep, which means secretly building a longer chain from behind. This is exactly a Gambler's Ruin race, and the chance of ever catching up from blocks behind is
With that is , about a chance. Drop the attacker to of hash power and it becomes , roughly two in a million. This is where the exchange convention of waiting six confirmations comes from: settlement is never absolutely final, it is a probability that improves geometrically with depth.
Worked example: a miner's expected income
Bitcoin targets one block every ten minutes, so blocks a day. A miner running of global hash power expects blocks a day. At a block reward of coins that is coins a day on average. But block discovery is a The Poisson Process, so the realised count is wildly lumpy: this miner will go multi-day stretches finding nothing. That variance, not the average, is the entire reason mining pools exist.
What this means in practice
For anyone trading digital assets, consensus is a settlement-risk parameter. Confirmation depth sets how long a deposit is held before it is credited, and it differs by chain because block times and security budgets differ. Reorgs are ordinary events near the tip, not exotic failures. And the throughput ceiling that follows from every node re-verifying every block is what drives fees during congestion and what rollups exist to relieve.
"Immutable" means expensive to change, not impossible. Security is a budget: rewrite an old block and you must out-spend the honest network. Chains with small hash rates or concentrated stake have been reorganised for real money. Equally, "decentralised" is a spectrum, not a badge, and many chains depend on a handful of mining pools, validators or sequencers.
Key terms
- Block — a batch of transactions plus a header containing the previous block's hash.
- Hash — a fixed-length fingerprint of data; any change to the input changes it entirely.
- Consensus rule — the shared rule for picking the canonical chain, usually most accumulated work or stake.
- Fork / reorg — two competing tips, and the switch when one branch overtakes the other.
- Confirmations — blocks built on top of yours; depth is what makes settlement effectively final.
Related concepts
Practice in interviews
Further reading
- Nakamoto (2008), Bitcoin: A Peer-to-Peer Electronic Cash System
- Narayanan et al., Bitcoin and Cryptocurrency Technologies (Ch. 2, 5)
- Buterin, Ethereum Whitepaper and the Casper FFG papers