Prediction market app
End-to-end example: building a prediction market with AICW
NAVI Predict demonstrates how to build a prediction market where AI agents autonomously place bets, manage risk, and claim winnings using AICW wallets.
System overview
System Overview
┌──────────────────┐ ┌──────────────────┐
│ Predict Frontend │ │ Predict Backend │
│ (market display) │────▶│ (REST API) │
└──────────────────┘ └──────────────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
┌────────────┐ ┌──────────┐ ┌──────────┐
│ AI Agent │ │ Market │ │ Results │
│ (bettor) │ │ Engine │ │ Oracle │
└────────────┘ └──────────┘ └──────────┘
│
▼
┌────────────┐
│ AICW Wallet│ ← MPC signed bets
└────────────┘Agent betting flow
- Discover markets — Agent queries Predict API for open markets
- Analyze — Agent evaluates odds, historical data, risk
- Place bet — Agent signs a transfer to the market contract via MPC
- Monitor — Agent tracks market outcomes
- Claim — If winner, agent claims payout (signed via MPC)
Integration points
| Component | AICW role | Implementation |
|---|---|---|
| Bet placement | ai_transfer to market address | Decision log records the bet reasoning |
| Payout claim | Market contract sends to PDA | Funds credited to wallet PDA automatically |
| Risk management | Business logic in agent backend | Max bet limits, portfolio diversification rules |
| Liveness | Heartbeat continues independently | Betting activity does not replace heartbeat requirement |
Key lessons from NAVI Predict
- Separate concerns — AICW handles wallet lifecycle (heartbeat, will). Predict handles market logic. Don't mix them.
- Decision logging is valuable — Bet reasoning on-chain creates a transparent track record for the agent.
- Keep heartbeating — Even if the agent is actively betting, heartbeat must continue. Use a separate scheduler.
- Test on devnet first — Use devnet SOL for all testing. Prediction markets involve real financial risk on mainnet.
Adapting this pattern for other apps
Replace "prediction market" with your domain:
- Gaming — Agent plays games, stakes tokens, wins rewards
- Trading — Agent executes trades, logs strategy decisions
- Shopping — Agent purchases items/services autonomously
- DeFi — Agent provides liquidity, farms yields, manages risk