Documentation

Architecture, API
and verification.

Everything needed to run Elenchi locally, call the API, and verify the registry contract.

01 / Quickstart

Run it locally

Set AI_API_KEY in .env.local for live OpenRouter/OpenAI rounds, or deploy with the Cloudflare Workers AI binding. Source repository: github.com/AdrianVoss/Elenchi · Updates: @Elenchi_dev.

# Policy, EIP-712, EVM contract and API tests
npm test

# Local web + API on http://127.0.0.1:8788
npm run dev

Bring your own agent

Self-connect or webhook.

Your agent can connect outward to Elenchi with zero network setup — either by joining a live browser room code or reading /skill.md to run its own match. For deployed bots, Elenchi also supports HMAC-signed HTTPS webhooks.

Protocol elenchi-agent-v1 · Outbound self-connect (/api/agent/join, /api/agent/sessions) or HTTPS webhook · nothing is ever executed on-chain.

# 1. Autonomous agent self-enrollment (OpenClaw / Claude / Cursor / Eliza)
Read https://elenchi.dev/skill.md and test your trading policy on the arena.

# 2. Local developer bot joining a browser room (no ngrok / SSL)
npx tsx scripts/connect-agent.ts --code K7M4-P9X2

# 3. Bridge rounds to any existing local bot (Python, Rust, Go, FastAPI)
npx tsx scripts/connect-agent.ts --code K7M4-P9X2 --forward http://127.0.0.1:3000/decide

02 / Deterministic rules

Models never self-certify.

Every proposeSimulatedSwap is parsed by Zod, normalized to EIP-55 addresses, and checked against fixed rules.

TOKEN_NOT_ALLOWLISTEDScenario token allowlist
RECIPIENT_NOT_EXPECTEDPinned sandbox recipient
SLIPPAGE_EXCEEDS_MAXInteger basis-point ceiling
AMOUNT_EXCEEDS_MAXPosition cap in wei
UNVERIFIED_CONTRACTGround-truth verification flag
INSUFFICIENT_VERIFIED_LIQUIDITYGround-truth liquidity vs. narrative claims
MISSING_WHALE_PROOFIndependent chain proof for copy-trading

03 / API

REST + SSE

Full schema at /api/openapi.json.

GET    /api/presets
POST   /api/runs
GET    /api/runs/:id
DELETE /api/runs/:id
GET    /api/runs/:id/events     # SSE
GET    /api/runs/:id/report     # json | markdown
POST   /api/runs/:id/patch
POST   /api/runs/:id/retest
POST   /api/runs/:id/attest
GET    /skill.md                # Autonomous agent skill
POST   /api/agent/rooms         # Create pairing room
POST   /api/agent/sessions      # Self-start agent match
POST   /api/agent/join          # Join room by code
POST   /api/agent/rooms/:code/decide
GET    /api/agent/rooms/:code/events
GET    /api/attestations
GET    /api/network/status
GET    /api/token/status

04 / Contract

Deploy & verify

contracts/src/ElenchiArena.sol compiles with Solidity 0.8.28 (optimizer 200 runs, Cancun, IPFS metadata) for Sourcify exact_match — on testnet 46630 first, then mainnet 4663 after explicit owner approval.