⏪ Chain Reorganization: Rewriting Recent History

See how the network replaces a shorter chain with a longer, valid one

🔄 Chain Reorganization

A chain reorganization (or "reorg") happens when your node switches from one version of blockchain history to another. Let's understand when and why this occurs!

🎯 What is a Reorg?

Imagine you're following Chain A, believing it's the main blockchain. Suddenly, Chain B appears with more accumulated work. Your node must "reorganize" - abandoning Chain A and switching to Chain B.

During a Reorg:
Blocks Removed: Blocks from Chain A are "rolled back" and marked as orphaned
New Blocks Added: Chain B's blocks become the new canonical history
Transactions Reprocessed: Transactions from orphaned blocks return to mempool
State Recalculated: Account balances and contract states are recomputed

🎮 Interactive Reorg Simulator

Adjust the reorganization depth and watch what happens:

← Deeper = More Severe
1 block3 blocks6 blocks
Blockchain State:
#1
#2
#3
#4
#5
#6
#7
#8
#9
#10
#11
#12
#13
#14
#15
💡 What You're Seeing:

Block #10 is the fork point. Chain A continued but Chain B (with reorg depth of 3) had more accumulated work, causing blocks 11-13 to be orphaned and replaced.

⚠️ Reorg Depth & Safety

The deeper the reorganization, the more risky it becomes. This is why services wait for multiple confirmations!

1 Confirmation
High Risk

Very unsafe - reorgs common

3 Confirmations
Medium Risk

Moderate safety - exchanges wait

6 Confirmations
Low Risk

Bitcoin standard for transactions

12 Confirmations
Very Low Risk

High confidence threshold

🚨 Real-World Impact:
Exchanges: Typically require 6+ confirmations for deposits (1 hour on Bitcoin)
Coffee Shop: Might accept 0-1 confirmation (fast but risky)
Large Transfers: Wait 12+ confirmations (2+ hours) for high security

🔍 Anatomy of a Reorg

1
Fork Detected

Your node receives blocks from a competing chain. Initially ignores them if they're shorter.

2
Work Comparison

Node calculates accumulated proof-of-work. Competing chain now has MORE total work than current chain.

3
Reorganization Begins

Node disconnects current tip blocks back to fork point. These blocks become "orphaned" or "stale."

4
New Chain Applied

Competing chain's blocks are validated and connected. Transactions from orphaned blocks return to mempool.

5
State Synchronized

Account balances, UTXO set, and smart contract states are recalculated based on new history.

💡 Key Insights

⏱️
Reorgs Are Normal

1-2 block reorgs happen regularly. They're a natural part of distributed consensus, not a security failure.

🎯
Deep Reorgs Are Rare

6+ block reorgs are extremely unusual and could indicate an attack or serious network issues.

💰
Wait for Confirmations

The more valuable the transaction, the more confirmations you should wait for before considering it final.

🔍
Monitor Reorg Depth

Block explorers show reorg events. Services monitor these to detect potential network issues or attacks.