Inspiration

Please access additional materials here : https://drive.google.com/drive/folders/13buFfMa1sCWbwODAGpcmxLY0MROCvaup?usp=sharing

Prediction markets are powerful tools for aggregating collective knowledge, but they're too slow and cumbersome. Creating a market requires legal setup, market-making infrastructure, and weeks of preparation. We asked: what if anyone could create a prediction market instantly from a tweet?

We were inspired by:

  • Polymarket's success in accurately predicting events through crowd wisdom
  • X402 Payment Protocol enabling frictionless crypto payments without wallet management
  • AI agents that can understand context and verify outcomes automatically
  • The idea that every opinion on Twitter deserves a market

What it does

Instant Markets is a decentralized prediction market platform that lets you:

  1. Create markets from anything - Paste a tweet, news article, or custom question and our AI agent generates a binary prediction market in seconds
  2. Share bet links on Twitter - Generate X402 payment links that let anyone bet with one click, no wallet setup required
  3. Auto-resolve with AI - AI agents monitor real-world data and automatically resolve markets when outcomes are clear
  4. Trade with USDC - All bets are placed in USDC on Base Sepolia using Coinbase Smart Wallets
  5. Zero gas fees - CDP Paymaster sponsors 100% of transaction costs

Key Features:

  • 🤖 AI-powered market generation from any content
  • 💰 X402 one-click betting (no wallet setup needed)
  • 🔍 AI agent resolution with transparent reasoning
  • ⚡ Built on Base (fast, cheap transactions)
  • 🐦 Twitter integration for viral market sharing
  • 💵 USDC-based betting with Circle faucet integration
  • ⛽ 100% gasless - all transactions sponsored

How we built it

Tech Stack:

  • Frontend: React + TypeScript + Vite, Coinbase CDP Hooks for smart wallet integration, Viem for blockchain interactions
  • Backend: Node.js + Express + TypeScript, Better-SQLite3 for bet tracking, Ethers.js for blockchain interactions, OpenAI GPT-4 for market generation and resolution, Tavily for web research
  • Smart Contracts: Solidity contracts deployed on Base Sepolia (MarketFactory: 0xc5f3Ec968504c702bc95a0888bFF344D66332D2e)
  • Blockchain: Base Sepolia testnet, Circle USDC integration, CDP Paymaster for gas sponsorship

Architecture:

  1. Market Creation Flow: User provides content → AI agent extracts key claim and generates binary question → Smart contract creates market with AMM liquidity pool → Market is immediately tradeable

  2. Twitter Betting Flow (X402): User clicks Twitter bet link → Backend returns 402 Payment Required with X-Payment headers → Frontend detects 402 and extracts payment details → CDP Smart Account batches USDC approval + placeBet transaction → Paymaster sponsors gas → Backend verifies payment and confirms bet

  3. AI Resolution Flow: Resolution worker polls pending markets → AI agent researches outcome using Tavily web search → Provides reasoning and confidence score (>85% for auto-resolution) → Creator or admin can trigger resolution → Winners can claim funds + fees

Key Technologies:

  • Coinbase Smart Wallets - Email-based wallet creation with passkey auth, no seed phrases
  • X402 Protocol - Custom HTTP 402 status code implementation for crypto payments
  • Base Sepolia - L2 for fast, cheap transactions
  • Circle USDC - Stable currency with testnet faucet integration
  • Polymarket MCP - Real-time market intelligence via Model Context Protocol
  • OpenAI GPT-4 - Market generation and resolution analysis
  • Tavily Search API - Web research for market resolution

Challenges we ran into

  1. X402 Protocol Implementation - Browsers don't natively understand 402 Payment Required status codes. We built a custom frontend client that detects 402 responses, extracts payment headers (X-Payment-Token, X-Payment-Amount, X-Payment-Recipient, X-Payment-Data), and triggers the CDP wallet popup with batched transactions.

  2. Database Path Synchronization - TypeScript source (ts-node) and compiled JavaScript used different database paths, causing bet links to fail with "bet not found" errors. Fixed by standardizing on dist/db/database.sqlite path in all scripts.

  3. Batch Transactions - Needed to approve USDC and place bet in a single user action. Solved using CDP's batch transaction feature with two calls: USDC approval + placeBet, both sponsored by Paymaster.

  4. AI Resolution Reliability - AI sometimes lacks current information or makes incorrect calls. Added confidence scoring (must be >85% for auto-resolution), manual override capability, and transparent reasoning display to maintain trust.

  5. Gasless UX - Required CDP Paymaster integration across all transactions (market creation, betting, retracting stakes, claiming winnings, claiming creator fees). Successfully achieved 100% gas sponsorship.

Accomplishments that we're proud of

  1. End-to-End X402 Implementation - Built one of the first working X402 payment flows for crypto betting directly from Twitter links
  2. AI Market Generation - Our AI agent can extract meaningful predictions from any content and generate fair market questions in seconds
  3. Sub-second Market Creation - Users can create markets in under 1 second, vs weeks for traditional prediction markets
  4. Smart Wallet UX - Users can bet with just an email and passkey, no crypto knowledge required
  5. Automated AI Resolution - Successfully resolved test markets with transparent reasoning and confidence scoring
  6. 100% Gasless Experience - Every transaction sponsored by CDP Paymaster, removing all friction
  7. Polymarket MCP Integration - First prediction market platform to integrate Polymarket intelligence via Model Context Protocol
  8. Circle USDC Integration - Seamless faucet integration providing instant testnet USDC

What we learned

Technical Learnings:

  • X402 needs client-side handling - The protocol is elegant, but browsers need native support or wallet extensions for mainstream adoption
  • AI agents need guardrails - GPT-4 is great at understanding context but needs confidence thresholds and human oversight for high-stakes decisions
  • Base Sepolia is fast - Transactions confirm in ~2 seconds, making the UX feel instant
  • CDP is production-ready - Smart wallets, Paymaster, and hooks "just work" and abstract away complexity
  • SQLite for prototypes - Better-SQLite3 made it trivial to add Twitter bet tracking without full database setup
  • MCP is powerful - Model Context Protocol enabled seamless Polymarket integration for market intelligence

Product Learnings:

  • Friction kills adoption - Every extra click in the betting flow dramatically reduces conversion. X402 + Smart Wallets remove all friction.
  • Viral mechanics matter - Twitter integration is key to discovery and growth
  • Trust requires transparency - Users want to see WHY an AI resolved a market a certain way (sources, confidence, reasoning)
  • Liquidity is critical - Markets need instant trading or users won't participate
  • Speed is a feature - Instant market creation is a competitive advantage vs traditional platforms
  • Gas fees are a barrier - 100% sponsorship via Paymaster essential for Web2-like UX

What's next for Instant Markets

Short-term (1-3 months):

  • Deploy to Base mainnet with real USDC
  • Launch production Twitter bot with automated market posting
  • Mobile app with push notifications for market updates
  • Social features: leaderboards, user profiles, following traders
  • Specialized AI agents for sports, politics, crypto, and weather predictions
  • Enhanced AMM with LMSR market maker for better pricing

Medium-term (3-6 months):

  • Conditional markets ("If X happens, will Y happen?")
  • Multi-outcome markets beyond binary yes/no
  • Market bundles (portfolios of related markets)
  • AI trading strategies (agents trade on behalf of users)
  • Creator economy with revenue sharing for popular market creators
  • Direct Twitter API integration for automated bot replies

Long-term (6+ months):

  • Cross-chain support (Arbitrum, Optimism, Polygon)
  • Fiat on-ramps via Coinbase Commerce (credit card betting)
  • Decentralized resolution with reputation-weighted voting
  • AI-powered market discovery feed
  • X402 SDK for third-party developers
  • Regulatory compliance for real-money markets in US

Vision:

Make prediction markets as ubiquitous as polls. Every tweet, every debate, every claim should have a market where people can put their money where their mouth is. This creates:

  • Better information - Markets aggregate knowledge better than any expert
  • Accountability - Public figures face real consequences for false claims
  • Entertainment - Trading on outcomes is more engaging than passive scrolling
  • Economic opportunity - Good forecasters can earn real returns

Instant Markets is building the infrastructure to make this vision real, one click at a time.

Built With

Share this project:

Updates