← BLOG
November 24, 2026blockchainenterprise3 min readITENHR

Writing to the chain is easy. Reading it back is not

A system built on a blockchain depends on how it reads on-chain events back. Reorgs, idempotency, indexing gaps and the RPC provider deserve the same design effort as the smart contract.

Diagram of the read path: RPC node, indexer and database in sequence, with four labels underneath: reorgs, idempotency, gaps and provider.

Teams that build on a blockchain put almost all their attention on the write path: the smart contract, the signature, the fee, the confirmation. But the rest of the system, the ERP, the portal, the accounting, needs to know what happened on-chain. That read path is almost always the least designed part of the project.

The loop that becomes the source of truth

The typical version is a service that polls an RPC node at intervals, reads the events emitted by the contract and inserts them into a table. It works in development, it works in the demo. Then the application starts reading from that table: balances, order states, notifications, reports. From that moment the source of truth for your users is no longer the chain. It is your copy of the chain, written by a loop nobody ever treated as a critical component.

The chain guarantees that a finalized transaction will not change. It guarantees nothing about your copy. If an event is missing, duplicated or reverted by a reorg, the user sees a wrong value that looks like a certain one.

Four things the indexer has to handle

Reorgs. Before it is final, a block can be replaced by another one, and the events it contained disappear or come back in a different order. Store the block number and block hash with every event. Distinguish a seen event from a final one according to the finality rule of the chain you use, not a confirmation count picked by feel. When the hash of a block you already read no longer matches, walk back to the common ancestor and re-read.

Idempotency. The same event will arrive more than once: after a restart, after a timeout, after a reorg. The natural key is the transaction hash plus the log index within the transaction. An internal counter or the arrival time identifies nothing. With a unique constraint on that key, the second write becomes harmless.

Gaps. The service stops for a deploy, the node returns an error on a block range, a page of results is truncated by the provider's limits. If the indexer restarts from the current block, that range is lost silently. You need a persistent checkpoint of the last block processed successfully, a backfill job that re-reads from it, and a check that reports gaps instead of hiding them.

The provider. Your RPC node is a production dependency like a database or a queue: it has rate limits, outages and sometimes lagging data. Treat it like any external service, with explicit timeouts, retries with backoff, metrics and alerts. And compare it periodically with a second, independent source, at least for the balances and states that matter.

What this means for a delivery

The indexer is not glue code. It belongs in the project scope with its own tests: a simulated reorg, a duplicated event, a skipped range. It belongs in the runbook, with an owner and a procedure to rebuild the copy from scratch. And it belongs in the estimate, because it is real work, often more than the contract itself.

The chain is final. Your copy of it is not, until you design it to be.

Who in your team owns the indexer?