Self-hosting the indexer
Configure the Go indexer against your own RPC + Postgres.
The indexer is a single Go binary. It polls an Arc RPC for new blocks, decodes contract events, and projects them into Postgres.
Build
Or run the prebuilt distroless image:
Configuration
Required env vars (see .env.example):
STABLECOIN_ADDRESSES is a comma-separated list of ERC-20 contract addresses to also scan (for refund-completion Transfer events). Leave empty if you only need to project Strimz's own contracts.
Migrations
The indexer expects the Prisma schema from packages/db to be applied. From the repo root:
Confirmations
CONFIRMATIONS=1 keeps the indexer one block behind head. Arc has deterministic BFT finality — a committed block never reorgs — so one confirmation is plenty; the extra block only shields against an RPC replica that hasn't yet caught up to head.
Idempotency
The indexer's checkpoint is IndexerCursor. Truncate it and restart, and the indexer re-processes from the configured START_BLOCK. Every projection is idempotent (INSERT … ON CONFLICT DO NOTHING keyed on natural identifiers), so re-running is safe.
Observability
/healthz. Always 200 once the process is alive./readyz. 200 once the first batch has been processed./metrics. Prometheus endpoint with per-contract block lag, RPC latency, projection counts.
Failure recovery
If the indexer crashes mid-batch, the IndexerCursor does not
advance until the batch completes. On restart it picks up at the
last successful batch's end block. No event gets projected twice.
If the RPC returns malformed data (rare), the indexer logs the
error and skips the bad log. The rest of the batch processes
normally. Failed projections write to the AgentActivityLog, or to
stderr for a structural error like a schema mismatch.
