Skip to content
CryptoAcademy logo CryptoAcademy
Menu
Lesson Beginner · 12 min

Why blockchains are hard to change

Immutability is not magic — it is hash functions plus economics. Change a byte in an old block and you must rebuild everything above it, faster than the rest of the network extends the real chain.

In this lesson

  • Trace how one edit invalidates every later block
  • Explain confirmations as accumulated work
  • Give an example of a successful deep reorganisation

One edit, total breakage

Each block stores its parent's hash. Edit an old transaction and the old block's Merkle root changes, so its hash changes, so the next block's previous_hash no longer matches — and the mismatch cascades to the tip in seconds. Honest nodes reject your branch instantly.

The integrity cascade
Blocks are linked by hashes; editing one block breaks every link after it Block n-1 hash 9c1a…f4 valid Block n hash 0007…b2 edited by an attacker Block n+1 hash 41de…09 valid Block n+2 hash 77b0…aa valid prev hash ✗ attacker edits a value → block hash changes The integrity cascade 1. Editing a transaction in block n changes its Merkle root → changes the header hash. 2. Block n+1 stores the old hash → the link is broken and the chain from n+1 on is invalid. 3. To stay valid the attacker must re-mine every later block — faster than the network grows them.
Changing the middle block changes its hash — every link after it is now broken.

Example · Rewriting six confirmations

Suppose your transaction sits six blocks deep. To reverse it, an attacker must re-mine those six blocks and outpace the entire network doing it — while other miners keep extending the honest chain. Six confirmations ≈ re-doing days of global computation. That is why exchanges wait.

verify_chain.py python
def is_valid(chain):\n    for prev, block in zip(chain, chain[1:]):\n        if block["previous_hash"] != hash_block(prev):\n            return False              # someone edited the past\n        if not meets_target(block):\n            return False              # block was not properly mined\n    return True

Immutability is probabilistic

"Final" means "irreversibly expensive", not "mathematically impossible". Deep reorganisations have happened on small chains during attacks or bugs — which is exactly why confirmation depth is a policy choice, not a constant.

Tamper with history

Mine a chain, edit block 2 in the lab, and watch validation fail at exactly the block you touched.

Try it yourself

What happens to the Merkle root?

Practice · server-graded
  • An attacker edits an old transaction in a confirmed block. What happens to the Merkle root?

    1 pt
Why not just store the whole chain encrypted?

Public verifiability is the feature. The chain stays auditable; privacy comes from addresses, mixers or zero-knowledge proofs at the application layer.

Does pruning change this?

Nodes can discard old block bodies and keep headers — the hash links still chain, and any lie about the past is still detectable.

Share this page

Send this link to a friend, or scan the QR code to open it on your phone.