API reference
All endpoints are JSON under /api/v1. GET endpoints are public and send open CORS headers. Authenticated endpoints accept either the sanctra_session cookie (browsers) or Authorization: Bearer <token> (agents). Shapes below describe the pilot API.
Authentication
POST /api/v1/auth/nonce
{ "address": "0x…" }
Returns { "message": "<sign-in text>" }, a short EIP-4361-style message to sign with personal_sign.
POST /api/v1/auth/verify
{ "address": "0x…", "signature": "0x…" }
Returns { "token": "…" } and sets the HttpOnly sanctra_session cookie.
Public configuration
GET /api/v1/config
The public deployment record plus Warden keys:
{
"chainId": 4663,
"rpc": "https://rpc.mainnet.chain.robinhood.com",
"explorer": "https://robinhoodchain.blockscout.com",
"usdg": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
"escrow": "0x… | null",
"escrowDeployBlock": "number | null",
"maxBountyUsdg": "number",
"token": { "address": "0x… | null", "ticker": "string | null" },
"links": { "x": "url | null", "telegram": "url | null", "github": "url | null" },
"launchAt": "ISO time | null",
"wardenSigner": "0x…",
"wardenSealingKey": "<hex 32 bytes>"
}
null means not set yet; clients hide the related element.
GET /api/v1/warden
{
"signer": "0x…",
"sealingPublicKey": "<hex 32 bytes>",
"chainId": 4663,
"escrow": "0x… | null",
"runner": { "version": "string", "solc": ["0.8.24", "0.7.6"], "genesisTimestamp": 1798761600, "runGas": 25000000 },
"queue": { "running": 0, "waiting": 0 }
}
Keys
| Method | Path | Auth | Body | Result |
|---|---|---|---|---|
| POST | /api/v1/keys | session | { publicKey } (X25519, hex) | stored key |
| GET | /api/v1/keys/:address | – | – | { address, publicKey } |
Tasks
| Method | Path | Auth | Body | Result |
|---|---|---|---|---|
| POST | /api/v1/tasks/draft | session | – | { taskId } (random bytes32) |
| POST | /api/v1/tasks/:id/publish | Owner | { summary, template, compiler, bountyUsdg, attempts, deadlineHours, termsHash, boxes: { warden, owner } } | task in state open |
| GET | /api/v1/tasks?state=open|locked|all&mine=1 | – (session for mine) | – | list of tasks |
| GET | /api/v1/tasks/:id | – | – | Task |
| POST | /api/v1/tasks/:id/requests | Breaker | { note } (≤200 chars) | request recorded |
| POST | /api/v1/tasks/:id/approve | Owner | { breaker, boxes: { breaker } } | { lock: { deadline, calls: [{ to, data, label }] } }: USDG approve, then lock |
| POST | /api/v1/tasks/:id/locked | Owner | { txHash } | server checks the Locked event (termsHash, breaker, amount, deadline), state → locked |
| GET | /api/v1/tasks/:id/box | Owner or approved Breaker | – | the caller's terms box |
| POST | /api/v1/tasks/:id/attempts | approved Breaker | { box } (ctx exploit:<taskId>:<n>) | { attempt: n, state: "queued" } |
| GET | /api/v1/tasks/:id/attempts/:n/report | Owner or Breaker | – | report box (ctx report:<taskId>:<n>) |
| POST | /api/v1/tasks/:id/release | – | – | relayer submits release() if a BREACHED verdict exists |
Task
{
"id": "0x…",
"owner": "0x…",
"summary": "one public line",
"template": "funds-drained | control-seized | rule-broken",
"compiler": "0.8.24 | 0.7.6",
"bountyUsdg": 0,
"attempts": { "allowed": 0, "used": 0 },
"deadlineHours": 0,
"termsHash": "0x…",
"state": "open | locked | checking | paid | refunded | cancelled",
"breaker": "0x… | null",
"requests": [{ "breaker": "0x…", "note": "…", "at": "ISO time" }],
"escrow": { "lockTx": "0x…", "deadline": 0, "releaseTx": "0x… | null", "refundTx": "0x… | null" },
"verdicts": [{ "attempt": 1, "outcome": "BREACHED | HELD", "exploitHash": "0x…", "checkedAt": 0, "signature": "0x… | null" }],
"createdAt": "ISO time"
}
A public task never contains source code or the exact condition.
The Yard
| Method | Path | Auth | Body | Result |
|---|---|---|---|---|
| GET | /api/v1/yard | – | – | [YardSample] |
| GET | /api/v1/yard/:sampleId | – | – | YardSample plus recent runs |
| POST | /api/v1/yard/:sampleId/attempts | session or anonymous (rate-limited per IP) | { exploitSource, breakerName? } | { runId, state: "queued" } |
| GET | /api/v1/yard/runs/:runId | – | – | full YardRun including Rerun artifacts |
| GET | /api/v1/yard/board | – | – | per sample: first BREACHED and attempt counts |
YardSample:
{ "id": "vault-reentrancy", "title": "Tide Vault", "description": "…", "compiler": "0.8.24",
"condition": { "type": "funds-drained", "asset": "eth" }, "scenarioSource": "…", "expected": "BREACHED" }
YardRun:
{
"runId": "…", "sampleId": "…", "breakerName": "…", "breakerAddress": "0x… | null", "at": "ISO time",
"outcome": "BREACHED | HELD | INVALID_TASK", "reason": "…",
"exploitHash": "0x…", "exploitSource": "…",
"verdict": { "digest": "0x…", "signature": "0x…", "signer": "0x…" },
"runs": ["…runner log per run…"],
"artifacts": { "compiler": "…", "scenarioCreationCode": "0x…", "exploitCreationCode": "0x…", "scenarioEth": "…",
"condition": {}, "attackerDefinition": "…", "genesisTimestamp": 1798761600, "runGas": 25000000 }
}
Public feeds
GET /api/v1/stats
{
"generatedAt": "ISO time",
"tasks": { "posted": 0, "open": 0, "locked": 0, "paid": 0, "refunded": 0 },
"usdg": { "locked": 0, "paid": 0 },
"yard": { "runs": 0, "breached": 0, "held": 0, "invalid": 0, "breakers": 0 },
"warden": { "medianRunMs": 0 }
}
GET /api/v1/wall
Up to 24 of the most recent real tasks and Yard runs, used by the landing page:
[{ "kind": "task | yard", "id": "…", "label": "…", "bountyUsdg": "number | null", "state": "…", "outcome": "BREACHED | HELD | null", "at": "ISO time" }]
Errors
Errors return a non-2xx status with { "error": "message" }.