What is a blockchain reorg?
Written by Alchemy
A blockchain reorg happens when the network replaces its most recent blocks with a different version of the chain. It happens when nodes briefly disagree about the newest block, and it matters because transactions your app already acted on can move or disappear.
- Causes: network delay, software bugs, outages and attacks.
- Consequences: reversed deposits, duplicate events, reordered transactions and stale data in your app.
Say your app credits a deposit. Ten seconds later, the block that held it is gone. If your app reads from a chain, it will run into a reorg eventually, and it needs to know what to do.
What is a blockchain reorg?
A reorg, short for chain reorganization, is when the network swaps its most recent blocks for a different set of blocks. The swapped-out blocks are dropped. Their transactions go back to waiting, and they may come back in a different block, in a different order, or not at all.
Put simply, a reorg is the chain changing its mind.
Think of it like two people writing the next page of a shared notebook at the same moment. Everyone keeps writing after whichever page they saw first. Once it's clear which version most people are building on, the other page gets torn out.
One- and two-block reorgs are normal, and most people never notice them. Deeper ones usually point to a bug, an outage or an attack.
Why do reorgs happen?
A reorg starts when the network briefly has two valid versions of its newest block. Nodes, the machines that each keep a copy of the chain, then have to settle on one. The split usually comes from one of four places:
- Network delay: two blocks are published at almost the same moment, and different nodes see them in a different order.
- Software bugs: nodes running different software versions disagree about which block to follow.
- Outages: when many nodes go offline, the ones still running can lose touch and build separate versions of the chain.
- Attacks: someone who controls enough block production replaces recent blocks to reverse a payment.
Deep reorgs are rare, but they do happen, even on large networks. In May 2022, Ethereum's proof-of-stake chain had a seven-block reorg because validators were running different versions of a software update and disagreed about which block to follow. In February 2023, Polygon's proof-of-stake chain had a 157-block reorg, which Polygon's co-founders attributed to a software bug.
How does a blockchain decide which version wins?
Every chain has a fixed rule for picking the winning version, called its fork choice rule. The version that wins is the canonical chain, the one apps and wallets treat as the real history.
Bitcoin uses proof of work, where miners spend computing power to add blocks. Its rule picks the version with the most total work behind it. People call this "the longest chain," which is close enough for Bitcoin.
Ethereum moved to proof of stake in 2022. Validators lock up ETH and vote on blocks, and the rule follows the version with the most validator votes behind it. A second step then marks blocks as final. Ethereum's docs call this combined design Gasper. For Ethereum today, "longest chain" is the wrong mental model.
What is finality?
Finality is the point after which a block can't be undone. Before it, a block is probably permanent. After it, the block is permanent for any practical purpose.
On Ethereum, a block becomes final once validators holding at least two-thirds of all staked ETH have voted for it at two checkpoints in a row. That takes two epochs, or about 13 minutes (an epoch is 32 slots of 12 seconds each). Reversing a finalized block would burn at least a third of all staked ETH through slashing, the penalty for validators who break the rules. The Ethereum proof-of-stake docs cover the details.
Bitcoin has no single finality moment. Every new block added on top of a transaction makes it harder to reverse, so services wait for a set number of these blocks, called confirmations. Six confirmations, about an hour, is the common rule of thumb. Bigger payments can wait longer.
On Ethereum, you don't need to count blocks yourself. You can ask a node for the latest safe or finalized block, which we cover below.
Most Ethereum reorgs are a single block. In the first months after the move to proof of stake, Jump Crypto's nodes saw about 90 reorgs, and none went deeper than one block.
Do reorgs work the same on L2s and Solana?
The same ideas apply on other chains. The details change.
Ethereum L2s such as Base, Optimism and Arbitrum post their blocks to Ethereum, so their finality depends on Ethereum's. Until a block's data reaches Ethereum, the L2's sequencer (the operator that orders its transactions) can still reorg it. On these chains, safe means the block's data is posted to Ethereum, and finalized means the Ethereum block holding that data is final. An L2 block is only as final as the Ethereum block behind it. The OP Stack and Arbitrum docs give each chain's timing.
Solana uses its own terms, called commitment levels: processed, confirmed and finalized. A processed block can still be rolled back. Since the Alpenglow upgrade went live on October 21, 2026, confirmed and finalized mean the same thing, and Solana targets finality in about 150 milliseconds. Point new code at finalized, since Solana plans to remove confirmed in a later release.
The detection steps and code below use Ethereum terms, and they work the same on other EVM chains.
What can a reorg break in your app?
A reorg changes data after your app has already acted on it. It shows up in five ways:
- Reversed deposits: a payment you credited disappears, and you have to take it back.
- Duplicate events: the same transaction shows up twice, once from the dropped block and once from its replacement.
- Changed order: transactions that survive can land in a new order, which can change who won a trade or an auction.
- Wrong data in your database: anything you saved from the dropped blocks stays wrong until you fix it.
- Confused users: a transaction that looked done goes back to pending.
Deep reorgs are also a security risk. If an attacker can rewrite enough blocks, they can take back a payment after you've delivered what they paid for.
How do you detect a reorg?
On Ethereum and other EVM chains, every block stores the hash, a unique ID, of the block that came before it. That link is how you spot a reorg. When a new block arrives, compare its parent hash with the hash you saved for the previous block. Also check whether you already saved a different block at the same height. If either one doesn't match, the chain you saved is no longer the real one.
When you find a mismatch, recovery takes three steps:
- Find the last shared block. Walk back one block at a time. At each height, fetch the block from the node and compare its hash with the one you saved. Stop when they match.
- Undo what came after it. Reverse any balances or records tied to the dropped blocks, and send corrections for any notifications they triggered.
- Reprocess the new blocks. Read the replacement blocks and apply them as if they were new.
The JavaScript below handles the first part. It catches both kinds of mismatch and drops what you saved from the point where the chain changed. A production indexer would keep walking back and then run steps 2 and 3.
// Keep recent blocks you have already processed, keyed by block number.
const seen = new Map();
function rollbackFrom(blockNumber) {
// Undo anything you saved at or above blockNumber.
for (const n of [...seen.keys()]) {
if (n >= blockNumber) seen.delete(n);
}
}
function handleNewBlock(block) {
const number = BigInt(block.number);
const saved = seen.get(number);
const parent = seen.get(number - 1n);
if (parent && parent.hash !== block.parentHash) {
// The block below this one was replaced too.
// A production indexer keeps walking back from here.
rollbackFrom(number - 1n);
} else if (saved && saved.hash !== block.hash) {
// A different block arrived at a height you already processed.
rollbackFrom(number);
}
seen.set(number, { hash: block.hash });
}
If you stream logs (the events your smart contracts emit) over a WebSocket, the node does part of this work for you. When a reorg happens, our logs subscription sends the logs from the dropped blocks again with removed set to true. It also sends the logs from the new blocks, so you may see the same transaction more than once. A log with removed set to false, or with no removed field, is on the canonical chain for now. A later reorg can still drop it until its block is finalized. Your app should undo whatever it did for any log marked removed.
How do you build apps that handle reorgs?
You can't stop reorgs, but you can make them harmless. Five habits cover most apps:
- Match the wait to the stakes. Credit a small payment after a block or two. Wait for finality before you release a large withdrawal.
- Ask the node for safer blocks. When you call
eth_getBlockByNumber, you can ask for thelatest,safeorfinalizedblock.latestis the newest block, and it can still be reorged.safetrails it by a few minutes and is unlikely to change.finalizedtrails it by about 13 minutes on Ethereum, and reverting it would burn at least a third of all staked ETH. On L2s these tags follow Ethereum's finality, and Solana uses its own commitment levels, as covered above. - Keep recent block hashes. Save the hashes of every block back to the last finalized one, so you can spot a change and roll back cleanly.
- Make your processing safe to run twice. Track what you've handled by transaction hash and log index, so nobody gets credited twice if a transaction is processed again.
- Show honest statuses. Labels like pending, confirmed and final tell users what to expect.
Here's a request for the latest finalized block on Ethereum mainnet:
curl --request POST \
--url https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockByNumber",
"params": ["finalized", false]
}'
The eth_getBlockByNumber reference and our logs subscription docs list every parameter and field.
What's the difference between a reorg and a fork?
A reorg is short-lived. The network briefly has two versions of the chain, settles on one and drops the other. A fork usually means a lasting change: either the network upgrades its rules, or the community splits into two chains that follow different rules. The competing blocks behind a reorg are sometimes called a temporary fork, which is why the two terms get mixed up.
How does Alchemy help you handle reorgs?
We flag reorgs for you, so your app doesn't have to find each one on its own. There are three ways to use this, depending on how your app reads the chain.
If your app keeps a live connection open, subscribe to logs over Alchemy Websockets. Logs from dropped blocks come back marked removed, as described above, and your app reverses whatever it did for them.
If your app runs on a server that receives events, use an Address Activity webhook. Token transfers from dropped blocks arrive again with log.removed set to true and the same ID as the original transfer, so you can match it to the record you stored and mark it reversed.
Before any action you can't undo, such as releasing funds, read the finalized block through Alchemy Node RPC. If the block holding the transaction isn't finalized yet, wait.
We run node infrastructure for 100+ chains. Create a free account to try Websockets, webhooks and Node RPC in your own app.
FAQ
What causes a blockchain reorg?
Most reorgs happen when two blocks are published at almost the same time and nodes see them in a different order. Longer reorgs usually come from software bugs, outages or attacks. Once the network settles on one version, the blocks from the other version are dropped.
How deep can a reorg be?
On Ethereum, most reorgs are a single block, and deeper ones are rare. Once a block is finalized, about 13 minutes after it's added, reversing it would burn at least a third of all staked ETH. Other chains vary. Polygon had a 157-block reorg in 2023.
Are reorgs the same as forks?
No. A reorg is short-lived: the network briefly has two versions of the chain and drops one. A fork usually means a lasting change, such as a rules upgrade or a split into two chains.
Can a reorg reverse my transaction?
Yes, until the block that holds it is final. Before then, the transaction can move to another block or drop out, and your wallet may show it as pending again. After finality, reversing it isn't practical.
How do I handle reorgs in my indexer?
Save each block's hash back to the last finalized block. When a new block's parent hash doesn't match, or a different block shows up at a height you've processed, walk back to the last block both versions share. Undo what you stored after it, then reprocess the replacement blocks. Key your records on transaction hash plus log index, so reprocessing never double-counts.
Do reorgs happen on every blockchain?
Any chain where nodes can briefly disagree about the newest block can have a reorg. How often they happen and how deep they go depend on how the chain reaches agreement, how fast it makes blocks and how healthy its network is. Chains that finalize blocks quickly, such as Solana since Alpenglow, make deep reorgs much harder.
Related Overviews
TechnicalJune 20, 2022
What is a WebSocket and how does it work
What They Are and How They Work in Web3
TechnicalOctober 29, 2026
What is a webhook?
A webhook is an event notification delivered as an HTTP POST. Learn how webhook URLs, payloads, retries, and signature verification work, with onchain examples.
InfraOctober 13, 2026
What is a blockchain indexer?
How a blockchain indexer reads blocks, survives reorgs, and when to build one versus call a managed API.

Build blockchain magic
Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.