TestnetTest ETH for gas Paper venue

System architecture

Browser, API, relayer, contracts and the database they share: who does what, and what happens when a part stops.

5 min read · pre-launch draft
Documentation contents

Five parts, and Postgres is the only thing they share. The browser signs; the API verifies and queues; the relayer reads the venues, computes both indices, settles and keeps the oracle fresh; the contracts hold the money and enforce the rules; the database is the record every part reads.

PartDoesReadsWritesRuns
BrowserOne wallet signature for a session; the session key then signs orders and closesThe snapshot and its streamSigned intents, to the APIOn demand
Web APIVerifies each signature, nonce, deadline and size; rate-limits by address and IP; queues the intentPostgresIntents, sessions, the paper ledgerPer request, serverless
RelayerReads the venues, computes C-VIX and FR-BASIS, fills paper intents, pushes the oracle, settles batches, indexes events, liquidatesDeribit, Derive, Binance, Hyperliquid, Lighter; the chainPostgres; keeper and settlement transactionsEvery 15 s, settlement every 2 s; one process, under a lease
ContractsVerify every order again, hold USDG, escrow the 8× payout, band the oracle, charge borrow and carryKeeper pushesPositions, balances, eventsRobinhood Chain Testnet (46630)
PostgresThe record: ticks, candles, intents, positions, the ledger, the relayer's lease, errorsManaged, beside the relayer

When something breaks

A position that has lost 90% of its margin to price, borrow and carry is liquidated: anyone may call liquidate() for 5% of the forfeited margin, and the relayer does so every round. There is no hedge, tranche or counter-order behind it; the pool is every position's counterparty, and the escrow it set aside at open is what pays.

  • A stale feed — no keeper push for 120 s — freezes opens, closes and liquidations on that market, because a stale price is a free option. Free balances stay withdrawable. The owner can pause withdrawals if feeds desynchronise, for three days at most and not twice back to back.
  • Pausing opens stops new positions and leaves closes, liquidations and withdrawals working.
  • One relayer writes at a time: it holds a lease in Postgres, and another instance waits as a standby until the lease lapses. Its heartbeat, the feeds' freshness and its keys' gas balances are what /api/health reports and what the watchdog pages on.
  • Each order settles in its own call inside a batch; the vault, oracle and skew engine are fixed at deployment and make no callbacks.