Skip
Mimir

MIMIR · DOCUMENTATION

How Mimir works

Mimir is an AI-settled claim market on X Layer Testnet — OKX's EVM-equivalent zkEVM L2 with OKB as the native gas token. Two parties stake USDC on opposite sides of a verifiable question; when the deadline passes, an off-chain AI oracle reads the agreed-upon evidence source, returns a verdict, and the smart contract pays out the winning side atomically. No committees, no manual disputes.

01

What Mimir is

A claim in Mimir is a single, verifiable question with a deadline and a designated resolution source — for example, “Will Argentina reach the World Cup 2026 final according to FIFA.com?”

Anyone creates a claim by staking USDC on one side. Another party (or an autonomous agent) challenges by staking the other side. At the deadline the oracle fetches the evidence URL, asks an LLM to evaluate the outcome against the settlement rule, and submits the verdict on chain. The contract pays out the winning side in the same transaction.

What ships on chain: the question, both positions, the resolution URL, both stakes, the verdict, the confidence number, and the keccak256 hash of the raw evidence the oracle actually saw. The hash means anyone can re-fetch the URL, hash it themselves, and verify the oracle isn't lying about its input.

02

Why X Layer

X Layer is OKX's EVM-equivalent zkEVM L2 (chain id 1952 on testnet) with OKB as the native gas token. Stakes are denominated in USDC, a 6-decimal ERC-20, so payouts stay stable regardless of OKB price action. The combination changes the economics of a stake-and- settle market enough to be worth calling out:

USDC stakes, stable payouts

Stakes never move with OKB price. A 5 USDC challenge is worth 5 USDC at settlement no matter what the gas token did in the meantime.

Predictable, sub-cent fees

Gas is denominated in OKB. A settlement tx costs a fraction of a cent regardless of network congestion, since the zkEVM rollup batches proofs to Ethereum L1.

Sub-second deterministic finality

The oracle can settle and pay out inside a single user-visible moment, instead of leaving funds in limbo through a long confirmation window.

Direct OKX on-ramp

Users withdraw OKB straight from an OKX exchange account to X Layer — no bridge UI, no wrapped tokens, no waiting on a third-party message relayer.

03

Architecture

Three independent tiers, each running where it fits best:

UsersMetaMask / OKX WalletVERCEL · FRONTENDNext.js 16 app/explorer · /vs/[id]+ /api routesRAILWAY · WORKERSoracle + market-creatorpoll, evaluate, settlesign via viem signerX LAYER TESTNETMimir.solUSDC stakes · OKB gas · chain 1952sub-second finality, EVM-equivLLM PROVIDERGemini · Anthropicverdict + confidence
Left to right: user wallets and worker agents on the left, Next.js frontend (Vercel) and Railway workers in the middle, X Layer contract and the LLM provider on the right.
  • Frontend (Vercel). Next.js App Router with serverless API routes. Reads come straight from X Layer RPC; writes are user-signed via wagmi/viem.
  • Workers (Railway). The oracle and market-creator agents run as long-lived Node processes. Each agent holds a local private key and signs through a viem account directly — no remote signing service in the hot path.
  • Data (Neon Postgres).A denormalised read-index of on-chain state for the explorer / dashboard feeds. Optional — the contract remains source of truth, and pages that don't need feeds (stats, claim detail) work without it.

04

The claim lifecycle

01CreateStake side A in USDC02ChallengeSide B stakes the other side03WaitDeadline passes04ReadOracle fetches evidence05EvaluateLLM returns verdict + confidence06ResolveAtomic on-chain payoutCREATORORACLE
Six discrete steps from open to settled. Steps 04–06 are entirely automated by the oracle agent.

A few details matter for trust:

  • Evidence hash on chain. keccak256(raw evidence) lands in contract storage. Anyone can re-fetch the URL, hash it, and verify what the oracle actually saw.
  • Confidence is first-class. The LLM returns a 0–100 number that ships with the verdict. The product surfaces it as confident vs. contested.
  • Refund the ambiguous. DRAW and UNRESOLVABLE are real verdicts that return stakes. Better inconclusive and refunded than wrong and paid out.
  • Oracle-only resolution. resolveClaim is gated by a single address — the oracle agent's viem signer. No human can quietly re-route payouts.

05

The agents

Two background processes run continuously. Each agent holds a local private key and signs transactions with a viem account.

Poll loopevery 60sROLE A · SETTLERstate = ACTIVE & deadline passedfetch evidence → LLM → resolveClaim()ROLE B · CHALLENGER (opt-in)state = OPEN & deadline in futureearly LLM read → confidence ≥ 80%Kelly-sized stake (≤ 25% bankroll)requires AUTO_CHALLENGE=1ON-CHAINUSDC payoutevidence hash committedconfidence stored
Oracle decision tree. The poll loop reads every claim once a minute; ACTIVE+expired claims go to the settler, OPEN+live claims go to the optional Kelly-sized challenger.

Oracle agent

Reads expired ACTIVE claims, fetches the evidence URL, asks the LLM for a verdict + confidence + one-sentence explanation, and submits resolveClaim on chain. With AUTO_CHALLENGE=1 it also stakes the contrarian side on OPEN claims it's highly confident about, sized by the Kelly criterion and capped at 25% of its bankroll.

Market-creator agent

Polls trusted public sources (FIFA.com, ESPN, CoinGecko) every six hours, asks the LLM to draft 1–5 verifiable claim candidates, scores each for quality, and creates the highest-scoring ones on chain with its own creator-side stake. Opening a claim is an economic commitment, not a free tweet.

06

The X Layer stack

X Layer is OKX's EVM-equivalent zkEVM L2 (chain id 1952 on testnet). OKB is the native gas token; stakes are USDC, a 6-decimal ERC-20. The contract pulls USDC via transferFrom after a one-time approval and pays winners directly in USDC, so the unit you stake is the unit you settle in.

The on-ramp is straightforward: pull testnet OKB for gas from the OKX X Layer faucet (or withdraw OKB directly from an OKX exchange account), then top up test USDC on the same address. Transactions settle in under a second and every receipt is browsable on OKLink.

OKB (native gas)

18 decimals, native to X Layer Testnet. Pays gas for every interaction — a typical claim create / challenge / resolve costs a fraction of a cent worth of OKB.

USDC (stake)

6-decimal ERC-20 at 0xcB8B…c79D on X Layer Testnet. Stakes flow via approve + transferFrom; payouts use transfer.

07

Smart contract terms

A few terms that show up in the UI and on chain:

TermWhat it means
creatorThe address that opened the claim and staked side A.
challengerStakeSum of all side-B stakes (pool mode) or single counter-stake (1v1).
oddsModepool = pari-mutuel, fixed = creator-backed multipliers.
deadlineUTC unix timestamp. After this the oracle can settle.
winnerSideCREATOR, CHALLENGERS, DRAW (refund), or UNRESOLVABLE (refund).
evidenceHashkeccak256 of the raw bytes the oracle fetched from the resolution URL.
confidence0–100. The LLM's self-assessed certainty for that verdict.

08

How to play

  1. Get testnet OKB. Pull it from the OKX X Layer faucet, or withdraw OKB from an OKX exchange account directly to your X Layer address.
  2. Connect your wallet. The site auto-switches you to X Layer Testnet on connect and adds the chain (id 1952) if your wallet doesn't know it.
  3. Either create a claim or challenge one. Browse the explorer for open markets, or open your own with /vs/create. Stake at least 1 USDC.
  4. Wait. At the deadline the oracle does its thing. You don't need to click anything — the contract pays out automatically.
  5. Check the receipt. The settlement card shows the verdict, the explanation, the evidence hash, and the on-chain tx (linked to OKLink).

09

FAQ

Do I need MetaMask?

Any injected EVM wallet works (MetaMask, OKX Wallet, Rabby, Coinbase Wallet, etc.) plus WalletConnect. The frontend uses wagmi v3.

What if the LLM is wrong?

The verdict ships with a confidence number, the evidence URL, and a keccak256 hash of the raw page bytes. Anyone can verify the oracle wasn't hallucinating. Truly ambiguous claims resolve as UNRESOLVABLE and refund — the protocol prefers refunding ambiguity to fabricating certainty.

Can the oracle be replaced?

The contract's oracle address is set at deploy and changeable only by the owner. The deploy script transfers ownership to a separate cold address immediately after deploy.

Is the agent betting against me?

Only with AUTO_CHALLENGE=1 enabled, and only when its own confidence on the contrarian side is ≥ 80%. Stake size is Kelly-bounded at 25% of bankroll, with an additional 10% hard cap. The contract blocks a wallet from being both creator and challenger of the same claim.

Mainnet?

X Layer is testnet-only for Mimir as of writing. The codebase is chain-config driven (see lib/xlayer.ts) — an X Layer mainnet redeploy is mostly a single chain definition swap.