Operate independent services#
Use this guide to operate services for an existing Seesaw deployment. A separate protocol deployment also requires authority, configuration, licensing, and release decisions. This guide does not authorize a deployment or an upgrade.
Select the required components#
| Task | Required components | Remaining dependency |
|---|---|---|
| Read a known market | Compatible SDK and independent RPC | Solana account availability and RPC trust |
| Trade or withdraw | Wallet, compatible transaction builder, RPC, and funded accounts | Network execution and wallet wire support |
| Maintain a native market | Pyth access, relay or supported provider adapter, keeper, and fee payer | Authenticated boundary evidence |
| Produce mirror evidence | Admitted profile, runner, configured witnesses, and provider credentials | Source truth, access, and witness availability |
| Submit mirror evidence | Signed result packet, compatible sender, RPC, and fee payer | Deployment trust root and lifecycle conditions |
| Serve discovery and analytics | Indexer, PostgreSQL, configured RPC subscriptions, and API | Complete ingestion and projection freshness |
| Host the application | Compatible application build and configured service endpoints | Each enabled service and wallet connection |
With an explicit independent RPC transport, the TypeScript SDK can read a known market, a wallet's positions, and its open orders. The RPC provider must allow the bounded account scans used for positions and orders. Charts, served rankings, and historical analytics still require indexing. See the runnable example in the RPC escape hatch.
Obtain and build the release#
Obtain an authorized checkout of the reviewed release. Follow source access and licensing and SDK installation. Do not infer public package availability from a package name.
Run these commands from the repository root:
bun install --frozen-lockfile
bun --filter @seesaw/pyth-relay... build
bun --filter @seesaw/pyth-keeper... build
bun --filter @seesaw/source-runner... build
bun --filter @seesaw/source-keeper... build
bun --filter @seesaw/indexer... build
cargo build --locked --release --manifest-path source-witness/Cargo.toml \
-p seesaw-source-witness --bin source-packet
Build only the components that your selected task needs. Record the source revision, dependency lockfile, program identity, and resulting artifacts. Use deployment verification before you enable transaction submission.
Start the independent Compose stack#
The Compose stack (unavailable reference) runs the indexer and API with
PostgreSQL and Redis. The optional native profile adds the Pyth relay and keeper. The
source profile adds the signed-source keeper for packets produced by your runner.
The API port is published on host loopback. The database, Redis, and relay are
reachable only by containers on the Compose network. The native keeper shares
the relay's network namespace and calls it on loopback, which satisfies the
keeper's live transport requirement without publishing a relay port.
- From the reviewed checkout, build or import the indexer and any keeper images you need.
Use the Dockerfiles in
apps/indexerand the selected directories underservices. Supply the release commit when building the source keeper. - In
infra/docker/independent, copy.env.exampleto.envand point the image variables at those artifacts and the reviewed PostgreSQL 17 and Redis images. - Copy the indexer environment example to
.env.indexerand configure your own paired HTTPS and WSS RPC endpoints, program ID, release identity, and wallet-auth domain. SetSTART_SLOTto the first slot the indexer should ingest for your deployment. SetSEESAW_RELEASE_COMMITandSEESAW_DEPLOYMENT_MAP_JSONfor the deployment you follow. Compose defaults toINDEPENDENT_PYTH_DEFAULT_PATH=byo. To use the indexer's keeper-backed Pyth routes, selectkeeperand enable the matching operator and route flags in.env.indexer. Set the PostgreSQL password in the file named byPOSTGRES_PASSWORD_PATH. Put the matching URL in the file named byDATABASE_URL_PATHusingpostgresql://seesaw:<URL-encoded-password>@postgres:5432/seesaw?sslmode=disable&seesaw_db_scope=compose-internal. This database URL is scoped to the bundled PostgreSQL service on the Compose network. The indexer container runs as UID 65534 and needs read access to the URL file. - For each selected keeper profile, copy the corresponding service examples into
the environment files named by the stack. Configure the same deployment and cluster.
Mount separate funded payer files owned by UID 10001 with mode
0600. The native profile mounts the Hermes key in the relay. Give UID 10001 access to the source state directory and use that directory for the runner's keeper inbox. SetSEESAW_OPERATOR_KEEPERS_ENABLED=1in the selected keeper and relay environment files. SetDRY_RUN=truein the keeper files for the first inspection. Before enabling live Pull lifecycle actions, configure a reviewed Jito-family HTTPS submission endpoint and its approved tip policy in.env.pyth-keeper. The service example lists the direct Jito variables. Keep provider credentials in the operator's private configuration.
cd infra/docker/independent
docker compose up -d indexer
docker compose --profile native up -d pyth-keeper
docker compose --profile source up -d source-keeper
docker compose ps
The migration container must succeed before the indexer starts. Check /ready on the
API and compare an indexed transaction with your RPC. Inspect keeper logs before enabling
live submission. Keep the named volumes and source state directory across restarts.
Verify the indexer and RPC fallback#
From the repository root, provide the Compose API's published loopback HTTP
origin as SEESAW_INDEPENDENT_API_ORIGIN. Set SEESAW_RPC_URL,
SEESAW_GENESIS_HASH, SEESAW_PROGRAM_ID, and SEESAW_RELEASE_COMMIT for your
deployment. Pick a known market and a successful finalized transaction with an
indexed event for that market. For a public source market, optionally pass
its finalized acceptance transaction as the last argument.
bun --filter @seesaw/product-e2e engine:verify-independent-compose ready \
"$MARKET_ADDRESS" "$MARKER_SIGNATURE"
The command checks indexer freshness and release identity, compares the projected event and market with finalized RPC, and reports the results as JSON. With a public acceptance signature, it also verifies the served witness evidence against the accepted on-chain digests.
For an outage drill on a disposable or dedicated test deployment, stop its
indexer. Run the same command with outage in place of ready, then restart
the indexer and repeat ready. The outage command checks that the same host
port refuses connections before and after the SDK reads the market from RPC.
With an acceptance signature it checks finalized acceptance directly over RPC.
The verifier uses read operations and leaves service lifecycle commands to
the operator.
Enable automatic public-source capture#
The base source profile reads validated resolve packets from its private
inbox. To let the keeper request public Kalshi or Polymarket resolution packets
itself, use the requester override (unavailable reference).
- Build or obtain the reviewed
source-packetexecutable for Linux and the keeper image's architecture. Record its digest with the release. SetSOURCE_KEEPER_REQUESTER_PATHin Compose's.envto the executable's absolute host path. The mounted file must be executable by UID 10001. - Set
SOURCE_KEEPER_WITNESSESin.env.source-keeperto three distinctADDRESS=SLOTentries separated by commas. Match the registered witness slots and the profile's policy on the target deployment. If the policy pins TLS issuers, configure the matchingSOURCE_KEEPER_ISSUER_SETS_JSONas described in the keeper procedure (unavailable reference). LeaveSOURCE_KEEPER_PACKET_ADDONunset with this executable override. - Enable the override once the configured witnesses and source endpoints are approved for capture. Dry run prevents on-chain submission. The keeper can still contact witnesses and write evidence to its private state directory.
docker compose -f compose.yml -f compose.source-requester.yml --profile source up -d source-keeper
The override mounts the requester read-only at /opt/seesaw/source-packet.
Source admission, provider access, witness availability, and approved
measurements remain deployment requirements.
Publish source evidence to the local indexer#
The source keeper can publish verified public bundles after the acceptance transaction
finalizes. Set SOURCE_EVIDENCE_AUTH_DOMAIN in the Compose .env to the value of
AUTH_DOMAIN in .env.indexer, then start the keeper with the publication override.
docker compose -f compose.yml -f compose.source-publication.yml --profile source up -d source-keeper
For automatic capture with local publication, include both overrides.
docker compose -f compose.yml -f compose.source-requester.yml \
-f compose.source-publication.yml --profile source up -d source-keeper
The keeper shares the indexer's network namespace and uploads over loopback. The
indexer must be healthy before the keeper starts in this configuration. The
keeper's state and payer mounts belong to the keeper container. For a separate
indexer deployment, set SOURCE_KEEPER_EVIDENCE_API_URL to its HTTPS API base and
SOURCE_KEEPER_EVIDENCE_AUTH_DOMAIN to its wallet-auth domain in .env.source-keeper.
For a finalized public acceptance, read its witness digests from the transaction
through RPC. Check each digest at GET /api/v1/source-evidence-bundles/<digest>
on your indexer. Compare the downloaded bundle's SHA-256 with the witness digest.
An acceptance can finalize before the indexer projects it or stores its bundle.
The keeper retains queued uploads across restarts. Preserve its private state
directory while checking readiness and pending uploads.
Run a native keeper#
- Copy
services/pyth-keeper/.env.exampleto a private configuration file. - Set the RPC, relay, program, cluster, and release identity.
- Configure a dedicated fee payer through
KEEPER_SECRET_KEY_FILE. - Keep
DRY_RUN=trueduring the first inspection. - Configure the durable state directory and shared Redis before live operation.
- Start the service with the reviewed configuration.
- Examine
/health,/readiness, and/metrics/prometheus. - Compare discovered work with the on-chain market state.
bun --filter @seesaw/pyth-keeper start
The command inherits environment variables from your process manager. The example file is not loaded automatically by this command. Keep secrets out of shell history and public environment files.
Before you enable live submission, examine the fee payer, budget, state storage, and target deployment. Keep the durable state directory across restarts. Use the native keeper procedure for lifecycle eligibility and reward checks.
Snapshot submission needs authenticated Pyth evidence. Resolution uses the recorded snapshot. Expiry uses its deadline and does not need a new Pyth update. Competing callers can consume available work before your keeper submits.
You can submit a single lifecycle action from a fee-payer wallet using the
market address and an independent RPC. For snapshot, load PYTH_API_KEY_FILE
through your environment, or supply an existing update with --price-update.
seesaw --rpc-url "$RPC_URL" market snapshot --market "$MARKET"
seesaw --rpc-url "$RPC_URL" market resolve --market "$MARKET"
seesaw --rpc-url "$RPC_URL" market expire --market "$MARKET"
Resolve and expire derive the creator's settlement ATA for the market's token
program. Use --creator-token-account if the creator uses a different token account.
Run the signed-source runner and keeper#
Use source profiles to identify the admitted
profile and the provider access and witness policy it requires. Prepare the
request with seesaw source prepare-request using the independent RPC. The
request binds the market, deployment, operation, and authorized submitter to
finalized chain state.
Set SOURCE_PACKET_BINARY to the absolute path to the built source-packet
executable, or put it on the runner's PATH. Pass the policy's witness
addresses and their registered slot numbers.
node services/source-runner/dist/cli.js REQUEST.json WITNESS_1=SLOT_1 WITNESS_2=SLOT_2
The runner procedure (unavailable reference) covers
three-witness requests, packet output, and publication of public evidence
bundles. For a public Kalshi or Polymarket resolution handled by the keeper,
prepare the request for its wallet and pass --keeper-inbox and
--keeper-wallet to the runner. Keep the inbox and evidence across restarts.
The disposable stack also exercises the OpticOdds NBA moneyline using documentation-derived responses and fixture witnesses. Its keeper submits the signed inbox packet and keeps the evidence private. Live OpticOdds operation requires provider access, an approved witness measurement, and an admitted profile policy.
Copy the source keeper configuration example (unavailable reference)
to a private location. Configure the same RPC, program, deployment, and cluster
as the runner. Use an owner-only state directory and a dedicated fee-payer file.
Set SEESAW_OPERATOR_KEEPERS_ENABLED=1, DRY_RUN=true, and
SOURCE_KEEPER_RUN_ONCE=true for the first inspection. Load the environment
through your process manager before starting the service.
Set SOURCE_KEEPER_TOP_UP_CLOSER_REWARDS=true to let the keeper fund open
source markets with less than one closer reward above rent. The program restores
the budget to five rewards at the configured rate. Both spend caps must cover
the maximum debit of 5,000,000 lamports plus transaction fees. For example,
MAX_LAMPORTS_PER_TICK=6000000 fits with the default fee limits and daily cap.
bun --filter @seesaw/source-keeper start
Live source keeping runs from an image with the release commit baked into it. Build it from the reviewed checkout and record the image digest.
docker build --file services/source-keeper/Dockerfile \
--build-arg GIT_SHA="$(git rev-parse HEAD)" --tag seesaw-source-keeper:local .
In the live container, set RELEASE_COMMIT to that checkout's full SHA, set
TARGET_CLUSTER, and configure KEEPER_CLAIM_REDIS_URL for shared leases.
Mount the private state directory and fee-payer file so the image's service UID
can access them. The keeper procedure (unavailable reference)
covers optional automatic capture, budget limits, and evidence delivery to a
self-hosted indexer.
Run the indexer and API#
- Prepare a private database and the required RPC configuration.
- Copy the reviewed indexer configuration example.
- Set the program identity and paired HTTP and WebSocket RPC endpoints.
Set
INDEXER_HOST=127.0.0.1for loopback access from the host, and configure a dedicated Redis namespace withREDIS_URL,REDIS_REQUIRED=true, andREDIS_KEY_PREFIXwhen using Redis. - Back up an existing database before you apply migrations.
- Rehearse migrations against a staging copy.
- Apply migrations before you start the new process.
- Start the indexer.
- Examine its health and readiness.
- Compare a known chain event with its API projection.
bun --filter @seesaw/indexer db:migrate
bun --filter @seesaw/indexer start
/live reports process liveness. /ready reports traffic readiness under the freshness budget.
A running process does not prove complete ingestion.
The indexer reference (unavailable reference) describes configuration and authentication.
For recovery, keep the checkpoint and raw event evidence. After you compare the affected slot range, use the supported replay and projection-repair tools. Do not insert financial projection rows manually to make a health check pass. Test backup restoration on a separate database before you replace an active database.
Host the web application#
Configure the application with the same program and settlement asset as its services. Set public endpoints and runner origins at build time where the application inlines them. Keep private provider credentials on the server or runner.
bun --filter @seesaw/web build
bun --filter @seesaw/web start
Do a check of wallet connection, API freshness, RPC access, documentation downloads, and the selected source path. Do not infer device-wallet compatibility from a successful browser build.
Failure drills#
| Failure | Required check | Safe recovery |
|---|---|---|
| Hosted API unavailable | Known-market RPC reads work or return unavailable | Keep analytics visibly unavailable. Use the supported independent RPC path. |
| RPC unavailable | No new signing occurs from stale account evidence | Restore a verified transport, then reconcile pending attempts. |
| Keeper stopped | On-chain eligible work remains visible | Restart with the same durable state and fee payer. |
| Runner rejects a request | The refusal identifies the failed binding or prerequisite | Correct the prerequisite. Do not edit signed claims. |
| Provider unavailable | No fabricated terminal observation appears | Use the permitted candidate or timeout path when eligible. |
| Database restart | Checkpoint and projections recover consistently | Restore connectivity. Examine lag and a known event. |
| Lost acknowledgement | Signed identity remains in durable storage | Reconcile the same attempt before new authorization. |
Run the documented API outage test against a seeded local stack. Its result establishes only the tested surface and scenario. Record physical-device, staging, and genuine-provider checks separately.
Stop and restart#
Before you terminate a service, stop its intake of new work. Let the process complete its supported shutdown sequence. Keep journals, database state, deployment identity, and unresolved transaction signatures. After restart, reconcile unresolved work before you enable new economic actions. Before you restore traffic, examine readiness and a known state transition.