Sync & Follow

One command takes you from the first block you care about to the live chain head, and keeps you there.

Lifecycle of a run

▸ Backfill

Sieve starts at the lowest start_block across your contracts, factories, and transfers (or --start-block) and fetches history from peers in parallel batches. A bloom filter check skips the body and receipt fetch for blocks that cannot contain a matching log.

▸ Catch-up

As it nears the tip, Sieve keeps tracking the head that peers report, so the target moves with the chain instead of stopping at the height it saw at startup.

▸ Follow

Once caught up, Sieve indexes each new block as it arrives. On OP-Stack chains it follows the sequencer's unsafe head, typically within a block or two.

Pass --end-block to stop at a fixed height instead of following. On Base, a backfill can also start from snapshot archives; see Base Archive Bootstrap.

terminal
sieve                                   # backfill, then follow
sieve --start-block 21000000 --end-block 21100000   # fixed range, then exit

Restarts

Blocks are committed in strict order, and the checkpoint always equals the highest committed block. A restart resumes at the next block, with no holes and no half-written ranges. On startup Sieve re-verifies its last committed block against a peer quorum before the API serves anything, which also catches a reorg that happened while it was stopped. See Integrity.

Only one Sieve process can write to a database at a time. A second one pointed at the same database is refused.

Reorgs

In follow mode Sieve compares stored block hashes with what peers report. When a peer quorum agrees on a different canonical tip, Sieve rolls back indexed rows, transfers, calls, and factory children above the fork point and re-indexes the new branch. Rollback covers up to 64 blocks. A single peer can never trigger one.

Peers

Peer heads are refreshed continuously while following, and after every successful fetch. In follow mode, a peer that has not answered successfully for two minutes is evicted and disconnected, and discovery replaces it. If you run your own node, pin it with trusted_peers so it is always in the set.

Graceful shutdown

Ctrl+C or SIGTERM (including docker stop) stops new work, drains what is in flight, and saves progress. This works at any stage, including while Sieve is still waiting for peers. A second signal forces an immediate exit.

Under Docker, give the container enough stop time for the drain to finish. See Docker.

Health and readiness

With the API enabled ([api] port or --api-port), these endpoints sit next to GraphQL:

/health

Liveness. Returns 200 while the process is up.

/ready

Readiness. Returns 503 during backfill and 200 once Sieve has caught up and is following the head, or has finished a fixed --end-block range. Use it to keep traffic away from a half-synced instance.

/metrics

Prometheus metrics in OpenMetrics text format.

Metrics

MetricMeaning
sieve_blocks_indexed_totalBlocks processed
sieve_events_matched_totalEvents matched by filters
sieve_events_stored_totalEvents written to the database
sieve_transfers_stored_totalNative transfers written
sieve_calls_stored_totalFunction calls written
sieve_chain_headLatest observed chain head
sieve_indexed_blockLatest indexed block
sieve_connected_peersConnected peers
sieve_active_fetchesFetch tasks in flight
sieve_pending_blocksBlocks left in the scheduler queue

sieve_chain_head minus sieve_indexed_block is your lag behind the chain.

Next steps

▸ Docker ports, stop timeout, and exposing the API
▸ Integrity what has to hold before a block is committed