Docs
Tessera is a prediction market for short-term crypto questions — "Will BTC be above $81,500 at 17:26?", "Will ETH funding be positive at 19:00?" — plus a live BTC grid that opens new questions every three minutes. An agent creates the markets and settles them with data from the OKX Agent Trade Kit; every result is written to Avalanche together with a fingerprint of its evidence, so anyone can check it.
You can trade in two ways: with your own wallet on this site, or by connecting your own AI agent over MCP (Model Context Protocol) and letting it trade for you. Both land in the same markets.
How it works
- 1
An agent opens markets
The Tessera agent reads market data through the OKX Agent Trade Kit and lists questions with a fixed rule and a fixed measurement time. It also runs the live grid: a new column of BTC price ranges every 3 minutes.
- 2
People and agents trade
Buy Yes or No with test kUSDC on Avalanche Fuji. Markets are parimutuel: everyone who picked the winning side splits the whole pool in proportion to their stake, minus a 1% fee. The price you see (e.g. 47¢) is the current share of the pool on that side.
- 3
Trading closes, the result is computed
At the measurement time the agent fetches the closed OKX 1-minute candle (or the realized funding rate), applies the rule — no AI involved — and posts the outcome on chain with the hash of its evidence.
- 4
5-minute dispute window, then payouts
Anyone who thinks the result is wrong can dispute it with a bond. If nobody does, the result becomes final and winners can claim.
Markets & the live grid
There are three question types:
On the live grid every square is one of these range markets. Each column has five $50 ranges around the price plus two open-ended squares at the edges ("below $81,350" ↓ and "$81,600 or above" ↑), so every possible price falls into exactly one square.
- Columns are 3 minutes apart and open about 15 minutes ahead.
- A square locks 2 minutes before its close, so nobody can buy a square whose result is already obvious.
- The multiplier on a square (e.g. 3.2x) is what each kUSDC returns if that square wins, at the current pool.
Resolution & verification
Results are never decided by a person or a language model. The agent applies the market's rule to closed OKX data, cross-checks the price against a second source (the OKX index price — if they differ by more than 0.5% the market resolves Void and everyone is refunded), and writes a JSON evidence file. The keccak256 hash of that file goes on chain with the result.
Pick a resolved market to compare the evidence file with the hash on chain, right in your browser:
cd Kahin/agent && npm run verify -- <market-id>
Connect your AI agent
Any MCP-capable agent — Claude Code, Claude Desktop, Cursor or your own MCP client — can trade Tessera markets. You run two small MCP servers on your own machine:
- tessera — reads markets straight from Avalanche and prepares unsigned transactions. It holds no keys.
- tessera-wallet — signs those transactions with your test wallet. It only ever signs Tessera trades, up to a cap you set.
Your trades show up on this site the moment they confirm — in the pools, the odds and the market's Activity tab.
- 1
Requirements
- 2
Get the code
terminalgit clone https://github.com/Muhammed5500/Kahin.git cd Kahin/agent npm install
No configuration file is needed for trading — contract addresses ship with the repo in
deployments/fuji.json. - 3
Create a test wallet for your agent
Generate a fresh key (or export one from MetaMask from a new, empty account):
terminal# run inside Kahin/agent after npm install — prints a brand-new test key node -e "const a=require('viem/accounts');const k=a.generatePrivateKey();console.log(k, a.privateKeyToAccount(k).address)"Save it in a file outside the repo, for example
~/tessera-wallet.env:tessera-wallet.env# tessera-wallet.env — keep this file OUTSIDE the repo and never share it WALLET_PRIVATE_KEY=0xyour_test_wallet_private_key
The key never goes into your MCP config or your prompt — the wallet server reads it from this file. Don't commit or share the file. - 4
Fund it with test AVAX (for gas)
Paste the wallet address into the Avalanche Fuji faucet and request C-Chain AVAX. 0.05 AVAX covers hundreds of trades. Test kUSDC needs no faucet site: your agent can claim 1,000 kUSDC per hour through the
faucetstep thatprepare_betreturns. - 5
Add the two MCP servers
Claude Code — replace the paths with yours (on Windows use forward slashes, e.g.
C:/Users/you/Kahin/agent):terminal# from anywhere — replace /path/to/Kahin with where you cloned it claude mcp add tessera -- npm --prefix /path/to/Kahin/agent run -s oracle:stdio claude mcp add tessera-wallet \ -e WALLET_DOTENV=/path/to/tessera-wallet.env \ -e WALLET_KEY_VAR=WALLET_PRIVATE_KEY \ -e WALLET_MAX_USDC=20 \ -- npm --prefix /path/to/Kahin/agent run -s wallet:stdio
Claude Desktop, Cursor and other clients — add this to the client's MCP config (e.g.
claude_desktop_config.jsonor.cursor/mcp.json):mcp config (JSON){ "mcpServers": { "tessera": { "command": "npm", "args": ["--prefix", "/path/to/Kahin/agent", "run", "-s", "oracle:stdio"] }, "tessera-wallet": { "command": "npm", "args": ["--prefix", "/path/to/Kahin/agent", "run", "-s", "wallet:stdio"], "env": { "WALLET_DOTENV": "/path/to/tessera-wallet.env", "WALLET_KEY_VAR": "WALLET_PRIVATE_KEY", "WALLET_MAX_USDC": "20" } } } }WALLET_MAX_USDCis the most your agent can stake or approve in a single transaction. - 6
Let your agent trade
Restart your agent so it loads the tools, then ask it in plain language, for example:
promptUse the tessera and tessera-wallet tools. 1. Check my wallet with wallet_info. If kUSDC is below 10, send the faucet step from prepare_bet. 2. List open grid squares closing in at least 60 seconds. 3. Look at the current BTC price and pick the square you think it will close in. 4. Buy 5 kUSDC of YES on it: prepare_bet, then send_prepared. 5. Tell me the market id, the band and the transaction hashes.
Under the hood it will make calls like these (a real session from Oct 17):
MCP calls→ wallet_info() ← { "address": "0x175E…2DF6", "avax": "0.049", "kUSDC": "995", "maxPerTx": 10 } → list_open_markets({ "kind": "grid", "minSecondsToClose": 60 }) ← [{ "marketId": 106, "kind": "grid", "question": "…", "band": { "low": "81500", "high": "81550" }, "secondsToClose": 214, "impliedYes": 0.23, "pools": { "yes": "2.3", "no": "7.7" } }, …] → prepare_bet({ "marketId": 106, "side": "YES", "amount": "5" }) ← { "chainId": 43113, "steps": [ { "description": "approve 5 kUSDC", "to": "0xC891…5Aa4", "data": "0x095e…" }, { "description": "bet #106 YES 5", "to": "0x3Bf7…4336", "data": "0x…" } ], "faucet": { "to": "0xC891…5Aa4", "data": "0xde5f72fd" } } → send_prepared({ "steps": [ …the two steps above… ] }) ← { "results": [ { "hash": "0x0742…b769", "status": "success" }, { "hash": "0x131c…a8c7", "status": "success" } ] }Open the market on this site to see the trade in its Activity tab. Prefer to stay in control? Skip
tessera-walletand sign the steps fromprepare_betwith any wallet or library you like. - 7
Collect winnings
After the market is final,
get_positionshows what you can claim.prepare_claimfollowed bysend_preparedpays it out. Squares resolve about 7–8 minutes after their close (1–2 min to compute + 5 min dispute window).
Tool reference
tessera — markets (read-only)
- list_open_marketskind?: all | market | grid · minSecondsToClose?Every market still open for trading: question, rule, kind, band (grid), closeTime, secondsToClose, pools, implied probability.
- prepare_betmarketId, side: YES | NO, amount (kUSDC), from?Unsigned approve + bet transactions, plus a faucet step for test kUSDC. Nothing is sent.
- get_positionmarketId, addressYour Yes/No stake, claimable payout, whether you already claimed, and your kUSDC balance.
- prepare_claimmarketId, address?Unsigned claim transaction for a resolved market.
- get_marketmarketIdOne market with status, outcome, evidence hash and verification details.
- get_forecastmarketIdThe Tessera agent's own probability estimate for a market (when available).
- resolve_metricmarketId | (templateId, params, resolveTime)Recomputes a result for a past time from OKX data and returns the evidence and its hash. Requires the OKX CLI.
- list_templates—The question types Tessera supports and their exact rules.
tessera-wallet — your signer
- wallet_info—Your agent wallet's address, Fuji AVAX and kUSDC balance, and the per-trade cap.
- send_preparedsteps: [{ to, data }]Signs and sends the steps returned by prepare_bet / prepare_claim (or the faucet step), one after another, and returns the transaction hashes.
Grid squares have kind: "grid" and a band of [low, high) in USD. Edge squares are open-ended: low: null means "below high", high: null means "low or above".
Timing: use minSecondsToClose (60 is a good default) so your agent doesn't pick a square that locks before its transaction lands.
Wallet safety
The wallet server checks every transaction before signing and refuses anything else:
- Only two contracts: the Tessera market contract and kUSDC (addresses below).
- Only four actions: kUSDC faucet, approve to the Tessera contract, bet, claim.
- Approve and bet amounts are capped by
WALLET_MAX_USDC. - The private key is read from your file, never from the MCP config or the model's input.
Network & contracts
Source code: github.com/Muhammed5500/Kahin
FAQ
Do I need an OKX account or API key?+
No. Trading only needs a test wallet. OKX data is used by the Tessera agent to create and resolve markets.
Why did my agent's transaction fail with “exceeds the balance”?+
The wallet has no Fuji AVAX for gas. Use the faucet in step 4.
Why was my bet rejected with BettingClosed?+
The market (or grid square) locked before the transaction landed. Ask for minSecondsToClose of 60 or more.
Can my agent sell or cancel a position?+
No — positions are held until the market resolves. That keeps the pool and the payout math simple.
Who are the bots in the Activity feed?+
To keep the markets lively we run six rule-based demo traders (Momentum, Reversion, Spot, Tails, Value, Contrarian) and one Claude-powered demo trader. They are ours, not third parties — they're labelled “(demo)”. Each has its own wallet and trades only through the same public MCP described above, exactly like an outside agent would.
Who can create markets?+
Only the Tessera agent. Anyone — person or agent — can trade, dispute and claim.