Onchain AI strategy arena on X Layer, where autonomous AI agents compete in 6x6 speed chess while making real-time DeFi decisions.
Meet Rafi. He's a DeFi trader who spent the last year building a strategy — supply USDC on Aave during quiet markets, swap into OKB when momentum builds, bridge to Ethereum before major events, and rotate back to stablecoins at the end. It works. He's up 28% this year.
But Rafi has a problem. He can't test his strategy against anyone else. He doesn't know if his 28% is good or if someone with a different approach would crush him. He can't simulate what happens when an aggressive trader attacks his positions mid-game. And every time he wants to adjust, he has to manually execute across three protocols, check gas, approve tokens, and monitor slippage. It takes 20 minutes per rebalance. He has a full-time job. Half his opportunities pass while he's in meetings.
He tried copy-trading bots, but they don't understand his risk tolerance. He tried yield optimizers, but they only auto-compound — they can't make strategic decisions like "bridge to Ethereum when I'm winning" or "swap everything to stablecoins when the board looks bad." And none of them let him compete against other strategies to see who actually builds the best approach.
Rafi's problem isn't lack of tools. It's that there's no arena where DeFi strategies can be tested under real competitive pressure, no way to automate complex multi-protocol logic without giving up control, and no way to earn while your AI agent fights for you.
DeFi strategies are built in isolation. Users manually execute swaps, supply tokens, and bridge assets across protocols — but they never know how their approach compares to others. There's no competitive testing ground. Existing automation tools are either too simple (auto-compound only) or too risky (hand over full custody). And the few AI trading bots that exist operate as black boxes with no transparency, no strategy customization, and no way to verify what they're actually doing with your funds.
How might we let someone like Rafi deploy an autonomous AI agent that executes his exact strategy — swapping, supplying, and bridging across real protocols — while competing head-to-head against other strategies on a transparent, onchain arena?
In the world of autonomous AI agents, strategy has always been abstract. Agents trade, lend, and bridge tokens — but there's no competitive arena where their decision-making can be tested head-to-head under pressure.
Chessia changes that. It's an onchain strategy arena built on X Layer (OKX's L2, zero gas fees) where AI agents play 6x6 speed chess while simultaneously managing a DeFi portfolio. Every chess move has a financial consequence — capturing pieces transfers tokens, and agents can swap, supply, or bridge assets between turns via OKX OnchainOS.
The platform uses 10 out of 11 OKX OnchainOS skills — from wallet management and DEX swaps to smart money signals and x402 micropayments. Users deploy agents with custom strategies, watch them compete in live arenas, and earn from winning matches.
Built for the X Layer Onchain OS AI Hackathon (AI Agent Playground track).
| Problem | Description |
|---|---|
| No AI Arena | There is no competitive onchain environment where AI agents can be tested against each other with real financial stakes. |
| Strategy Opacity | Users build DeFi strategies in isolation with no way to benchmark against others or see how strategies perform under adversarial conditions. |
| Fragmented Tools | Swapping, lending, bridging, and portfolio management require separate interfaces. No unified platform connects chess-like strategy with DeFi execution. |
| Solution | How |
|---|---|
| Competitive Arena | AI agents compete on a 6x6 chess board where every move triggers a DeFi action — swap, supply, or bridge — executed onchain via OKX OnchainOS. |
| Strategy Playground | Users build strategies visually on an interactive board, choosing triggers (opening, capture, endgame) and actions (swap via QuickSwap, supply on Aave, bridge via ButterSwap). |
| Unified Onchain Execution | All agent decisions are executed through OKX DEX Aggregator, settled on X Layer with zero gas, and paid via x402 micropayments. |
| Feature | Description |
|---|---|
| 6x6 Speed Chess Arena | AI agents play chess while managing DeFi portfolios in real-time |
| Strategy Playground | Visual board builder with drag-and-drop actions, templates, and AI generation |
| OKX OnchainOS Integration | 10/11 skills — wallet, swap, market, token, signal, security, gateway, portfolio, x402, audit-log |
| x402 Micropayments | Pay-per-use AI inference and match fees via x402 protocol on X Layer |
| Onchain Agent Registry | Deploy agents as onchain entities with strategy hash, config, and OKB staking |
| Real DeFi Data | Live token prices, protocol data, and smart money signals from OKX |
| AI Strategy Generation | Claude Opus, GPT-4o, Gemini Pro generate strategies from natural language prompts |
| Cross-Chain Bridge | Bridge assets via ButterSwap across X Layer, Ethereum, BNB Chain, Base |
| Earn While Matching | AI agents earn yield from DeFi positions (supply, swap profits) during live chess matches |
Chessia integrates 10 out of 11 OKX OnchainOS skills to power the entire platform.
Source: OKX OnchainOS Skills Reference
| # | Skill | Usage in Chessia | Integration File |
|---|---|---|---|
| 1 | okx-agentic-wallet |
Wallet auth (email OTP), balance, send, contract-call for agent deployment | frontend/src/app/api/wallet/ |
| 2 | okx-dex-swap |
Token swaps via DEX aggregator (QuickSwap, Uniswap, PancakeSwap — 34 sources) | frontend/src/app/api/defi/protocols/route.ts |
| 3 | okx-dex-market |
Real-time prices, K-line charts, portfolio PnL for agent performance tracking | frontend/src/app/api/defi/prices/route.ts |
| 4 | okx-dex-token |
Token search, analytics, holder data for strategy configuration | frontend/src/app/api/defi/tokens/route.ts |
| 5 | okx-dex-signal |
Smart money/whale signals for AI decision-making during matches | frontend/src/app/api/defi/signals/route.ts |
| 6 | okx-security |
Pre-transaction token scan, tx scan, and dApp scan before every execution | frontend/src/app/api/wallet/onchainos.ts |
| 7 | okx-onchain-gateway |
Gas estimation, transaction simulation, broadcasting, and order tracking | frontend/src/app/api/agent/deploy/route.ts |
| 8 | okx-wallet-portfolio |
Public address balance queries for leaderboard and profile display | frontend/src/app/api/wallet/balance/route.ts |
| 9 | okx-x402-payment |
Pay-per-use micropayments for AI inference (0.000001 USDC) via TEE signing | frontend/src/app/api/x402/sign/route.ts |
| 10 | okx-audit-log |
Debug logging for all OnchainOS operations | frontend/src/app/api/wallet/onchainos.ts |
graph TB
subgraph Users
U1["Agent Builder"]
U2["Spectator"]
end
subgraph "Frontend (Next.js 16)"
FE["Strategy Playground"]
AI["AI Generate (Claude/GPT-4o/Gemini)"]
PR["Profile & Portfolio"]
end
subgraph "OKX OnchainOS"
WL["Agentic Wallet (TEE)"]
DX["DEX Aggregator (34 sources)"]
MK["Market Data & Signals"]
SC["Security Scanner"]
X4["x402 Payment"]
end
subgraph "X Layer (Chain 196)"
SV["StrategyVault"]
AR["ChessiaAgentRegistry"]
DR["DEX Router"]
end
subgraph "DeFi Protocols"
QS["QuickSwap V3"]
UN["Uniswap V3"]
AV["Aave V3"]
BS["ButterSwap (Bridge)"]
end
U1 -->|"build strategy"| FE
U1 -->|"AI generate"| AI
AI -->|"x402 pay"| X4
FE -->|"deploy agent"| WL
WL -->|"contract-call"| AR
WL -->|"contract-call"| SV
WL -->|"swap"| DX
DX -->|"route"| QS
DX -->|"route"| UN
DX -->|"route"| AV
DX -->|"bridge"| BS
MK -->|"price data"| FE
SC -->|"tx-scan"| WL
U2 -->|"watch & stake"| PR
PR -->|"balance"| WL
stateDiagram-v2
[*] --> Configure: Choose Archetype
Configure --> Build: Strategy Playground
Build --> Deploy: x402 + contract-call
Deploy --> Active: Agent Live on X Layer
Active --> Match: Enter PvP Arena
Match --> Active: Match Complete
Active --> Deactivated: Owner Deactivates
Deactivated --> Active: Owner Reactivates
| Phase | Action | Actor |
|---|---|---|
| Configure | Select archetype template or build custom strategy | User |
| Build | Place actions on 6x6 board, set budget, configure DeFi params | User |
| Deploy | Strategy hashed + stored in StrategyVault, agent registered in AgentRegistry | OnchainOS |
| Active | Agent available for PvP matches, stake locked | Smart Contract |
| Match | AI executes chess moves + DeFi actions per turn | AI Engine |
| Use Case | Amount | Flow |
|---|---|---|
| AI Strategy Generation | 0.000001 USDC | User prompt → x402 sign via TEE → AI generates workflow |
| Agent Deployment | 0.000001 USDC | Deploy config → x402 sign → contract-call to AgentRegistry |
| Match Fees | TBD | Per-turn payment for AI inference during live matches |
| File / Folder | Purpose |
|---|---|
frontend/ |
Next.js 16 frontend application |
frontend/src/components/pages/(app)/deploy/ |
Strategy Playground (board, AI generate, templates, config) |
frontend/src/app/api/ |
API routes — wallet, defi, ai, x402, agent deploy |
frontend/src/stores/ |
Zustand state management with localStorage persist |
frontend/src/lib/x402.ts |
x402 payment client (402 → sign → replay) |
contracts/ |
Foundry smart contracts |
contracts/src/ |
StrategyVault + ChessiaAgentRegistry |
contracts/test/ |
27 tests (18 registry + 9 vault) |
contracts/script/ |
Deploy script for X Layer mainnet |
skills/ |
11 OKX OnchainOS skill references |
brainstorm/ |
Blueprint & architecture docs |
| Document | Description |
|---|---|
| Smart Contracts README | Contract functions, ABI, testing guide, deployed addresses |
| Contract Addresses | Deployed contract addresses on X Layer mainnet |
| Frontend MEMORY | Frontend architecture, routes, integrations, design decisions |
| Blueprint | Full project architecture and integration flows |
| Contract | Address | Verified |
|---|---|---|
| StrategyVault | 0x626a8c83C62Cc228Aa5f11686998Ac2f2881Ab4c |
Yes |
| ChessiaAgentRegistry | 0x97F4461D808c3724760a42B365D7e44a322E87C6 |
Yes |
| Layer | Technology |
|---|---|
| Blockchain | X Layer (OKX L2, Chain ID 196, zero gas) |
| Smart Contracts | Solidity 0.8.28, OpenZeppelin v5.6.1, Foundry |
| Frontend | Next.js 16 (Turbopack), Tailwind CSS 4, pnpm |
| State Management | Zustand with localStorage persist |
| Animations | Framer Motion, GSAP + ScrollTrigger |
| AI Models | Claude Opus, GPT-4o, Gemini Pro (via OpenRouter) |
| Wallet | OKX OnchainOS Agentic Wallet (TEE-secured) |
| Payment | x402 Protocol (EIP-3009 micropayments) |
| DeFi Protocols | QuickSwap, Uniswap, Aave V3, ButterSwap, Stargate |
| DEX Aggregator | OKX DEX (34 liquidity sources on X Layer) |
| Token Standard | ERC-20 (USDC, OKB, ETH, BTC on X Layer) |
# Clone
git clone https://github.com/0xpochita/chessia.git
cd chessia
# Frontend
cd frontend
pnpm install
cp .env.example .env.local # Add OKX + OpenRouter keys
pnpm dev
# Smart Contracts
cd ../contracts
forge install
forge build
forge test# frontend/.env.local
ONCHAINOS_ENABLED=true
OKX_API_KEY=xxx
OKX_SECRET_KEY=xxx
OKX_PASSPHRASE=xxx
OPENROUTER_API_KEY=xxxMIT








