Run A Pyth Pull Keeper#
The keeper submits eligible native-market lifecycle transactions. It does not select the market outcome or redeem trader positions. The on-chain program checks timing, source evidence, and account identity.
The implementation is in services/pyth-keeper (unavailable reference). Use an authorized repository checkout. These commands do not establish that a public package or image is available.
Lifecycle actions#
The current native ABI is Pull-only. Each market stores a canonical 32-byte pythFeedId.
There is no stored feed-address sentinel and no alternate push branch.
| Market state | Action | Source dependency |
|---|---|---|
Past t_end, no end snapshot | snapshot_end | Fetch signed update, post through Receiver, consume and close transient account |
| End snapshot captured, unresolved | resolve_market | Read committed snapshots |
| Past configured expiry deadline, unresolved | expire_market | Read committed snapshots and deadline; no relay update |
The scanner selects expiry when the end snapshot remains missing at the deadline.
The program can also classify already committed snapshots during terminal expiry.
Without a committed end snapshot, expiry selects the neutral fallback.
It does not accept a transient PriceUpdateV2 account or capture a late price.
After resolution, the keeper settles attached spline seats, including dormant seats. It closes each seat in the same transaction. Settlement returns eligible quote collateral to the maker series vault and closure returns the seat rent to the series account. Market closure still waits for its own grace period and liability checks.
Prerequisites#
- Use the intended RPC, cluster, program ID, release commit, and immutable image digest.
- Provision a funded keeper keypair in a secret file.
- Provide a relay for snapshot evidence and verify its readiness.
- Provide shared Redis for live action leases.
- Provide persistent
PYTH_KEEPER_STATE_DIRstorage dedicated to this fee payer. - Match
EXPIRATION_WINDOW_SECONDSto the effective on-chain configuration.
The operator service requires SEESAW_OPERATOR_KEEPERS_ENABLED=1.
The BYO source-key guide describes the separate user path.
A process that starts without the operator gate does not establish active service.
New snapshots require a rent-safe reward reserve. MIN_FUNDED_CRANKS defaults to 3 and must be at least 2.
Resolve and expire require one remaining reward. Missing budget evidence defers new admission.
Already recorded attempts keep their reconciliation path.
Run It With Docker#
Run these commands from the repository root:
cp services/pyth-keeper/.env.example services/pyth-keeper/.env
docker build -f services/pyth-keeper/Dockerfile -t seesaw-pyth-keeper:local .
Set real deployment values in the copied environment file. Do not use placeholder identities as readiness evidence.
SEESAW_OPERATOR_KEEPERS_ENABLED=1
SEESAW_TARGET_CLUSTER=mainnet-beta
RPC_URL=https://your-solana-rpc.example
SEESAW_PROGRAM_ID=<verified-program-id>
RELAY_URL=https://your-pyth-relay.example
KEEPER_SECRET_KEY_FILE=/run/secrets/keeper_secret_key
KEEPER_CLAIM_REDIS_URL=redis://your-redis:6379
PYTH_KEEPER_STATE_DIR=/var/lib/pyth-keeper
SEESAW_RELEASE_COMMIT=<40-hex-release-commit>
SEESAW_PYTH_KEEPER_IMAGE_DIGEST=<registry-image>@sha256:<64-hex-digest>
DRY_RUN=true
EXPIRATION_WINDOW_SECONDS=604800
MIN_FUNDED_CRANKS=3
MIN_WALLET_BALANCE_LAMPORTS=50000000
METRICS_HOST=0.0.0.0
METRICS_PORT=9091
The sample expiry window is the shipped default. Replace it if the effective deployment value differs. The sample readiness balance is 0.05 SOL. Account rent and transaction concurrency can require more working capital.
Use PYTH_KEEPER_RECOVERY_ONLY=true to run a dedicated keeper for direct
recovery jobs with no relay, Hermes, or Jito configuration. Set
AUTO_ATTACH_SPLINE_SEATS=true to include permissionless spline series
attachment. A Pull keeper in its default mode still handles snapshots,
resolution, and expiry.
Start with a read-only secret mount and persistent state volume:
docker run --rm \
--mount type=bind,source=/opt/seesaw/secrets/keeper_secret_key,target=/run/secrets/keeper_secret_key,readonly \
--mount type=volume,source=seesaw-pyth-keeper-state,target=/var/lib/pyth-keeper \
--env-file services/pyth-keeper/.env \
-p 127.0.0.1:9091:9091 \
seesaw-pyth-keeper:local
METRICS_HOST=0.0.0.0 permits the container port mapping. The host mapping limits access to local clients.
In dry-run mode, examine classification and readiness. No lifecycle transaction should be sent.
For live operation, use the verified release image identified by the recorded digest.
Set DRY_RUN=false only after configuration, funds, Redis, persistent storage, and source readiness pass their checks.
Run the container under the deployment's supervisor with the same secret and state mounts.
A locally built image alone does not establish release qualification.
Redundancy Expectation#
Use at least two independent keepers for production operation. Use a separate RPC provider or endpoint, funded keypair, host, and alert route for the backup. Give each fee payer its own persistent state directory. Use shared Redis for action leases.
The first successful lifecycle transaction advances the market. A competing transaction can observe changed state or fail its preconditions. Examine transaction results; do not assume that every duplicate is a successful no-op. Use the redundancy procedure to verify failover.
Restart and partial progress#
- Keep the state volume and fee-payer identity.
- Restart with the same cluster, program, and effective configuration.
- Examine recorded attempts before admitting replacement work.
- Reconcile transaction signatures and committed market state.
- Continue only unfinished snapshot-bundle steps.
- Examine readiness and market progress after recovery.
A missing RPC observation does not establish failure. Lease expiry alone does not establish transaction failure. Do not delete state to clear an unknown attempt or reset the daily spend ledger. A snapshot can involve multiple transactions. Earlier provider work can succeed before a later step fails. The recovery fixtures below test these boundaries.
Manual Expire Fallback#
If the keeper cannot complete expiry, first reconcile any submitted attempt. Use the same cluster, program, market seed inputs, creator, and settlement mint.
seesaw market expire \
--rpc-url "$SEESAW_RPC_URL" \
--program-id "$SEESAW_PROGRAM_ID" \
--market-id "$MARKET_ID" \
--pyth-feed-id "$PYTH_FEED_ID_HEX" \
--creator "$CREATOR_ADDRESS" \
--creator-token-account "$CREATOR_TOKEN_ACCOUNT" \
--settlement-mint "$SETTLEMENT_MINT" \
--duration "$DURATION_SECONDS" \
--yes
CannotExpire means that an unresolved market has not reached the required on-chain expiry deadline.
An already terminal market follows the no-transition path.
Read the market again. Examine the confirmed outcome and reason after success.
An automatic creator payment can defer if its destination is invalid. Use creator-fee recovery for that separate liability.
Required Monitoring#
curl -fsS http://127.0.0.1:9091/health
curl -fsS http://127.0.0.1:9091/readiness
curl -fsS http://127.0.0.1:9091/metrics
curl -fsS http://127.0.0.1:9091/metrics/prometheus
| Check | Expected state or recovery |
|---|---|
| Process health | Endpoint responds; this alone does not establish market progress |
| Readiness | Correct release identity, sufficient wallet funds, and matching effective configuration |
lastTickUnix | Recent relative to the polling interval |
| Repeated action failures | Examine RPC, source, account, and transaction evidence |
| Low eligibility ratio | Examine reward budgets; top up eligible markets through the supported instruction |
| Market past end without snapshot | Examine relay, source entitlement, freshness, and keeper funding |
| Market past expiry deadline | Examine expiry admission and recorded attempts; expiry needs no relay update |
| Deferred creator fees | Correct the creator destination. Submit the eligible claim. |
Keep source API keys on the relay or configured server-side fallback. Never place bearer credentials in browser or mobile bundles. The relay can delay evidence but cannot replace the program's signature and boundary checks.
Evidence#
Source: services/pyth-keeper/src/scanner.ts, config.ts, executor.ts, and loop.ts.
Tests under services/pyth-keeper/tests/ include scannerAbi.test.ts, expirationWindowReadiness.test.ts,
providerRecovery.test.ts, and recoveryCrashMatrix.test.ts.
Program expiry behavior is in program/src/processor/expire_market.rs.
Its fixtures include expire_market_rejects_before_terminal_deadline and terminal_expiry_without_committed_end_snapshot_is_neutral.
Unit fixtures do not establish live Pyth entitlement, funded operation, or production failover. See Oracle Integration and Cranking.