Docs · v1.0 · free, no key

API and MCP

Everything the batch desk does, over HTTP and MCP: read markets and batches, build sealed orders, reveals, settlements, deposits and withdrawals. Every transaction comes back unsigned and simulated, for your own wallet or your AI agent's wallet to sign.

Quickstart

Base URL https://endgamechess.click/api/. GET with query parameters, or POST a JSON body (use POST for anything that carries order details). CORS is open to every origin. There is no key, no account and no charge.

  1. List markets and check that a batch would settle now (stock feeds rest at weekends).
  2. Deposit USDG to buy, or the stock token to sell.
  3. During the 10-minute commit window, build a commit and send it. Keep the ticket.
  4. During the 5-minute reveal window that follows, build the reveal from the ticket and send it.
  5. After the reveal window, anyone settles. Read your fills with my_orders, then withdraw.
curl -s 'https://endgamechess.click/api/markets?market=TSLA'

curl -s -X POST https://endgamechess.click/api/build_commit_tx \
  -H 'content-type: application/json' \
  -d '{"market":"TSLA","side":"buy","amount":"0.5","limit":"400","from":"0xYourAddress"}'

AI agents: add the MCP server instead, and call the same seven tools.

claude mcp add --transport http endgame https://endgamechess.click/api/mcp

How batches work

Each market runs back-to-back batches. Batch b takes commits from start + b × commitSec for commitSec seconds (600 at launch), then reveals for revealSec (300), then must be settled within settleSec (86,400). The windows are fixed per market when it is listed and never change.

  • Price. Chainlink markets clear at the feed round in force when the reveal window closed, divided by the USDG / USD feed. The settler passes the round ids; the contract checks each was the one in force. TWAP markets clear at the pool's 30-minute time-weighted price ending at the close.
  • Void. The batch is void, and every order can be reclaimed in full, if the feed was older than the market's maxAgeSec at the close, USDG was more than 3% off $1 or its feed was over 26 hours old, the issuer had paused the token's oracle, a share multiplier took effect in the 6 hours before the close, the pool's last minute was more than maxDevTicks from its 30-minute average, the pool was thinner than minLiquidity, or nobody settled in time.
  • Matching. Buys with a limit at or above the price and sells at or below it take part. The smaller side fills in full; the bigger side fills pro rata. Buyers pay price × fill rounded up and sellers get it rounded down; the difference (at most 1 unit of USDG per batch) stays in the contract as dust nobody can take.
  • Locks. A reveal locks size × limit of USDG for a buy, or the size for a sell, from the trader's free balance. Settlement moves fills and returns the rest to the free balance at once.

The commit hash

Compute it yourself and your order never leaves your machine. The desk on the home page does exactly this in your browser.

keccak256(abi.encode(
  uint256 chainId,      // 4663
  address exchange,     // the Endgame contract
  uint256 market,       // market number
  uint256 batch,        // the batch taking commits now
  address trader,       // whose funds the reveal locks
  uint8   side,         // 0 buy, 1 sell
  uint128 amount,       // base units (18 decimals for stock tokens)
  uint128 limitPrice,   // quote units per 1e18 base units: USDG price x 1e6
  bytes32 salt          // 32 random bytes; keep it secret until you reveal
))

Example: buy 0.5 TSLA at most 400 USDG means amount = 500000000000000000 and limitPrice = 400000000.

GET markets

Listed markets with live prices: the latest Chainlink answer (with its age) or the pool TWAP, whether a batch would settle on it right now and why not, the current batch and its deadlines. Before the exchange is deployed it returns the 46 planned markets with live prices. Cached 15 seconds.

marketoptional: a market number or a symbol such as TSLA
plannedoptional: 1 lists every planned market with live prices, listed or not
curl -s 'https://endgamechess.click/api/markets?market=AVGO'
Response
{
  "deployed": true, "contract": "0x…", "now": 1794784524, "block": 115223890,
  "usdg": { "answer": 0.99993517, "updatedAt": 1794757996, "ageSec": 26528 },
  "count": 1,
  "markets": [{
    "market": 2, "symbol": "AVGO", "name": "Broadcom", "open": true,
    "base": { "address": "0x156E…fbcF", "decimals": 18 },
    "quote": { "address": "0x5fc5…1d168", "decimals": 6, "symbol": "USDG" },
    "pricing": "twap",
    "source": { "pool": "0x5B7C…028c", "twapSec": 1800, "maxDevTicks": 200, "minLiquidity": "21100000000000000" },
    "windows": { "start": 1794776400, "commitSec": 600, "revealSec": 300, "settleSec": 86400 },
    "minSize": "0.01",
    "live": { "price": "339.58", "settlesNow": true, "why": null, "oraclePaused": false, "recentMultiplier": false, … },
    "batch": { "batch": 13, "commitEndsAt": 1794784800, "revealEndsAt": 1794785100, "settleBy": 1794871500, "secondsLeftToCommit": 276 }
  }],
  "note": "…"
}

GET batch_status

One batch: its phase (commit, reveal, settle, late, settled, void), deadlines, commit count, every revealed order, the result or void reason, and once the reveal window has closed, a settle preview (price, matched size) with the unsigned settle transaction. Cached 5 seconds.

marketmarket number or symbol
batchoptional, defaults to the batch taking commits now
fromoptional sender for the settle transaction
curl -s 'https://endgamechess.click/api/batch_status?market=TSLA&batch=12'
Response
{
  "market": 1, "symbol": "TSLA", "batch": 12, "currentBatch": 13, "phase": "settled",
  "phaseText": "Settled at one clearing price. …",
  "times": { "commitStart": 1794783600, "commitEnd": 1794784200, "revealEnd": 1794784500, "deadline": 1794870900 },
  "commits": 1, "revealed": 1,
  "result": { "price": "387.075094", "priceRaw": "387075094", "feedRound": "18446744073709553761",
              "buyVolume": "0.1", "sellVolume": "0", "matched": "0" },
  "voidReason": null,
  "orders": [{ "index": 0, "trader": "0x7099…79C8", "side": "buy", "amount": "0.1", "limit": "400",
               "locked": "40", "done": true, "filled": "0", "quoteAmount": "0" }],
  "privacy": "Revealed orders are public from their reveal on: …"
}

POST build_commit_tx

Seals an order for the batch taking commits now. Returns the hash, a ticket, the transactions to send in order (an exact-amount $ENDGAME approve if needed, then commit), funding transactions if your free balance can't cover the reveal's lock, a simulation and warnings. The server makes a salt if you don't pass one and stores nothing.

marketmarket number or symbol (a symbol picks its first open market)
sidebuy or sell
amountsize in shares, like 0.5 (or amountRaw)
limitUSDG per share: the most a buy pays, the least a sell takes (or limitRaw)
fromthe trader's address
saltoptional, 0x + 64 hex
curl -s -X POST https://endgamechess.click/api/build_commit_tx \
  -H 'content-type: application/json' \
  -d '{"market":"TSLA","side":"buy","amount":"0.5","limit":"400","from":"0xYourAddress"}'
Response
{
  "market": 1, "symbol": "TSLA", "batch": 13, "hash": "0x8809…c521",
  "ticket": { "market": 1, "batch": 13, "trader": "0x7099…79C8", "side": "buy",
              "amountRaw": "500000000000000000", "limitRaw": "400000000", "salt": "0x9d30…d8f4",
              "amount": "0.5", "limit": "400", "revealFrom": 1794784800, "revealUntil": 1794785100 },
  "lock": { "asset": "0x5fc5…1d168", "symbol": "USDG", "amount": "200", "free": "0" },
  "burn": { "token": "0x…", "amount": "1000" },
  "txs": [
    { "chainId": 4663, "from": "0x7099…", "to": "0x…token", "data": "0x095ea7b3…", "value": "0x0",
      "label": "Approve 1000 $ENDGAME for the order burn (exact amount)", "gas": "0x13786" },
    { "chainId": 4663, "from": "0x7099…", "to": "0x…exchange", "data": "0xe2543d7c…", "value": "0x0",
      "label": "Commit a sealed order to TSLA batch 13", "gas": "0x30c0a" }
  ],
  "fundingTxs": [ { "label": "Approve 200 USDG for Endgame (exact amount)", … }, { "label": "Deposit 200 USDG", … } ],
  "simulation": { "ok": true, "results": [ { "label": "…", "ok": true, "gasUsed": 45961 }, … ] },
  "warnings": [ "The reveal locks 200 USDG from your free balance in Endgame, which holds 0. …" ],
  "note": "Unsigned. Send in order from 0x7099…. Keep the ticket: …"
}

POST build_reveal_tx

Turns a ticket into the unsigned reveal transaction, after checking the commit exists onchain, the window, and the trader's free balance. Anyone may send a reveal; the funds it locks are always the trader's.

ticketthe ticket object from build_commit_tx (or its fields at the top level)
fromoptional sender, defaults to the trader
curl -s -X POST https://endgamechess.click/api/build_reveal_tx \
  -H 'content-type: application/json' \
  -d '{"ticket":{"market":1,"batch":13,"trader":"0xYourAddress","side":"buy",
       "amountRaw":"500000000000000000","limitRaw":"400000000","salt":"0x…"}}'
Response
{
  "market": 1, "symbol": "TSLA", "batch": 13, "hash": "0x…", "commit": "committed",
  "window": { "revealFrom": 1794784800, "revealUntil": 1794785100, "now": 1794784812 },
  "lock": { "asset": "0x5fc5…1d168", "symbol": "USDG", "amount": "200", "free": "200" },
  "txs": [ { "to": "0x…exchange", "data": "0x…", "label": "Reveal buy 0.5 TSLA at most 400 USDG", … } ],
  "simulation": { "ok": true, … }, "warnings": [],
  "note": "Unsigned. Anyone may send a reveal …"
}

GET my_orders

An address's latest commits, newest first, each with its status in plain words (sealed, reveal window open, filled, partly filled, void, reclaimable) and the unsigned actions it allows (cancel, reclaim), plus free and locked balances with a ready withdraw transaction. Cached 5 seconds.

addressthe trader
limitoptional, 1–100, default 25
curl -s 'https://endgamechess.click/api/my_orders?address=0xYourAddress&limit=5'
Response
{
  "address": "0x7099…79C8", "commits": 10, "shown": 2,
  "orders": [{
    "hash": "0x844f…10d5", "market": 1, "symbol": "TSLA", "batch": 12, "commit": "revealed",
    "order": { "index": 0, "side": "buy", "amount": "0.1", "limit": "400", "locked": "40", "filled": "0", "done": true },
    "price": "387.075094",
    "status": "settled, not filled: everything went back to your free balance",
    "actions": []
  }, …],
  "balances": [{ "asset": "0x322F…3b2d", "symbol": "TSLA", "free": "0.2", "locked": "0",
                 "withdraw": { "to": "0x…exchange", "data": "0x69328dec…", "label": "Withdraw all free TSLA" } }],
  "note": "Reads are public chain data. …"
}

POST build_tx

The other transactions, unsigned and simulated.

action=depositasset (USDG, a symbol or an address), amount, from. Checks the per-wallet and total caps; adds an exact-amount approve if needed.
action=withdrawasset, amount (or all), from, optional to. Never paused.
action=settlemarket, batch. Anyone can settle once the reveal window has closed.
action=reclaimmarket, batch, index. Returns a void or late batch's locked funds to the order's trader.
action=cancelhash, from. Withdraws an unrevealed commit; the burn is not refunded.
curl -s -X POST https://endgamechess.click/api/build_tx \
  -H 'content-type: application/json' \
  -d '{"action":"deposit","asset":"USDG","amount":"100","from":"0xYourAddress"}'
Response
{
  "action": "deposit", "asset": "0x5fc5…1d168", "symbol": "USDG",
  "txs": [
    { "chainId": 4663, "to": "0x5fc5…1d168", "data": "0x095ea7b3…", "label": "Approve 100 USDG for Endgame (exact amount)", "gas": "0x17489" },
    { "chainId": 4663, "to": "0x…exchange", "data": "0x47e7ef24…", "label": "Deposit 100 USDG", "gas": "0x23db6" }
  ],
  "simulation": { "ok": true, "results": [ { "ok": true, "gasUsed": 57976 }, { "ok": true, "gasUsed": 97592 } ] },
  "warnings": [], "note": "Unsigned. Deposits are public onchain (who, what, how much)."
}

GET status

The exchange as a whole: owner, paused or not, the token, the order burn, total burned, market counts, and per asset the caps, what is held and any queued raise. Cached 15 seconds.

curl -s https://endgamechess.click/api/status
Response
{
  "product": "endgame", "version": "1.0.0", "chainId": 4663, "deployed": true,
  "owner": "0x…", "paused": false, "tokenOnContract": "0x…", "orderBurn": "1000", "totalBurned": "13000",
  "markets": 3, "openMarkets": 3,
  "caps": [ { "symbol": "USDG", "perUser": "2000", "total": "50000", "held": "804.07069", "pendingRaise": null }, … ],
  "audited": false,
  "note": "The contract is new and not audited. …"
}

MCP server

Remote MCP over Streamable HTTP at https://endgamechess.click/api/mcp: JSON-RPC 2.0 by POST, JSON replies, protocol 2025-06-18, no session and no key. Methods: initialize, notifications/initialized, tools/list, tools/call, ping.

Claude Code

claude mcp add --transport http endgame https://endgamechess.click/api/mcp

Cursor and other clients

{"mcpServers":{"endgame":{"url":"https://endgamechess.click/api/mcp"}}}
marketsread-only: markets, live prices, settle-ability, current batch
batch_statusread-only: one batch, its orders, result and a ready settle call
build_commit_txa sealed order: hash, ticket, unsigned transactions
build_reveal_txthe unsigned reveal from a ticket
my_ordersread-only: an address's commits, fills, balances and next actions
build_txunsigned deposit, withdraw, settle, reclaim or cancel
statusread-only: caps, burn, pause state and owner limits
curl -s -X POST https://endgamechess.click/api/mcp \
  -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"batch_status","arguments":{"market":"TSLA"}}}'

Tool results are JSON text in content[0].text, also in structuredContent. Input errors come back as a result with isError: true and a plain message, so the agent can fix the call.

Limits and errors

  • Free, with no key and no per-call charge. Reads are cached for 5 to 15 seconds; please don't poll faster than that.
  • Errors are JSON: {"error": "code", "message": "…"}. 400 for bad input, 404 for an unknown market or commit, 409 when the state doesn't allow it (window closed, cap reached), 503 not_launched before the contract exists, 502 upstream when the Robinhood Chain RPC fails or rate-limits (retry in a few seconds).
  • Simulations run at the latest block with eth_simulateV1. A batch window can close between building and sending; build again for the next batch.
  • At most 100 revealed orders per batch; later reveals are refused, so reveal early in the window.

Privacy

  • Until you reveal, only your address, the market, the batch, the time, the hash and the $ENDGAME burn are public. Side, size, limit and salt are not.
  • A reveal makes the whole order public. It happens after commits close and before the price exists; the price comes from Chainlink or the pool, never from the orders.
  • Deposits, withdrawals and balances are always public. Deposit early, or a round amount, so a deposit doesn't point at your order.
  • build_commit_tx sees your order details while it builds the hash and stores none of them. To keep them entirely to yourself, compute the hash locally (the desk does) or pass your own salt.
  • Stock tokens are issued by Robinhood. If the issuer pauses or blocks a token, it can't move into or out of Endgame either.

Token

Each commit burns a fixed amount of $ENDGAME: 1,000 at launch, set by the owner between 0 and 100,000 (a limit in the contract). The burn goes to the dead address and is counted onchain. The API, the MCP server and every read are free. There is no trading fee. $ENDGAME has no other role: no fee share, no votes, no returns.

Contract

Solidity 0.8.24 with OpenZeppelin: Ownable2Step, Pausable, ReentrancyGuard and SafeERC20. Fee-on-transfer-safe deposits, checks-effects-interactions everywhere, an event for every state change. Tested with 75 unit, 7 fuzz, 7 invariant and 5 fork tests against the live Robinhood Chain feeds and pools. Not audited.

Exchange
Not deployed yet
Token
Launching on Pons
  • Trader functions: deposit, withdraw, commit, cancel, reveal, settle, reclaim.
  • Owner functions: addMarkets, setMarketOpen, setCaps / applyCaps, setOrderBurn, setToken (once), pause / unpause (new deposits and commits only). No function moves user funds.