DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › blockchain data

How to Verify an Indexer Can Recover from a Chain Reorganization

By Freedom251 Team · · 6 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An indexer has recovered from a chain reorganization only when three things are true: its stored data follows the replacement branch, the effects of the discarded branch are gone from every table and aggregate, and the indexed height is advancing again. A restart, matching block heights, or a reassuring log line proves none of these on its own. The steps below show how to test each part against the chain source.

The exact checks depend on the indexer, the chain, and the rollback design, so the thresholds and file names here are examples to adapt rather than a universal standard. Ethereum.org defines the event this way: “A ‘reorg’ is a reshuffling of blocks into a new order, perhaps with some addition or subtraction of blocks in the canonical chain” (Ethereum.org, proof-of-stake attack and defense).

As an Amazon Associate I earn from qualifying purchases.

Why block hashes, not heights, decide recovery

Two competing blocks can share the same height, so an indexer that compares only height cannot tell whether it is still on the canonical chain. Nethereum’s processing documentation describes the correct key: the indexer stores the last known canonical block number and hash, then compares that hash with the RPC node. A differing hash is what triggers reorg handling (Nethereum, BlockchainProcessing).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When you audit an indexer, confirm that its detection logic uses the hash and, ideally, the parent-hash chain between the stored tip and the node. If the only check is “is my height less than the node’s height,” the indexer will miss a same-height replacement entirely.

Verification sequence

1. Record a known-good checkpoint

Persist, at minimum, the block number and hash at the indexed tip. For ancestry lookups, keep enough indexed block metadata (hashes of recent blocks, or parent hashes) to walk backwards to a common ancestor. Nethereum’s documented ChainState stores the last known canonical block number and hash, which is the same minimum described above. Take a note of this checkpoint before you induce or wait for a reorg, because it is the baseline for every later comparison.

2. Compare stored hashes with the chain source

Fetch the same block numbers from the node or RPC provider you trust and compare hashes. Do this for the tip and for a few blocks below it. Under a healthy indexer, the stored hashes match the source during normal operation. After a reorg, the first mismatch marks the boundary where the stored branch diverges.

3. Confirm the rewind point

The recovery process should rewind to the most recent shared ancestor, or to an earlier point that it can safely replay. Nethereum’s example reports a rewind point once the stored hash differs from the RPC node. Verify the rewind point yourself by checking that the block at that height has the same hash in both the indexer and the source, and that the block above it does not.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Inspect how the old branch is removed

Old-branch data must be invalidated, deleted, or discarded, and every derived table and aggregate must follow the same boundary. A leftover row in a summary table is a common failure that a tip-only check will not catch. The approaches differ, as the table below shows.

Rollback approach How discarded data is handled Documented example What to verify
Non-canonical flags Affected rows are marked non-canonical and kept; reads must filter them out Nethereum’s processing guide (Blockchain Processing Pipeline) Every query and derived table excludes non-canonical rows; no aggregate counts them
Deletion and re-indexing Rows from the rollback range are deleted, then the range is indexed again XChain’s decoder/indexer, which uses a MariaDB-backed store (XChain Developers, Reorg Handling) No orphaned rows remain after the rollback completes; row counts match a clean re-index
Configured undo window Changes are reversed only within a configured depth XChain’s UTXO tracker (same XChain page) Reorgs deeper than the window are detected and handled as a failure, not silently applied
Discardable state layers Later layers are discarded back to the common ancestor, then the new branch is replayed EIP-8347, a draft proposal (Ethereum Improvement Proposals, EIP-8347) Applies only to the proposal’s model; it states that rollback “MUST be performed by discarding state, never by reversing writes”

5. Confirm the replacement branch is replayed

After rewinding, observe processing resume from the rewind point. Then verify that the indexed hashes now follow the selected canonical branch: compare the new tip and a sample of blocks from the replayed range with the source. Two details matter. First, the replayed blocks must be the ones on the new canonical chain, not the discarded ones that were just removed. Second, the replay must not double-apply events that were already in the shared ancestor.

6. Check invariants and progress

Run the implementation’s own sanity or consistency checks after the replay. XChain’s documentation states that “After a reorg, the indexer automatically runs its sanity check” (XChain Developers, Reorg Handling). Treat that automatic check as a starting point. Where the data model allows it, reconcile derived state against the chain itself. For example, recompute a token balance for a sample address from the replayed transfer events and compare it with the indexed balance. Finally, confirm that the indexed height advances over several new blocks; a stalled height after a reorg is a sign that replay did not complete.

7. Observe what clients see during rollback

If the indexer serves queries while it rolls back, decide whether it can briefly expose discarded-branch results. XChain’s documentation warns that temporary inconsistencies can occur during its rollback and re-indexing. Where your application cannot tolerate that, gate reads on indexed height, or return a “catching up” status until the post-replay checks pass. Document the behavior so that client code knows how to interpret it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

8. Test the depth the system claims to support

Use a controlled fork or test environment to trigger reorganizations at several depths: a shallow one inside the buffer, one at its edge, and one beyond it. Confirm that the shallow case recovers fully, that the edge case behaves as documented, and that the deep case fails visibly rather than corrupting output. The sources reviewed for this article do not define a universal fault-injection test plan, so treat this sequence as a practical test design, not a formal certification procedure.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How buffers and undo depth are set

The depth an indexer can recover from comes from its design, not from a single chain-wide number. The documented values below are examples from specific implementations, and none should be copied as a recommendation for another system.

Mechanism Documented value Source and date Scope
Nethereum reorg buffer 12 blocks, used as an example Nethereum processing guide, undated, accessed 2026 Illustrates a reprocessing window on restart; it is not a confirmation-depth recommendation for any chain or application
Ethereum full-node recent state cache 128 blocks, used as an example Ethereum.org archive-node documentation, undated, accessed 2026 Describes node state retention; it is not an indexer buffer setting
XChain decoder/indexer Unlimited rollback depth XChain Developers, Reorg Handling Applies to its MariaDB-backed service as the vendor describes it
XChain UTXO tracker Configured undo window XChain Developers, Reorg Handling The value is set by the operator; the page does not state a default

Older Ethereum states that fall outside a node’s cache can be regenerated by replaying transactions, but that replay can require substantial computation. An indexer that depends on replay for deep recovery should measure how long that takes on its own hardware before promising a recovery time.

Chain and finality assumptions to state

Every recovery claim depends on what the chain considers final. Ethereum’s consensus documentation discusses reorgs and finalized history, which means a reorg below the finalized checkpoint should not happen under the protocol’s assumptions, while depth above it can be a live question. Bitcoin-family examples, such as XChain’s, do not automatically transfer to Ethereum or other networks, and vendor-specific limits should not be generalized. In any write-up or runbook, name the chain, its finality rule, the indexer version, and the rollback strategy together, so that a reader can tell which of the checks above apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reporting the result

A verification record is useful only if it states what was tested. Record the chain and network, the indexer version and configuration (including any buffer or undo window), the depth of the reorg that was triggered, the rewind point found, the replay range, and the outcome of each post-replay check. Keep the controlled-fork results separate from production observations so that a passing test is not mistaken for proof about live data.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

blockchain datablockchain indexerchain reorganizationEthereumNethereumreorg recoveryrollback

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.