ELI12 crypto - part 4

The blockchain

Looking back, in part 3 we talked about how a block is verified without really saying what it is.

A block is basically a container for us to put transactions into. We’ll collect up some number of transactions (e.g. Alice pays Bob $10, Dave pays Susan $44, etc.), wrap them together into a block, verify them (part 3), and then broadcast that block to the world.

Different blockchains have different ideas about block sizes and frequency. Without getting into too much detail, each block on Bitcoin can contain between 2MB and 4MB of transactions, while Ethereum is averaging around 45KB or so. For frequency, Bitcoin strives to create a new block every 10 minutes or so, while Ethereum is pumping out new blocks every ~13 seconds.

But the key part — the element that makes the “chain” in “blockchain” — is that each new block stores the hash of the previous block. In this way, it’s not possible to modify the older blocks, because then the hashes stored in the newer blocks wouldn’t match. Remember, changing a single character in a block makes the hash different.

For this idea to sink in, let’s visit the simple blockchain simulator. Here you’ll see five empty blocks, all green. (If they’re not green, click Mine on each of them left-to-right). Scroll over to block 5.

Notice we now have a Prev field that we didn’t in Part 3. Look at block 4’s hash. Block 4’s hash and block 5’s previous hash should match. They’re “chained” in that you can’t change block 4 without it affecting block 5, since if you did the hashes would no longer match. It’s this continuous chain of blocks referencing the previous block that make a blockchain.

In block 4, go ahead and enter a transaction:

Block 4 and 5 are red now, as the hash doesn’t start with the ‘0000’ we’re looking for. Hit Mine for blocks 4 and 5 to green everything up again.

Remember, these transactions represent a real transfer of value, so it’s imperative that blocks cannot be changed (immutable) or else it’d be possible to rewrite history. Pretend you’re Bob, and try changing the 10.00 to 1000.00. Block 4 becomes invalid, as well as all the blocks after 4. This change will be rejected by the network.

As of today, the Bitcoin blockchain has created 673,441 blocks, an unbroken chain of blocks referring to the hash of the previous block all the way back to #1 (genesis) in 2009.

I’ll likely do one more crypto newsletter answering some frequently asked questions, and then take a break from crypto writing for a bit. So if you’re not interested in all this cryptocurrency stuff, hang in there. :)