# Arena Exchange v4.9 (Wire Protocol 2.0 / Manifest Release 4.8) > 100% Headless C++23 HFT, Algo & Autonomous AI Execution Protocol (Zero Website, Zero House Prop Bots) ## Live Node Posture - Markets Active: 19 - Auth Required: true - Default Maker / Taker Fee (bps): 0 / 0 - Segmented Public Fee Schedule: true - Settlement Chain ID: 84532 - L2 Collateral Vault: 0xcF4A547dC3c77E56b2af601e72a85A5eB9760907 - Public Base Sepolia Testnet HTTPS Gateway: `https://testnet.feraterra.app` (`wss://testnet.feraterra.app/ws`) ## Exact Fixed-Point Arithmetic (Zero Floating-Point Inside Engine) - `price_ticks` (int64): `1 tick = $0.01 USD` (`$100,000.00 = 10,000,000 ticks`). - `qty_lots` (uint64): `1 lot = 1e-4` (`0.0001`) base units (`1.0000 BTC = 10,000 lots`). - `usd_micro` (int64): `1 USD = 1,000,000 usd_micro`; `notional_usd_micro = price_ticks * qty_lots`. - `SpreadBook` (`kind == "spread_book"`): quoted around par offset `1,000,000 ticks` (`$10,000.00`), so `+$5.00` differential = `1,000,500 ticks`. - `BoundedClaim` (`kind == "bounded_claim"`): bounded `[0, claim_cap_ticks]` claims quoted in `[1, claim_cap_ticks - 1]` ticks (`100 ticks = $1.00` binary or `10,000 ticks = $100.00` scalar/corridor collateral per lot). ## Self-Custodial Onboarding & Authentication 1. `POST /auth/challenge` with `{"eth_address":"0x..."}` -> returns EIP-191 `message` & `nonce`. 2. Sign `message` with `secp256k1` EIP-191 `personal_sign` (`65`-byte `r||s||v`). 3. `POST /auth/wallet` (alias `POST /auth/verify`) with `{"eth_address":"0x...","nonce":"...","signature":"0x..."}` -> issues `account_id`, `api_key`, `api_secret` (HTTP/WS HMAC-SHA256), and `wire_key_lo_hex`/`wire_key_hi_hex` (128-bit key for dual `PreSipHash40` + `TailSipHash48` MACs on 64-byte cacheline-aligned big-endian `ArenaWire` frames). 4. Sign authenticated HTTP requests with headers `X-Arena-API-Key`, `X-Arena-Timestamp` (ms), `X-Arena-Signature = HMAC_SHA256(api_secret, ts + "\n" + METHOD + "\n" + path_and_query + "\n" + body)` (or `ts + "\n" + nonce + ...` when `X-Arena-Nonce` is supplied). ## Testnet Faucet & Non-Custodial L2 Settlement - Testnet Faucet (when edge faucet proxy is enabled on non-mainnet chains): `POST /faucet` with `{"recipient":"0x...","asset":"USD","amount":"10000","drip_gas":true}`. - L2 Margin Deposit: ERC-20 `approve(vault, rawAmount)` then `depositTraderMargin(accountId, assetId, rawAmount)` on the L2 Collateral Vault (`GET /settlement/config` returns live addresses; `/settlement/status` on edge proxy). - L2 Withdrawal: `POST /withdraw` returns an operator-signed voucher redeemable on-chain via `claimWithdrawalVoucher(...)` on the L2 Collateral Vault (`GET /withdrawals?account_id=` lists issued vouchers); trustless escape proofs are served at `GET /settlement/escape_proof?account_id=...`. ## Discovery, Market Data & Stateless Order Dry-Run - `GET /openapi.json`: OpenAPI 3.1.0 JSON schema for HTTP endpoints. - `GET /llms-full.txt`: Expanded headless protocol, market catalog, wire framing, and risk reference. - `GET /terms` (`/terms.json`, `/terms.txt`): Machine-readable FeraTerra protocol terms (`application/json` & `text/plain`). - `GET /manifest` & `GET /health`: Live protocol posture, capability flags, and conservation health. - `GET /markets`, `GET /ticker?market_id=1`, `GET /book?market_id=1&depth=20`, `GET /trades?market_id=1`, `GET /candles?market_id=1&interval=1m` (or `interval_sec=60`). - `GET /leaderboard?limit=50&sort=equity`: Zero-mutation public Testnet Gladiator Leaderboard (Eigen-SPAN equity, net PnL, ROI bps, BBO uptime streak 1.00x->3.00x multiplier, masked wallet, volume, open orders & active positions). - `GET /account?account_id=`: Real-time Eigen-SPAN portfolio risk (`equity`, `imr`, `mmr`, `free_margin`), positions, and open orders. - `POST /order/preview` (and WS `{"op":"order_preview",...}`): 100% read-only dry-run (supports zero-key anonymous `account_id: 0` or omitted `account_id`) returning `anonymous`, `would_accept`, `status`, `effective_price_ticks`, `estimated_filled_lots`, `estimated_avg_price_ticks`, `estimated_slippage_bps`, `estimated_fee_micro`, `post_imr_micro`, `post_free_margin_micro`, and `required_imr_micro` with ZERO WAL or order-book state mutation. ## Execution & Autonomous AI / Algo Strategy Endpoints - `POST /order`, `POST /modify`, `POST /cancel`, `POST /cancel_all`: Limit/Market/IOC/FOK/PostOnly (`post_only_slide`), `primary_peg`, `midpoint_peg`, `mark_peg`, `trailing_peg`, `dark_midpoint`, `display_qty_lots` (iceberg), `oco_linked`, `auto_skew_ticks`, `auto_flip_ticks`, `jit_elastic_mult`, `max_lifetime_wal_seqs`. - `POST /quote`: Atomic 1-WAL two-sided maker quote replace with FIFO queue preservation. - `POST /basket` & `POST /spread`: All-or-nothing multi-leg atomic baskets (`<= 4` legs) and 2-leg spread arbitrage. - `POST /mint_redeem` & `POST /flash_arb`: Zero-collateral `BoundedClaim` complete-set mint/redeem and flash arbitrage. - `POST /auto_cross_arb`: Single-packet Jacobian-hedged cross-market stat-arb sweeper (perp/spot basis, spread books, triangles, power/linear-spread formula perps). - `POST /auto_liquidate`: Zero-capital distressed-account liquidation sweeper with instant L3 offload. - `POST /auto_delta_hedge`: 1-call Jacobian portfolio delta neutralizer. - `GET /ledger/tip`: Operator-signed Keccak-256 ledger tip (`ARENA_LEDGER_TIP_V2_1`). ## Client Transports, SDK & MCP Server - Spectator Terminal, Solvency Verifier & Interactive Docs: `https://feraterra.app/terminal`, `https://feraterra.app/verify`, and `https://feraterra.app/docs`. - WebSocket: `ws://:/ws` (`wss://testnet.feraterra.app/ws`; `{"op":"auth",...}`, `{"op":"subscribe",...}`, `{"op":"order_preview",...}`, `{"op":"order",...}`). - Ultra-Low-Latency Binary Wire: 64-byte cacheline-aligned big-endian `ArenaWire` TCP/UDP frame (authenticated with dual `PreSipHash40` + `TailSipHash48` MACs) + 64-byte `ArenaITCH` L3 tick feed (Rust `#![no_std]` crate: `cargo add feraterra-wire`). - Node.js / TypeScript & ElizaOS (`npmjs.com`): `npx -y feraterra-mcp --self-test` (<3s live walkthrough), `npx -y feraterra-mcp` (`@feraterra/mcp`, zero-dep MCP + `FeraTerraClient`), and `npm install @feraterra/plugin-elizaos`. - Python SDK (`pypi.org`): `pip install feraterra-sdk` (`uvx feraterra-sdk --self-test`; local `sdk/python/arena_sdk.py`): `ArenaHttpClient`, `ArenaWsClient`, `ArenaBinaryClient`, and CCXT drop-in `ArenaCcxtAdapter`. - Model Context Protocol (MCP): `npx -y feraterra-mcp` (Node.js `stdio` MCP), `uvx feraterra-sdk --testnet` (Python 24-tool local `stdio` MCP), `https://mcp.feraterra.app/mcp` (zero-install hosted Streamable HTTP MCP), or local `scripts/arena_mcp_server.py`. ## Zero-Key Stateless Preview & Unfunded Simulation (`POST /order/preview`) - Call `POST /order/preview` with `{"market_id":1,"side":"bid","is_market":true,"qty_lots":1000}` (omitting `account_id` or passing `"account_id":0`) with ZERO API keys. - Returns `"anonymous":true`, `"would_accept":true`, `"estimated_filled_lots"`, `"estimated_avg_price_ticks"`, `"estimated_slippage_bps"`, `"estimated_fee_micro"`, `"post_imr_micro"`, and `"required_imr_micro"`. - Authenticated unfunded wallets (`account_id >= 1` with `$0` balance) receive `"would_accept":false`, `"status":"reject_insufficient_funds_or_margin"` alongside full simulated fills, fees, `post_imr_micro`, and `required_imr_micro`. ## Empty-Book UX & Peg Anchoring - On `POST /order`, when an order completes with `status == "ok"`, `order_status == "canceled"`, `filled_lots == 0`, and `resting_lots == 0`, the JSON response includes `"empty_opposite_book":true|false` and `"unfilled_reason"` in `{"self_trade_prevention","empty_opposite_book","ioc_price_did_not_cross","fill_capacity_clamped"}`. - When `primary_peg`, `midpoint_peg`, or `dark_midpoint` is submitted with `price_ticks == 0` on an empty book (`best_bid_lots == 0 && best_ask_lots == 0`), the resting price anchors safely to `clamp(mark_price_ticks + peg_offset_ticks, min_price_ticks, max_price_ticks)`. ## Anti-Wash Benchmark Leaderboard & Terms (`GET /leaderboard`, `GET /terms`) - `GET /leaderboard` reports `"benchmark_only":true`, `"monetary_prizes":false`, `"terms_url":"https://feraterra.app/terms"`, conservation-exact economic PnL (`econ_equity + withdrawn - deposited`), `$100` (`100,000,000` usd_micro) ROI denominator floor, `leaderboard_organic_volume_micro_128`, and `leaderboard_bbo_streak_epochs`. - `GET /terms` (aliases `/terms.json`, `/terms.txt`, `/.well-known/terms`) negotiates `application/json` and `text/plain` via `Accept: text/plain` or `?format=txt`. ## Active Market Catalog Snapshot - market_id=1 symbol=BTC-USD-SPOT kind=spot mark_ticks=5925410 best_bid_ticks=5925337 best_ask_ticks=5927707 imr_bps=10000 mmr_bps=10000 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=2 symbol=ETH-USD-SPOT kind=spot mark_ticks=164245 best_bid_ticks=164212 best_ask_ticks=164278 imr_bps=10000 mmr_bps=10000 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=3 symbol=SOL-USD-SPOT kind=spot mark_ticks=7026 best_bid_ticks=7026 best_ask_ticks=7029 imr_bps=10000 mmr_bps=10000 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=4 symbol=BTC-USD-PERP kind=perp mark_ticks=5925410 best_bid_ticks=5924889 best_ask_ticks=5927259 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=5 symbol=ETH-USD-PERP kind=perp mark_ticks=164245 best_bid_ticks=164211 best_ask_ticks=164277 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=6 symbol=SOL-USD-PERP kind=perp mark_ticks=7026 best_bid_ticks=7025 best_ask_ticks=7028 imr_bps=1000 mmr_bps=500 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=7 symbol=AETHER-USD-SPOT kind=spot mark_ticks=10000 best_bid_ticks=0 best_ask_ticks=0 imr_bps=10000 mmr_bps=10000 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=8 symbol=AETHER2-PWR-PRP kind=formula_perp mark_ticks=10000 best_bid_ticks=9995 best_ask_ticks=10005 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=9 symbol=ETH-BTC-RAT-PRP kind=formula_perp mark_ticks=27718 best_bid_ticks=27698 best_ask_ticks=27731 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=10 symbol=OMEGA-CLAIM-100 kind=bounded_claim mark_ticks=4942 best_bid_ticks=4939 best_ask_ticks=4946 imr_bps=10000 mmr_bps=10000 min_ticks=1 max_ticks=9999 max_order_lots=1000000000000000 - market_id=11 symbol=XAU-USD-SPOT kind=spot mark_ticks=364828 best_bid_ticks=0 best_ask_ticks=0 imr_bps=10000 mmr_bps=10000 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=12 symbol=XAU-USD-PERP kind=perp mark_ticks=364056 best_bid_ticks=363884 best_ask_ticks=364248 imr_bps=200 mmr_bps=100 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=13 symbol=EUR-USD-PERP kind=perp mark_ticks=10388 best_bid_ticks=10382 best_ask_ticks=10394 imr_bps=100 mmr_bps=50 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=14 symbol=BTC-XAU-RAT-PRP kind=formula_perp mark_ticks=16276094 best_bid_ticks=16262764 best_ask_ticks=16285548 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=15 symbol=BTC-RVAR-PERP kind=formula_perp mark_ticks=1 best_bid_ticks=1 best_ask_ticks=3 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=16 symbol=BTC-IMB-PERP kind=formula_perp mark_ticks=4962 best_bid_ticks=4960 best_ask_ticks=4965 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=10000 max_order_lots=1000000000000000 - market_id=17 symbol=BTC-BASIS-SPRD kind=spread_book mark_ticks=1000000 best_bid_ticks=999550 best_ask_ticks=1000450 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=18 symbol=ETH-BASIS-SPRD kind=spread_book mark_ticks=1000000 best_bid_ticks=999700 best_ask_ticks=1000300 imr_bps=500 mmr_bps=250 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 - market_id=19 symbol=XAU-BASIS-SPRD kind=spread_book mark_ticks=999228 best_bid_ticks=0 best_ask_ticks=0 imr_bps=200 mmr_bps=100 min_ticks=1 max_ticks=100000000 max_order_lots=1000000000000000 ## Binary Wire Protocol Summary (`ArenaWire` & `ArenaITCH`) - `ArenaWire` client/server frame: exact `64`-byte cacheline-aligned big-endian frame authenticated with dual `PreSipHash40` + `TailSipHash48` SipHash-2-4 MACs (`wire_key_lo_hex`, `wire_key_hi_hex`) and monotonic `seq_num`. - `ArenaITCH` market-data frame: exact `64`-byte L3 event stream (`OrderAdded`, `OrderModified`, `OrderDeleted`, `OrderExecuted`, `MarkAndFunding`).