For the complete documentation index, see llms.txt. This page is also available as Markdown.

Build a Local Indexer

Build a restartable read model from finalized XL1 blocks.

A reliable indexer is a finalized-block stream plus a durable checkpoint and an idempotent projection.

1

Choose a checkpoint

Store the hash of the last block your indexer completed. A block number alone is not enough to verify continuity.

2

Follow finalized blocks

Use finalizedBlockStreamFromGateway from @xyo-network/xl1-sdk. Do not poll raw RPC endpoints or index unfinalized state as final.

3

Validate application payloads

Treat block and transaction envelopes as chain-validated, but validate dereferenced application payload bodies against your public schema before projecting them.

4

Write idempotently

Key projection records by stable chain evidence, such as transaction hash plus payload position. Reprocessing the same finalized block should not duplicate data.

5

Advance after commit

Persist the checkpoint only after the projection transaction succeeds. On restart, resume from that checkpoint.

Last updated