Blockchain demo

A blockchain is a chain of blocks, each holding some data and a hash of the block before it. This page lets you build one by hand, entirely in your browser — nothing you type here is ever sent anywhere. Hashing the text “Hello, blockchain!” with SHA-256, the algorithm Bitcoin uses, always produces exactly this:

e485541186cd67682999c1ad80eac78fb803ec57885c26d5489efb01f15ae913

Change one letter and you’d get a completely different, unpredictable result — try it yourself on the Hash tab below. Work through the five-step walkthrough to see hashing become blocks, blocks become a chain, and what happens when someone tries to tamper with one.

Guided walkthrough
  1. Type anything on the Hash tab and watch the SHA-256 output change instantly.
  2. Click Mine on the Block tab — it searches for a nonce that makes the hash start with enough zeros.
  3. On the Blockchain tab, mine all three blocks until the whole chain shows valid.
  4. Edit an early block's data and watch it — and everything after it — turn invalid.
  5. Re-mine the tampered block and the ones after it until the chain is valid again.
Difficulty
idleNo hash yetType something above to see its SHA-256 hash.

Questions

What is a hash?

A hash is a fixed-length fingerprint of data, produced by a one-way function — SHA-256, the algorithm Bitcoin uses, always outputs 64 hex characters (256 bits) no matter how much or how little you feed it, and the same input always produces the same output. Changing even one character of the input produces a completely different hash, with no way to predict how.

What is a nonce?

A nonce ("number used once") is a value miners change and re-hash over and over, searching for one that happens to produce a hash meeting a target — in this demo and in Bitcoin, a hash that starts with enough zeros. There's no shortcut: the only way to find one is to keep trying different nonces, which is exactly what the Mine button does.

Why does changing one block break every block after it?

Each block stores the previous block's hash. Edit any field in a block and its own hash changes immediately — but the next block's stored copy of the old hash doesn't update itself, so it no longer matches. That mismatch is what makes the chain show invalid from that point forward, and it's why altering old blockchain history would mean re-mining everything after the change.

Is this real Bitcoin mining?

It's the same core mechanism — SHA-256, a nonce search, a difficulty target — running in your browser instead of on dedicated ASIC hardware. Real Bitcoin difficulty requires roughly 19 leading zero bits today, found across the whole network in about 10 minutes; this demo's difficulty tops out far lower so a browser can find a result in a few seconds.

The same search you just ran by hand on the Block tab is what a real miner does billions of times a second. See the numbers behind that on the profitability calculator, or your own odds of finding a block first on the solo odds calculator.

Based on the Blockchain Demo by Anders Brownworth, MIT License — see this repo’s NOTICE file for the full license text. No code from the original project is reused; this is an independent reimplementation of the same teaching concepts.