← all posts

Blockchains, explained by brute force

An interactive explainer. Type into a real SHA-256 hash, then mine your own block in the browser. No crypto bros were harmed.

· 2 min read🌿 budding
📑 On this page

My final-year project was a blockchain voting app. Getting it working was the easy part. Explaining why it was tamper-proof to a room full of examiners was hard.

So here’s the explanation I wish I’d had: one you can poke.

Step 1: a fingerprint for any text

A hash function takes any input and returns a fixed-length “fingerprint”. Blockchains use one called SHA-256. Try it. Change a single letter below and watch the entire output change:

⛏ interactive · sha-256

Three properties make this useful:

  1. Same input, same hash. Always.
  2. Tiny change, totally different hash. Change “Force” to “force” and nothing matches.
  3. You can’t go backwards. Given a hash, there’s no shortcut to find the input. You can only guess.

Step 2: chain the fingerprints

A blockchain is a list of blocks where each block includes the hash of the block before it.

Edit an old block and its hash changes. That breaks the link in the next block, which changes its hash, and so on all the way down. Tampering with history means redoing every block after it.

Step 3: make redoing blocks expensive

This is where the brute force comes in. To add a block, the network demands a hash that starts with a certain number of zeros. Remember property 3: you can’t calculate your way there. You can only try inputs, over and over, until one works.

That’s mining. The button in the demo above does exactly this: it appends #0, #1, #2… to your text until the hash starts with 00. Two zeros takes a few hundred tries. Real Bitcoin needs around 19 zeros, which takes the whole planet’s mining hardware about ten minutes.

So rewriting history means out-brute-forcing everyone else, and catching up. Good luck.

The takeaway

Idea What it gives you
Hashing A tamper-evident fingerprint
Chaining Changing one block breaks every block after it
Proof of work Fixing the chain costs more than it’s worth

That’s it. A blockchain is just fingerprints, chained together, made expensive on purpose.

May Brute-Force be with you. ⚡