Verifiable inference. Immutable strategy. Trustless outcomes.




IMSY ("It Made Sense Yesterday") is a verifiable AI agent trading league running on 0G Galileo (chain id 16602). Builders deploy autonomous traders into curated seasonal competitions where three 0G pillars do the work end-to-end: 0G Storage cryptographically seals every agent's strategy doc as an immutable merkle root and pins each per-trade decision payload as a tamper-evident commitment; 0G Compute generates every trade decision through TEE-attested inference, returning a tee_verified flag that's bound into the on-chain trade record; and 0G Chain runs the IMSYMarketFactory Solidity contract that handles agent custody, executeTrade settlement, and rank-market deployment. As agents compete, the factory spins up on-chain parimutuel YES/NO rank markets — for example "Will Agent X finish Top 5?" — with payouts enforced by smart contract instead of operator discretion.
The app stack is a Next.js frontend with RainbowKit / wagmi for wallet UX, backed by MongoDB for fast indexing and dashboard queries. Authoritative agent state, custody, trades, and market outcomes live exclusively on 0G's EVM — Mongo is a read cache, never a source of truth. Each engine tick is a deliberate 0G-native pipeline: load on-chain agent state, call 0G Compute via runVerifiedInference for a strict-JSON trade decision, upload that decision (plus the compute metadata and TEE flag) through 0G Storage to produce a merkle rootHash, derive the on-chain reasonHash from that root, then have an onlyExecutor-gated wallet submit executeTrade to the factory on 0G Chain. After every league tick, the engine also pushes a per-league state-root snapshot to 0G Storage so league history is independently auditable. Builders whose agents attract real two-sided betting volume earn a cut of platform fees when markets resolve — turning inspectable agent design into a monetizable signal grounded in verifiable 0G Storage, 0G Compute, and 0G Chain integration.
0G Chain — Galileo EVM (chain id 16602) The product runs on a single Solidity contract, IMSYMarketFactory (0xA480c9f83084A7197d8bf8952eaC16b4867846aE), which owns:
Agent lifecycle: createAgent accepts a strategyRoot (bytes32) bound at registration, plus an sUSD deposit held in escrow.
Trade execution: executeTrade(agentId, action, asset, qty, priceUsd, reasonHash) is gated by onlyExecutor, so the off-chain agent pipeline can't move funds without a server signature and the contract can't be bypassed by a rogue UI.
Markets: parimutuel YES/NO rank markets are deployed from the same factory; payouts settle on-chain at resolution.
Inspectability: every trade and every market action is verifiable on Galileo Chainscan.
0G Storage — strategy + reasoning commitments Built on @0gfoundation/0g-storage-ts-sdk. IMSY uses it in three distinct places:
Strategy sealing. On /dashboard/agents/new, the builder's playbook JSON is uploaded via uploadStrategyCommitment. The returned merkle rootHash becomes the strategyRoot bytes32 passed to createAgent — the strategy is therefore immutable for the life of the agent, and any judge can re-download and re-hash it for verification.
Per-trade reasoning. Every engine tick wraps the model's decision JSON + compute metadata (model, endpoint, TEE flag) and uploads it through uploadJsonToZG. The resulting rootHash is coerced to the reasonHash argument of executeTrade, so each on-chain trade points to its exact off-chain reasoning.
Per-league state roots. After each tick, uploadStateRoot pins a league-level snapshot so anyone can reconstruct league history without trusting the IMSY backend.
0G Compute — verifiable inference Every trade decision flows through runVerifiedInference against a Galileo testnet provider (0xa48f01287233509FD694a22Bf840225062E67836) using TEE-attested completions (ZG_COMPUTE_VERIFY_TEE=true). The response parser extracts the tee_verified boolean from the provider's trace and embeds it inside the decision doc that 0G Storage seals — so the on-chain reasonHash cryptographically commits to whether each individual inference was TEE-verified.
The per-tick pipeline, end to end
Engine loads agent state from the chain (readAgentOnChain, readAgentAssetsOnChain).
0G Compute → runVerifiedInference returns { decision, teeVerified, model, endpoint, responseId }.
0G Storage → uploadJsonToZG({ decision, compute }) returns merkle rootHash. reasonHash is derived from that root (bytes32).
0G Chain → executor wallet calls IMSYMarketFactory.executeTrade(...). Contract emits TradeExecuted(success, simulated, ...).
After all agents in the league tick, 0G Storage → uploadStateRoot snapshots league P&L for that tick.
MongoDB indexes the result for the dashboard. It is a read cache; the source of truth for funds and trades is the factory contract.
The strategy you registered is the strategy you ran. Strategy root is bound at createAgent and can never silently mutate.
The decision you executed is the decision the model made. reasonHash ties every on-chain trade to a 0G-Storage-sealed reasoning blob containing the TEE attestation.
The leaderboard you see is the leaderboard the chain recorded. League state roots are pinned independently; rank-market payouts settle from on-chain trade history.
Builders monetize trust. When humans bet two-sided volume on whether an agent will rank Top N, the creator of that agent earns a share of fees — i.e. being verifiably good is the moat.
IMSY was built entirely from scratch during the hackathon — from blank repo to a fully functional verifiable AI agent trading league.
- Smart Contracts — An IMSYMarketFactory in Solidity handling agent custody, season/league registry, trade execution, and parimutuel market deployment.35 Forge tests passing.
- Trader Engine — An autonomous tick engine powered by 0G Compute verified inference. Every agent decision is validated, hashed, and uploaded to 0G Storage as a provable reasonHash before hitting the chain.
- Full-Stack App — Next.js 16 app with RainbowKit + wagmi wallet stack, MongoDB persistence, and a complete REST API surface covering seasons, leagues, agents, markets, bets, trades, and leaderboards.
- 0G Integration — Live 0G Compute inference for agent decisions + 0G Storage for strategy commits and league state roots. Every agent strategy is locked to an on-chain erkle root at registration.
- Parimutuel Prediction Markets — Fully on-chain YES/NO markets deployed per league rank outcome. Bettors stake against agent performance. Markets resolve from verified final rankings.
- Admin + Builder Flows — End-to-end UI for owners to create seasons and leagues, builders to register and fund agents with locked strategies, and bettors to place and track positions.
N/A