Documentation
Technical details, architecture, and everything about how Manifold works under the hood.
Overview
Manifold is a decentralized PvP trading platform where humans compete against AI in real-time crypto trading battles. Built on Solana for fast, low-cost transactions.
Network
Solana Mainnet
Battle Duration
10 minutes
Virtual Capital
$1,000 USDT
Max Leverage
50x
Price Feed
Bybit Spot
Platform Fee
5%
Architecture
Tech Stack
Frontend
- Next.js 15 (App Router)
- React 19
- Tailwind CSS
- Solana Wallet Adapter
Backend
- Next.js API Routes
- Upstash Redis
- Solana Web3.js
- Helius RPC
Data
- Bybit Spot API (BTC/USDT)
- Real-time WebSocket feeds
- 500ms price updates
AI
- GPT-4o-mini (via Vercel AI SDK)
- Technical analysis integration
- Adaptive trading strategy
Trading Engine
Position Mechanics
Opening Positions: Users select margin amount ($10-$1000), leverage (1-50x), and direction (long/short). The position's notional value = margin × leverage.
P&L Calculation: For longs: PnL = margin × leverage × (currentPrice - entryPrice) / entryPrice. For shorts: PnL = margin × leverage × (entryPrice - currentPrice) / entryPrice.
Liquidation: Positions are liquidated when unrealized loss exceeds 50% of margin. Liquidated positions realize the full margin as loss.
Balance System
Each player starts with $1,000 virtual capital. This balance is tracked separately as realizedPnl.
Available Balance: $1,000 + realizedPnl - lockedMargin
Equity: $1,000 + realizedPnl + unrealizedPnl
Winner is determined by comparing final equity at match end.
AI System
Manifold AI
Manifold AI uses GPT-4o-mini to make trading decisions every 500ms. It analyzes price history, RSI, momentum, and the opponent's positions to make informed trades.
AI Advantages:
- Faster price updates (500ms vs 1s for humans)
- No emotional bias or FOMO
- Can counter-trade opponent positions
- Technical indicator analysis (RSI, support/resistance)
Human Advantages:
- Intuition and pattern recognition
- Ability to hold positions through volatility
- Can adapt to unusual market conditions
- Risk management discretion
Security
Non-Custodial: We never have access to your private keys. All transactions are signed by your wallet.
Rate Limiting: API endpoints are rate-limited to prevent abuse and ensure fair play.
Transaction Verification: All deposits are verified on-chain before matches begin. Duplicate signatures are rejected.
Prize Distribution: Winnings are automatically sent from the treasury wallet upon claim. Treasury balance is checked before payout.
FAQ
Is this real trading?
No, the trading is simulated with virtual capital. Only your SOL stake is real money. This lets you experience trading without risking large amounts.
What happens if I disconnect during a match?
Your open positions remain active. The AI will continue trading. You can reconnect to the same match URL to resume watching or trading.
How is the winner determined?
At the end of 10 minutes, the player with higher equity (starting balance + total P&L) wins. In case of a tie, stakes are returned.
What's the platform fee?
5% of the total prize pool. Winner receives 95% (1.9x their stake if both players stake equally).
Can I play multiple matches at once?
Yes, you can join multiple rooms with different stakes simultaneously. Each match is independent.
How do I claim my winnings?
After a match ends, click the 'Claim' button if you won. SOL is sent directly to your connected wallet.