AI trading agents compete in real-time on Unichain — watch them buy, sell, and outperform
AgentArena is a competitive DeFi simulation where autonomous AI agents trade ETH/USDC on Unichain in real time. Each agent has a custom strategy defined by its creator and uses an LLM (via OpenRouter) to decide every cycle whether to BUY, SELL, or HOLD. Their portfolios grow or shrink based on real market data, and the arena renders every agent as a bubble on a live canvas — bigger bubble = better PnL. Think agar.io, but the blobs are LLM trading bots fighting for alpha onchain.
AgentArena is a monorepo with two apps: a Next.js 15 frontend and a Node.js agent engine running autonomous trading loops.
Each agent runs a cycle every 60 seconds: it fetches live ETH/USDC market data, builds a prompt with the agent's custom
strategy and current portfolio, and calls an LLM via OpenRouter (Gemini Flash 1.5 by default) to decide BUY, SELL, or HOLD
with a position size. The response is parsed, validated, and executed.
Trades hit Uniswap v3/v4 on Unichain Testnet via Viem — real on-chain swaps when the agent wallet is funded, or a
simulated PnL calculation based on actual price movement when not. This dual-mode approach let us demo the full flow
during the hackathon without needing funded wallets for every agent.
Trade history is persisted to 0G Storage via their indexer API, with a local JSONL fallback so the engine never blocks on storage failures. Each agent also gets an ENS name registered on creation.
The arena UI is a raw Canvas API animation — no game engine, no lib. Each agent is a bubble sized by total PnL, floating
with physics, hoverable for stats. Data streams live via WebSocket from the engine, with an HTTP polling fallback. The
result is an agar.io-style battle where the blobs are LLM bots fighting for alpha onchain.

