pnp-markets-solana
Create, trade, and settle permissionless prediction markets on Solana
Install / Use
npx skills add internet-court/internet-court-skill --skill pnp-solanaInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
OperationsSupported Platforms
Tags
Our assessment of pnp-markets-solana
pnp-markets-solana scores 84/100 on our quality scale, 234th of 339 Operations skills we index.
Its SKILL.md is 29 KB long, well organised into 54 sections with 33 code examples: a thorough specification that gives an agent plenty to work with.
With 6,129 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 38 days ago, so pnp-markets-solana is actively maintained.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
pnp-markets-solana compared with similar skills
All 4 of these similar skills score higher than pnp-markets-solana; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| pnp-markets-solana (this skill)by internet-court | 84 | 6.1k | 38d ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 4d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 4d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 130.2k | 5d ago | SKILL.md |
| ui-ux-pro-maxby nextlevelbuilder | 100 | 130.2k | 5d ago | SKILL.md |
Frequently asked questions
- How do I install pnp-markets-solana?
- Run
npx skills add internet-court/internet-court-skill --skill pnp-markets-solana. The install tabs above show the steps for each supported agent. - Which AI agents does pnp-markets-solana work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is pnp-markets-solana safe to use?
- It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is pnp-markets-solana still maintained?
- The repository was last updated 38 days ago, so pnp-markets-solana is actively maintained.
Skill content
View source on GitHubname: pnp-markets-solana description: Create, trade, and settle permissionless prediction markets on Solana. Use when building prediction market infrastructure, creating social media markets (Twitter/YouTube/DeFiLlama), setting up custom oracle resolution, P2P betting, or autonomous agent-driven forecasting. Supports V2 AMM, P2P (V3), and custom oracle markets with any SPL token collateral (including Token-2022). license: MIT metadata: author: pnp-protocol version: "2.0.0" tags:
- solana
- prediction-markets
- oracle
- betting
- forecast
- market-making
- autonomous-agents
- p2p-markets
- social-media
- defi
- info-finance compatibility: Requires Node.js 18+, Solana RPC endpoint (mainnet or devnet), funded wallet with SOL for transaction fees, and any SPL token (including Token-2022) as collateral
PNP Markets (Solana)
Create and manage prediction markets on Solana with any SPL token collateral. Supports V2 AMM markets, P2P direct bets, custom oracle resolution for AI agents, and social media markets (Twitter, YouTube, DeFiLlama).
When to Use This Skill
Use when the user wants to:
- Create prediction markets on Solana (V2 AMM, P2P, or custom oracle)
- Trade on markets (buy/sell YES/NO outcome tokens)
- Settle markets as an oracle after the trading period ends
- Redeem winning positions after settlement
- Create social media markets (Twitter engagement, YouTube views, DeFiLlama metrics)
- Use custom tokens as prediction market collateral (any SPL token including Token-2022)
- Build autonomous AI agents that create, trade, and resolve markets
- Build info finance infrastructure using market prices as probability signals
Triggers: prediction market, betting, oracle, settlement, forecast, YES/NO, outcome token, market resolution, P2P bet, custom oracle, social media market, autonomous market, info finance, market creation, prediction, wager, binary outcome
Do not use when:
- The task is generic Solana wallet operations (use solana-dev-skill instead)
- The task is token swaps/DEX trading without prediction markets (use jupiter-skill)
- The task is NFT-related (use metaplex-foundation/skill)
- The task is about other prediction market protocols (use their specific skill)
Program IDs & Core Constants
| Item | Address | Notes |
|------|---------|-------|
| PNP Program (Mainnet) | 8PyE2dizL52ga7ytqLtqRyjwWp4yXEx8M5Z4BAHgHuTb | Main prediction market program |
| PNP Program (Devnet) | pnpkv2qnh4bfpGvTugGDSEhvZC7DP4pVxTuDykV3BGz | Devnet testing program |
| USDC Mint | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v | Common collateral (6 decimals) |
| USDT Mint | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB | Alternative stable (6 decimals) |
| WSOL Mint | So11111111111111111111111111111111111111112 | Wrapped SOL (9 decimals) |
Precision Reference
| Token Type | Decimals | Example |
|-----------|----------|---------|
| USDC / USDT | 6 | 1 USDC = 1_000_000n |
| SOL (wrapped) | 9 | 1 SOL = 1_000_000_000n |
| Decision tokens (YES/NO) | 6 | Minted per-market by the program |
// Conversion helpers
const usdcToRaw = (amount: number) => BigInt(Math.floor(amount * 1_000_000));
const daysFromNow = (days: number) => BigInt(Math.floor(Date.now() / 1000) + days * 86400);
// Example
const liquidity = usdcToRaw(100); // 100 USDC -> 100_000_000n
const endTime = daysFromNow(7); // 7 days from now -> Unix timestamp as bigint
[!IMPORTANT] Collateral can be any SPL token or Token-2022 token. Pass the token's mint address as
baseMintorcollateralTokenMint. Make sure to use the correct decimals for the chosen token (e.g., USDC/USDT = 6, SOL = 9). Common mints are listed in the table above for reference.
Prerequisites
- Solana Wallet: Base58-encoded private key with SOL for fees (~0.05 SOL minimum)
- Collateral Tokens: Any SPL token (including Token-2022) for market liquidity — USDC, USDT, SOL, or any custom token
- RPC Endpoint: Mainnet RPC URL (public or dedicated like Helius/QuickNode)
# Install dependencies
cd scripts && npm install
# Set environment variables
export PRIVATE_KEY=<base58_private_key>
export RPC_URL=https://api.mainnet-beta.solana.com # or dedicated RPC
Quick Start
import { PNPClient } from 'pnp-sdk';
import { PublicKey } from '@solana/web3.js';
const client = new PNPClient(
process.env.RPC_URL || 'https://api.mainnet-beta.solana.com',
process.env.PRIVATE_KEY! // Base58 string or Uint8Array
);
// Collateral can be any SPL token (including Token-2022) — use the mint address of your chosen token
const USDC = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
// Create a prediction market
const result = await client.market.createMarket({
question: 'Will Bitcoin reach $100K by end of 2025?',
initialLiquidity: 1_000_000n, // 1 USDC (6 decimals) — adjust decimals for your collateral token
endTime: BigInt(Math.floor(Date.now() / 1000) + 30 * 24 * 60 * 60),
baseMint: USDC, // Any SPL or Token-2022 mint
});
console.log('Market created:', result.market.toBase58());
// Returns: { signature: string, market: PublicKey }
[!TIP] Use
PNPClient.parseSecretKey(process.env.PRIVATE_KEY)to handle both Base58 strings and JSON array formats automatically.
Market Lifecycle & State Machine
Markets follow a strict state progression:
V2 AMM Market (Standard)
CREATED ──────► ACTIVE ──────► ENDED ──────► RESOLVED ──────► CLAIMED
│ │ │ │ │
│ Trading live No new trades Oracle declares Winners redeem
│ Users buy/sell allowed YES/NO winner collateral
│ YES/NO tokens
│
└── initialLiquidity locked, PNP global oracle resolves
Custom Oracle Market (Agent-Controlled)
CREATED ──► [15-MIN BUFFER] ──► ACTIVE ──► ENDED ──► RESOLVED ──► CLAIMED
│ │ │ │ │ │
│ setMarketResolvable(true) Trade Wait for settleMarket() redeem
│ MUST call within 15 min! live endTime (oracle only)
│
└── Market starts frozen. If not activated within 15 minutes,
it is PERMANENTLY FROZEN and cannot be recovered.
State Transition Rules
| From | To | Method | Condition |
|------|-----|--------|-----------|
| CREATED | ACTIVE | setMarketResolvable(market, true) | Custom oracle only; must be within 15 min of creation |
| ACTIVE | ENDED | (automatic) | Unix timestamp reaches endTime |
| ENDED | RESOLVED | settleMarket({market, yesWinner}) | Oracle-only; can only be called after endTime |
| RESOLVED | CLAIMED | redeemPosition(market) | Any winner; available forever after resolution |
Core Operations: Read-Only (No Wallet Required)
These operations fetch data without executing transactions. Initialize with just an RPC URL:
const readOnlyClient = new PNPClient('https://api.mainnet-beta.solana.com');
fetchMarketAddresses() — Discover V2 Markets
const addresses: string[] = await client.fetchMarketAddresses();
console.log(`Found ${addresses.length} V2 AMM markets`);
// Returns: string[] of market public key base58 addresses
fetchMarket(pubkey) — Get On-Chain Market Data
const { account } = await client.fetchMarket(new PublicKey('HxnpHygK1v7TqodWqAv6RvcEiK9zxAgw5jPZ6rskgj2E'));
// MarketType fields:
// account.question: string
// account.creator: PubkeyLike
// account.resolvable: boolean
// account.resolved: boolean
// account.end_time: U64Like (Unix timestamp)
// account.winning_token_id: 'yes' | 'no' | 'none' | null
// account.yes_token_mint: PubkeyLike
// account.no_token_mint: PubkeyLike
// account.collateral_token: PubkeyLike
// account.market_reserves: U64Like
// account.initial_liquidity: U64Like
getMarketPriceV2(market) — Get Current Prices & Multipliers
const priceData = await client.getMarketPriceV2(marketAddress);
console.log({
yesPrice: priceData.yesPrice, // 0-1 range (e.g., 0.65 = 65%)
noPrice: priceData.noPrice, // 0-1 range (e.g., 0.35 = 35%)
yesMultiplier: priceData.yesMultiplier, // Payout ratio if YES wins (e.g., 1.54x)
noMultiplier: priceData.noMultiplier, // Payout ratio if NO wins (e.g., 2.85x)
marketReserves: priceData.marketReserves, // Total collateral locked (UI units)
yesTokenSupply: pric…[redacted], // YES tokens minted (UI units)
noTokenSupply: pric…[redacted], // NO tokens minted (UI units)
});
// AMM Price Formulas:
// yesPrice = (marketReserves * yesTokenSupply) / (yesTokenSupply^2 + noTokenSupply^2)
// noPrice = (marketReserves * noTokenSupply) / (yesTokenSupply^2 + noTokenSupply^2)
// yesMultiplier = 1 + (noTokenSupply / yesTokenSupply)^2
// noMultiplier = 1 + (yesTokenSupply / noTokenSupply)^2
fetchSettlementCriteria(market) — Get AI Resolution Info
const criteria = await client.fetchSettlementCriteria(marketAddress);
// Returns: { category, reasoning, resolvable, resolution_sources, settlement_criteria }
fetchSettlementData(market) — Get Settlement Decision
const data = await client.fetchSettlementData(marketAddress);
// Returns: { answer: 'YES'|'NO', reasoning: string }
trading.getMarketInfo(pubkey) — Extended Market Info
const info = await client.trading.getMarketInfo(new PublicKey(marketAddress));
// Returns: { address, question, id, creator, initialLiquidity, marketReserves,
// endTime, resolvable, resolved, winningTokenId,
// yesTokenMint, noTokenMint, collateralToken,
// yesTokenSupplyMinted, noTokenSupplyMinted }
Core Operations: Market Creation (Wallet Required)
Standard V2 AMM Market — market.createMarket(params)
Creates a V2 AMM market using PNP's global oracle for resolution.
const result = await client.market.createMarket({
question: 'Will SOL hit $250 by end of March?',
initialLiquidity: 10_000_000n, // 10 USDC (6 decimals)
endTime: BigInt(Math.floor(Date.now() / 1000) + 7 * 86400), // 7 days
baseMint: new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
});
console.log('Market:', result.market.toBase58());
// Returns: { signature: string, market: PublicKey }
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| question | string | Yes | The prediction question |
| initialLiquidity | bigint | Yes | Initial liquidity in raw units (decimals depend on collateral token) |
| endTime | bigint | Yes | Unix timestamp when trading ends |
| baseMint | PublicKey | No | Collateral token mint — any SPL or Token-2022 token |
Custom Oracle Market — createMarketWithCustomOracle(params)
When to use: When your AI agent needs full control over market resolution. Your agent's wallet becomes the oracle.
const result = await client.createMarketWithCustomOracle({
question: 'Will BTC hit $150K by Dec 2026?',
initialLiquidity: 10_000_000n, // 10 USDC (6 decimals)
endTime: BigInt(Math.floor(Date.now() / 1000) + 30 * 86400),
collateralMint: new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
settlerAddress: AGENT_WALLET_PUBKEY, // Your agent's wallet is the oracle
yesOddsBps: 5000, // Optional: 50/50 odds (range: 100-9900)
});
// Returns: { market: PublicKey, signature: string }
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| question | string | Yes | The prediction question |
| initialLiquidity | bigint | Yes | Initial liquidity in raw units |
| endTime | bigint | Yes | Unix timestamp when trading ends |
| collateralMint | PublicKey | Yes | Collateral token mint |
Truncated for display — read the full file on GitHub.
Related Skills
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
design
130.2kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG…
ui-ux-pro-max
130.2kUI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
