Quant Memo
Foundational

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.

each block seals the one before it longest chain wins #101 #102 #103 #104 #104b abandoned fork
Every arrow is a hash of the block it points back to, so rewriting block 101 breaks 102, 103 and 104 in turn. When two blocks appear at once, nodes follow whichever branch accumulates more work and quietly discard the other.

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 q=0.3q = 0.3 of the hash power, with the honest network on p=0.7p = 0.7. They want to reverse a payment buried zz 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 zz blocks behind is

(qp)z.\left(\frac{q}{p}\right)^{z}.

With z=6z = 6 that is (3/7)6=0.0062(3/7)^6 = 0.0062, about a 0.6%0.6\% chance. Drop the attacker to 10%10\% of hash power and it becomes (1/9)6(1/9)^6, 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 144144 blocks a day. A miner running 1%1\% of global hash power expects 0.01×144=1.440.01 \times 144 = 1.44 blocks a day. At a block reward of 3.1253.125 coins that is 4.54.5 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
ShareTwitterLinkedIn