MASTERING-BITCOIN ยท Interactive Practice | Unit 12 ยท Video 1

The Unbreakable Chain: Why You Can't Rewrite Bitcoin's History

IKey Concepts Reference

Concept Definition Notes
Block Hash H=SHA2562(header)H = \text{SHA256}^2(\text{header}) Unique cryptographic identity of a block
prev_hash Field in header pointing to parent block's hash Creates the unbreakable chain link
Height Distance from genesis block (height 0) Tip is the highest block
Confirmation Depth Number of blocks stacked above a given block 6 = confirmed, 100 = coinbase mature
Reversal Probability P(reverse)โ‰ˆqkP(\text{reverse}) \approx q^k for kk blocks deep Decays exponentially with depth (when attacker has fraction q<0.5q < 0.5 of hashrate)

IIInteractive Visualization 1: The Cascade Effect

Conceptual question: If an attacker tampers with a block deep in the chain, how much work must they redo?

Use the slider to choose a block to tamper with. Watch how every block above it becomes invalid and must be recomputed.

โš™ interactive visualization โ€” coming to this page format soon

Reflect: Notice how tampering with a block deep in the chain forces the attacker to redo every block above it. The deeper the block, the more proof-of-work must be redone. This is why depth = security.

IIIInteractive Visualization 2: Probability of Reversal vs. Depth

Conceptual question: How quickly does the probability of reversing a transaction drop as more blocks are added on top?

Adjust the attacker's share of global hashrate. Even with significant computing power, the probability of reversal decays exponentially with depth.

โš™ interactive visualization โ€” coming to this page format soon

Notice: Even when an attacker controls 25% of global hashrate, the probability of reversing a 6-block-deep transaction is already astronomically small. At depth 100 (coinbase maturity), it's effectively zero. This is security by compounding cost, not impossibility.

IVInteractive Visualization 3: Forks and Orphaned Blocks

Conceptual question: What happens when two miners find a valid block at nearly the same time?

The chain temporarily splits into a fork. The branch that gets the next block first wins; the other becomes orphaned.

โš™ interactive visualization โ€” coming to this page format soon

Reflect: Forks aren't a bug โ€” they're a routine, self-healing feature of decentralized timing. The network always converges on the branch with the most accumulated proof-of-work.

VQuiz Questions

Question 1

Each block's header contains a prev_hash field. What does this field store?

โœ… Correct! Each block commits to its parent via the parent's hash.

โŒ Not quite. Remember: prev_hash points backward in time to the block that came before.

Show solution

Solution:

The prev_hash field stores the hash of the parent block's header.

This is what links each block to the one before it. Because a child's identity (its own hash) is computed from a header that includes its parent's hash, the child cryptographically commits to the parent. Change the parent by even one byte, and the parent's hash changes, which means the child's prev_hash no longer matches โ€” breaking the chain.

This is a cryptographic commitment, not a soft pointer.

Question 2

Suppose the Bitcoin chain is at height 800,000 (the tip). An attacker wants to alter a single transaction in the block at height 799,990. How many blocks must the attacker recompute to produce a valid chain ending at height 800,000?

โœ… Correct! The tampered block plus all 10 blocks above it must be recomputed.

โŒ Not quite. Don't forget โ€” the tampered block itself also needs a new valid proof-of-work, AND every block above it must be rebuilt to match the new chain of hashes.

Show solution

Solution:

The tampered block is at height 799,990. The tip is at 800,000. The blocks above the tampered block are at heights 799,991 through 800,000 โ€” that's 10 blocks.

The attacker must recompute:

  • The tampered block itself (1 block)
  • Every block above it (10 blocks)

That's 11 blocks total.

Why? Changing the tampered block changes its hash. The block at 799,991 stored the old hash in its prev_hash field โ€” that's now wrong. So the attacker must change 799,991's prev_hash, which changes its own hash, which breaks 799,992 โ€” and so on, all the way up to the tip. This is the cascade.

Question 3

A miner just earned a block reward (a coinbase transaction). How many additional blocks must be mined on top before they can spend those coins?

โœ… Correct! Coinbase outputs require 100 blocks of maturity before they can be spent.

โŒ Not quite. The 6-block rule is for normal transactions. Coinbase rewards have a stricter rule to protect against reorgs erasing newly minted coins.

Show solution

Solution:

Coinbase outputs are subject to the 100-block maturity rule: they cannot be spent until 100 additional blocks have been mined on top of the block that created them.

Why a stricter rule than the usual 6 confirmations?

  • 6 confirmations is the convention for normal transactions, used by exchanges and payment processors.
  • Coinbase outputs need extra protection because if a short-lived reorganization (reorg) replaced a recent block, any coins minted in that block would vanish โ€” along with anything spent from them. The 100-block buffer makes that scenario effectively impossible.

So: 6 confirmations = normal transaction acceptance, 100 blocks = coinbase maturity.

Question 4

True or False: Bitcoin's protocol makes it mathematically impossible to rewrite the blockchain. No matter how much computing power you have, you cannot alter old blocks.

โœ… Correct! Bitcoin's security is economic, not mathematical. Rewriting history is allowed in principle โ€” it's just astronomically expensive.

โŒ Not quite. Bitcoin doesn't outlaw rewriting history. Instead, it makes the cost grow exponentially with depth. Security comes from compounding cost, not impossibility.

Show solution

Solution:

The statement is False. Bitcoin's security is not based on mathematical impossibility โ€” it's based on compounding economic cost.

In principle:

  • A longer chain can always overwrite a shorter one (this is the "longest valid chain" rule).
  • Nothing in the protocol forbids rewriting history.

In practice:

  • Each block layered on top adds another slab of computational work.
  • The probability of reversal decays exponentially with depth.
  • After 6 blocks, you'd need a sustained majority of global hashrate.
  • After 100 blocks, you'd need to outrun roughly 17 hours of the world's hashing.

The key insight: Bitcoin replaces institutional trust with arithmetic. It's not a wall you can't climb โ€” it's a slope that gets steeper with every passing block, until rewriting the past costs more than the past is worth.

Solved: 0 / 4