Run the source keeper#
The source keeper (services/source-keeper) drives signed-source markets through
their permissionless lifecycle. It reads finalized RPC state, submits signed
resolution packets, finalizes due observations, expires overdue markets and
recovers what owners left behind. It can request public signed results from the
configured witnesses itself, and it publishes the public evidence of a result
after the resolution finalizes. Every action is one the program allows anyone to
take; the keeper signs and pays only its own transactions.
This page is the operator guide. The independent stack guide shows the keeper together with the source runner, the indexer and the API.
What it does each pass#
- Lifecycle. Using the configured program ID, deployment ID, cluster and the finalized Clock, it finalizes due observations, expires overdue markets, and recovers abandoned third-party drafts at their on-chain reclaim deadline. Draft rent goes to the creator recorded in the receipt.
- Order books. It checks up to four open order books per pass and reclaims expired ordinary and managed orders and stopped strategy orders. A reclaimed order covered by a live strategy restores that strategy's capital for the matching capital epoch.
- Idle seats. It evacuates idle seats of full trader ledgers in open and eligible terminal markets, sending balances to owner-controlled accounts.
- Terminal markets. After a market reaches its signed-source terminal state, it settles and closes each attached spline seat. After the seven-day close window, it releases orders, managed maker quotes and positions, returning reserves, payouts and rent to their owners, and then checks market closure.
Where a settlement or closure fails simulation only because an owner's or the creator's settlement token account is missing, it retries with idempotent account creation in the same transaction, charging the rent to its spend budget.
Configure it#
Copy the environment example (unavailable reference) and set at least:
| Setting | Purpose |
|---|---|
SEESAW_OPERATOR_KEEPERS_ENABLED | Must be 1 to run |
SOURCE_KEEPER_STATE_DIR | Mode-0700 directory for the spend budget, the packet inbox and the retry journal |
DRY_RUN, SOURCE_KEEPER_RUN_ONCE | Set both to true to inspect one cycle without sending |
Live mode uses shared Redis leases, so several keepers never act on the same work. Use a keeper wallet that is not a draft creator, so the program, not the keeper, enforces the reclaim deadline.
Signed resolution packets#
To resolve from packets you prepare, run the source runner with --keeper-inbox
and --keeper-wallet. It writes MARKET.REVISION.hex into the state directory,
and the keeper submits the file for the matching revision and deployment. The
keeper checks the packet's capture window and witness slots against the finalized
Clock, the source policy and the witness registry, and recaptures if a packet
expires or a witness rotates, is revoked or loses image approval. To replace a
packet by hand, move the stale file out of the inbox before rerunning the runner.
Automatic witness capture#
To let the keeper request public results itself, set an absolute
SOURCE_KEEPER_PACKET_ADDON or SOURCE_KEEPER_PACKET_BINARY path and three
distinct ADDRESS=SLOT entries in SOURCE_KEEPER_WITNESSES. For a two-signature
policy the keeper tries the first pair and rotates through the others on retry.
Capture uses host forwarding unless SOURCE_KEEPER_CAPTURE_NETWORK=relay. If a
policy pins TLS issuers, set SOURCE_KEEPER_ISSUER_SETS_JSON to the policy's
issuer digests per public profile; the keeper refuses a list that does not match
the on-chain policy digest.
Evidence publication#
Result bundles are saved under $SOURCE_KEEPER_STATE_DIR/evidence. An indexer on
the same host can read them through SOURCE_EVIDENCE_DIRECTORY. For a separate
indexer host, set SOURCE_KEEPER_EVIDENCE_API_URL (and
SOURCE_KEEPER_EVIDENCE_AUTH_DOMAIN if its wallet-auth domain differs). The
keeper records each resolution's signature and blockhash expiry before
submitting, and uploads verified public bundles only after that signature
finalizes. Pending uploads retry across restarts.
Run it#
bun --filter @seesaw/source-keeper start
Or build the container from the checkout root:
docker build -f services/source-keeper/Dockerfile \
--build-arg GIT_SHA="$(git rev-parse HEAD)" -t seesaw-source-keeper:local .
The image runs as UID and GID 10001. Persist /var/lib/seesaw/source-keeper with
that owner and mode 0700, mount the signer file read-only with mode 0600, and
mount any capture addon or requester read-only. The supplied GIT_SHA must match
RELEASE_COMMIT in live mode.
Limits#
Automatic witness capture supports public profiles with the default empty issuer set. Genuine source and Nitro qualification remain external signoffs.