BuildBot

Reading the Chain

What a blockchain actually is

Lesson 1 of 5

What you'll learn

  • Describe a blockchain as an append-only log linked by hashes, not as "magic internet money"
  • Explain why tampering with an old block is detectable by anyone with a copy
  • Place consensus, nodes, and "decentralised" on a spectrum instead of treating them as slogans

Forget prices for a moment. A blockchain is a data structure plus a protocol for agreeing on it. The data structure is almost boring: a list of blocks, each holding some entries (transactions) and a hash of the previous block. That one field, the prevHash, is the whole trick. A cryptographic hash is a fixed-size fingerprint of its input: change a single byte of the input and the fingerprint changes completely, and nobody can find two inputs with the same fingerprint. So block 3 commits to exactly the bytes of block 2, which commits to block 1, all the way back to block 0, the genesis block.

Now imagine you edit a transaction in block 2. Its hash changes. Block 3's prevHash no longer matches, so block 3 is invalid, and so is everything after it. To hide the edit you would have to rewrite every later block too, and you would have to do it faster than the rest of the network keeps adding new ones. That is the "immutability" people talk about. It is not that data cannot change. It is that changing it is loud.

block 0 (genesis)      block 1                   block 2
hash: 9f3a...          prevHash: 9f3a...         prevHash: 7c21...
                       hash: 7c21...             hash: e0b4...

Who writes the next block?

The hash chain makes history tamper-evident, but someone still has to decide which block comes next. That is consensus. Bitcoin uses proof of work: whoever burns the most electricity finding a lucky hash wins the right to append. Ethereum switched in 2022 to proof of stake: validators lock up 32 ETH as collateral, take turns proposing blocks, and lose their stake if they cheat. Either way, thousands of nodes each keep a full copy of the chain and independently verify every block. When people say the chain is "decentralised" they mean this: no single party can rewrite it or refuse your transaction, because the rules are enforced by everyone at once.

Decentralised is a spectrum, not a badge

A chain with three validators run by one company is technically a blockchain and practically a database with extra steps. Ethereum has roughly a million validators across thousands of operators. Always ask who runs the nodes before you trust the word.

Where the money comes from

The native coin (ETH on Ethereum) exists for one structural reason: you pay it to the network for every byte you store and every instruction you run, so nobody can spam the shared computer for free. Everything else, tokens, NFTs, DeFi, is software that runs on top of this log. You will read that software directly in lesson 5.

The challenge below builds the data structure with the browser's built-in SHA-256. Run it, then uncomment the tamper line and watch verification pinpoint the break.

Build a chain, then break it

Run it: three blocks link by hash and verify clean. Then uncomment the tamper line, run again, and read which block the verifier rejects and why.

Loading editor…
Knowledge check

Why is editing an old block detectable?

Next: keys, addresses and signatures, or how you prove you own something on a network with no login form.

Saved on this device. Sign in to sync your progress everywhere.