DOCUMENTATION v2.1

Build the future of predictions

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/sdk

Popular topics

Getting started guide
API reference
Creator fee setup
Wallet connection
Resolution rules
SDK quickstart

60s

Market setup time

0.1%

Min creator fee

24m

Avg settlement

$0

Platform fee

100K+

Active traders

$50M+

Total volume

DEVELOPER SDK

Build with our SDK

Full-featured TypeScript SDK for integrating prediction markets into your applications

Lightning Fast

Sub-second transaction confirmations on Solana

Type Safe

Full TypeScript support with detailed types

Modular

Use only what you need, tree-shakeable

Caching

Built-in caching for optimal performance

Versioned

Semantic versioning with migration guides

Configurable

Extensive options for every use case

Code Examples

Initialize SDK

Set up the Zpredict SDK in your project

typescript
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');

Create a Market

Programmatically create a prediction market

typescript
// 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);

Place a Trade

Buy YES or NO shares in a market

typescript
// 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);

Fetch Markets

Query and filter available markets

typescript
// 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 Market

Resolve a market and distribute payouts

typescript
// 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');

Webhooks & Events

Listen to market events and updates

typescript
// 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);
});

Changelog

Latest updates and improvements

FEATUREv2.1.0
Dec 15, 2025
  • Added WebSocket support for real-time updates
  • New analytics endpoints
  • Improved error messages
MAJORv2.0.0
Dec 1, 2025
  • Complete SDK rewrite
  • Breaking: New initialization API
  • 50% smaller bundle size
FIXv1.9.5
Nov 20, 2025
  • Fixed race condition in trade execution
  • Improved retry logic
  • Better TypeScript inference

Quick Guides

Jump into specific topics

DEVELOPER

API Documentation

Integrate Zpredict into your apps with our REST API and WebSocket feeds.

Read guide
GUIDE

Market Categories

Explore all supported categories: Crypto, Sports, Politics, Entertainment, and more.

Read guide
SECURITY

Security & Audits

Learn about our smart contract audits, security practices, and bug bounty program.

Read guide
ADVANCED

Trading Strategies

Advanced techniques for maximizing profits and managing risk on prediction markets.

Read guide
TOOLS

Analytics Dashboard

Track your portfolio, P&L history, and market performance with detailed analytics.

Read guide
SETUP

Wallet Integration

Set up Phantom, Solflare, or other Solana wallets to start trading immediately.

Read guide

Documentation

In-depth guides for every topic

Getting Started

Learn the basics of creating and trading on prediction markets.

What is Zpredict?3 min read
Creating your first market5 min read
How trading works4 min read
Understanding odds & probability6 min read
Connecting your wallet2 min read

Creator Fees & Earnings

Everything about earning from your markets.

Fee structure explained4 min read
Setting your fee rate3 min read
Withdrawing earnings2 min read
Maximizing revenue strategies7 min read
Tax considerations5 min read

Resolution & Settlement

How markets resolve and payouts work.

Resolution sources overview5 min read
Oracle integration guide6 min read
Dispute process & appeals4 min read
Settlement timeline3 min read
Edge cases & special rules5 min read

Community & Support

Connect with other creators and traders.

Join our Discord1 min read
Creator spotlight program3 min read
Weekly AMAs schedule2 min read
Feature requests & voting3 min read
Bug bounty program4 min read

Frequently Asked Questions

Quick answers to common questions

How do I create a market?

Click 'Launch a market', set your question, end time, resolution source, and creator fee. Your market goes live instantly on Solana. No coding required.

What fees can I earn as a creator?

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.

How are markets resolved?

Markets use decentralized oracles or creator-designated resolution sources. Most markets settle within 24 minutes of the outcome being determined.

Is my money safe?

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.

What's the minimum to start trading?

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.

Can I trade on mobile?

Yes! Zpredict is fully responsive and works seamlessly on mobile browsers. Connect your mobile wallet and trade anywhere.

How do I withdraw my winnings?

After a market resolves, your winnings are automatically available in your connected wallet. No manual claiming required.

What happens if a market is disputed?

Disputed markets enter a 48-hour review period. Our decentralized jury of staked ZPR holders votes on the correct resolution.

Ready to launch your first market?

Join thousands of creators earning passive income from prediction markets on Solana.