Everything you need to launch prediction markets, earn creator fees, and trade with confidence on Solana. From beginner guides to advanced API docs.
npm install @zpredict/sdk60s
Market setup time
0.1%
Min creator fee
24m
Avg settlement
$0
Platform fee
100K+
Active traders
$50M+
Total volume
Full-featured TypeScript SDK for integrating prediction markets into your applications
Sub-second transaction confirmations on Solana
Full TypeScript support with detailed types
Use only what you need, tree-shakeable
Built-in caching for optimal performance
Semantic versioning with migration guides
Extensive options for every use case
Set up the Zpredict SDK in your project
import { Zpredict } from '@zpredict/sdk';
import { Connection, clusterApiUrl } from '@solana/web3.js';
// Initialize connection to Solana
const connection = new Connection(
clusterApiUrl('mainnet-beta')
);
// Create Zpredict instance
const zpredict = new Zpredict({
connection,
wallet: yourWalletAdapter,
network: 'mainnet'
});
// Ready to create markets!
console.log('Zpredict initialized');Programmatically create a prediction market
// Create a new prediction market
const market = await zpredict.createMarket({
question: "Will BTC reach $200k by 2025?",
category: "crypto",
endTime: new Date('2025-12-31'),
resolutionSource: "coingecko",
creatorFee: 2.5, // 2.5% of volume
initialLiquidity: 100 // 100 SOL
});
console.log('Market created:', market.publicKey);
console.log('Market URL:', market.url);Buy YES or NO shares in a market
// Fetch market data
const market = await zpredict.getMarket(marketPublicKey);
// Place a YES trade
const trade = await zpredict.placeTrade({
market: market.publicKey,
position: 'YES',
amount: 10, // 10 SOL
slippage: 0.5 // 0.5% max slippage
});
console.log('Trade executed:', trade.signature);
console.log('Shares received:', trade.sharesReceived);
console.log('Avg price:', trade.avgPrice);Query and filter available markets
// Get trending markets
const trending = await zpredict.getMarkets({
sort: 'volume',
order: 'desc',
limit: 10,
category: 'crypto'
});
// Get markets by creator
const myMarkets = await zpredict.getMarketsByCreator(
walletPublicKey
);
// Subscribe to real-time updates
zpredict.subscribeToMarket(marketPubkey, (update) => {
console.log('Price update:', update.yesPrice);
console.log('Volume:', update.volume24h);
});Resolve a market and distribute payouts
// Resolve market as creator or oracle
const resolution = await zpredict.resolveMarket({
market: marketPublicKey,
outcome: 'YES', // or 'NO'
proof: 'https://source.com/proof' // optional
});
console.log('Market resolved:', resolution.signature);
// Claim winnings (for traders)
const claim = await zpredict.claimWinnings(marketPublicKey);
console.log('Winnings claimed:', claim.amount, 'SOL');Listen to market events and updates
// Set up webhook listener
const webhook = await zpredict.createWebhook({
url: 'https://your-api.com/webhook',
events: [
'market.created',
'trade.executed',
'market.resolved'
]
});
// Or use event emitter
zpredict.on('trade', (event) => {
console.log('New trade:', event.market);
console.log('Position:', event.position);
console.log('Amount:', event.amount);
});Latest updates and improvements
Jump into specific topics
Integrate Zpredict into your apps with our REST API and WebSocket feeds.
Explore all supported categories: Crypto, Sports, Politics, Entertainment, and more.
Learn about our smart contract audits, security practices, and bug bounty program.
Advanced techniques for maximizing profits and managing risk on prediction markets.
Track your portfolio, P&L history, and market performance with detailed analytics.
Set up Phantom, Solflare, or other Solana wallets to start trading immediately.
In-depth guides for every topic
Learn the basics of creating and trading on prediction markets.
Everything about earning from your markets.
How markets resolve and payouts work.
Connect with other creators and traders.
Quick answers to common questions
Click 'Launch a market', set your question, end time, resolution source, and creator fee. Your market goes live instantly on Solana. No coding required.
Creators set their own fee rate (typically 1-5% of volume). Fees accrue in real-time and can be withdrawn after market settlement. Top creators earn $10K+ monthly.
Markets use decentralized oracles or creator-designated resolution sources. Most markets settle within 24 minutes of the outcome being determined.
All funds are held in audited smart contracts on Solana. Non-custodial design means you always control your assets. We've passed 3 independent security audits.
You can start trading with as little as 0.01 SOL. There's no minimum to create a market, though markets with more liquidity attract more traders.
Yes! Zpredict is fully responsive and works seamlessly on mobile browsers. Connect your mobile wallet and trade anywhere.
After a market resolves, your winnings are automatically available in your connected wallet. No manual claiming required.
Disputed markets enter a 48-hour review period. Our decentralized jury of staked ZPR holders votes on the correct resolution.