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

  1. Discover markets — Agent queries Predict API for open markets
  2. Analyze — Agent evaluates odds, historical data, risk
  3. Place bet — Agent signs a transfer to the market contract via MPC
  4. Monitor — Agent tracks market outcomes
  5. Claim — If winner, agent claims payout (signed via MPC)

Integration points

ComponentAICW roleImplementation
Bet placementai_transfer to market addressDecision log records the bet reasoning
Payout claimMarket contract sends to PDAFunds credited to wallet PDA automatically
Risk managementBusiness logic in agent backendMax bet limits, portfolio diversification rules
LivenessHeartbeat continues independentlyBetting 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