Capital · coordination · constructionCareers

Developer

How do you index on-chain events without missing or double-counting them?

The indexer’s hard problem is not throughput. It is that history can change under you.

The answer

Treat the chain as a stream that can rewind: track the last block you processed, process events idempotently keyed by transaction hash and log index, and handle reorganisations by reverting anything below your confirmation threshold rather than assuming what you read is final. An indexer that trusts the head of the chain will eventually record events that never happened.

The three failure modes to design against

Reorganisation: blocks you processed are replaced. Your confirmation threshold is the depth at which you treat a block as settled, and it is a policy number your risk tolerance sets — not a property of the chain.

Gaps: a provider outage or a restart skips a range. Persisted cursors and range-based backfill make this recoverable rather than invisible.

Duplicates: retries and overlapping ranges reprocess the same log. Keying on transaction hash plus log index makes reprocessing harmless.

The check that catches what monitoring misses

Periodically reconcile your indexed state against the chain directly for a sample of accounts. An indexer that has silently drifted looks perfectly healthy from the inside — every metric green, every log clean — until someone asks why a balance disagrees.

Talk to the practice

Tell us what you are trying to build and what has to be true for it to work.

Contact