Protocol

Keepers

The on-chain program enforces the rules, but it can't act on its own. Keepers are permissionless off-chain workers that do the time-sensitive jobs a market needs: keeping fixtures funded and tradeable, and submitting the proof that settles a match once it ends.

Keepers are a convenience, not a trust anchor
A keeper can only trigger actions the program already allows. It cannot decide an outcome — settlement still requires a valid TxLINE proof — and it cannot move funds out of a vault. If the default keeper fails, anyone else can run one.

One worker, two jobs#

In production a single worker process runs on an interval. Each pass does two things — seed new markets, then settle finished ones — and it exposes a health endpoint for uptime monitoring.

1. Seeding new markets

Fixtures go live throughout the day, and a market is only tradeable once it has been funded on-chain. So seeding runs continuously. On each pass the worker:

  • Discovers live and upcoming World Cup fixtures from TxLINE.
  • Creates a market for each (create_market) and seeds liquidity at the real 1X2 odds (fund_market_weighted) so opening prices are realistic rather than a flat 33/33/33.
  • Skips markets that are already seeded, so it is safe to run repeatedly.

2. Settling finished matches

When a match ends, the keeper resolves it. This is where the trustless design matters — the keeper does the heavy lifting off-chain, but the program has the final say:

  • It reads the final score from TxLINE's goal statistics and determines the winning outcome.
  • It builds a Merkle-proof-backed validateStat instruction — a predicate that is true only if that outcome actually happened.
  • It calls settle, which verifies the proof on-chain via a CPI into TxLINE. If it verifies, the market resolves; if not, nothing changes.

How it's configured#

The worker is tuned through environment variables. The most relevant:

VariableDefaultPurpose
SEED_INTERVAL_MIN10Minutes between passes (seed + settle).
SEED_DEPTH40USDC of liquidity seeded per market.
SEED_MAX12Maximum fixtures considered per pass.
SEED_DRY0Set to 1 to log intended actions without sending transactions.
Why this design matters
Separating who does the work (keepers) from who has authority (the on-chain proof) is what makes Hedge trustless. Keepers keep the lights on; math decides the outcomes.

Read how the proof is verified on the trustless contract page.