Each block contains the hash of the block before it, so the blocks are chained together.
Try this
Type something in the Data box of Block 2. Block 2 turns red – and so do blocks 3, 4 and 5. Why?
Mine block 2. It turns green, but block 3 is still red because it holds block 2’s old hash. Mine block 3, then 4, then 5 to repair the chain.
So how hard is it to quietly rewrite history? Count how many blocks you had to re-mine.
Puts everything back as it was.
Based on the blockchain demo by Anders Brownworth (source, MIT licence – see licence). Rebuilt here as a self-contained page; this copy runs entirely in your browser and sends nothing anywhere.