Polycast logo Polycast • Docs
← Back to site

1) Introduction

Polycast is a Solana-native prediction protocol. AI computes odds, and ZKML publishes a proof that the computation was executed correctly without revealing model weights or user inputs.

  • Chain: Solana
  • Focus: Private predictions, public proofs
  • Modules: Markets, Liquidity, Odds Engine, ZK Prover/Verifier
This doc is for builders: market creators, integrators, and auditors.

2) Architecture

High-level components:

ComponentRole
Markets ProgramCreate/resolve markets, accept bets, route payouts
Liquidity ProgramProvide LP shares & fees
Odds EngineOff-chain AI inference (feature aggregation, calibration)
ZK ProverGenerates proof of correct inference
On-chain VerifierVerifies proof & stores verified odds
// Example: Odds payload (hashed) that gets proven via ZKML
{
  "market": "election-usa-2026",
  "timestamp": 1730160000,
  "features_commit": "0x4c3ef...a91",
  "probs": { "YES": 0.62, "NO": 0.38 },
  "model_commit": "0xabc123...def",
  "nonce": "0x9f7..."
}
// ZK proof binds probs to model_commit + features_commit.

3) On-chain Programs (Anchor-style)

Program IDs (example placeholders):

ProgramAddress
Polycast MarketsPcMkt1111111111111111111111111111111111111
Polycast LiquidityPcLp11111111111111111111111111111111111111
ZK VerifierPcZkv1111111111111111111111111111111111111
/// IDL excerpt (TypeScript)
type MarketsIDL = {
  "version": "0.1.0",
  "name": "polycast_markets",
  "instructions": [
    {
      "name": "createMarket",
      "accounts": [
        {"name":"authority","isMut":true,"isSigner":true},
        {"name":"market","isMut":true,"isSigner":false},
        {"name":"systemProgram","isMut":false,"isSigner":false}
      ],
      "args": [
        {"name":"slug","type":"string"},
        {"name":"outcomes","type":{"vec":"string"}},
        {"name":"deadline","type":"i64"}
      ]
    },
    {
      "name": "placeBet",
      "accounts": [
        {"name":"user","isMut":true,"isSigner":true},
        {"name":"market","isMut":true,"isSigner":false},
        {"name":"vault","isMut":true,"isSigner":false},
        {"name":"tokenProgram","isMut":false,"isSigner":false}
      ],
      "args": [
        {"name":"outcome","type":"u8"},
        {"name":"amount","type":"u64"},
        {"name":"zkOddsRef","type":{"array":["u8",32]}}
      ]
    }
  ]
};

4) Client SDK (JavaScript)

Minimal client to browse markets and place a private bet. Uses @solana/web3.js + Anchor.

// 1) Install
npm i @project-serum/anchor @solana/web3.js

// 2) Setup (devnet example)
import { Connection, PublicKey, SystemProgram } from "@solana/web3.js";
import * as anchor from "@project-serum/anchor";
import idl from "./polycast_markets.json";

const connection = new Connection("https://api.devnet.solana.com");
const wallet = window.solana; // Phantom
const provider = new anchor.AnchorProvider(connection, wallet, {});
anchor.setProvider(provider);

const programId = new PublicKey("PcMkt1111111111111111111111111111111111111");
const program   = new anchor.Program(idl, programId, provider);

// 3) Place a private bet (zkOddsRef references a verified odds record)
async function placeBet(marketPk, outcomeIdx, lamports, zkOddsRef){
  await program.methods.placeBet(outcomeIdx, new anchor.BN(lamports), zkOddsRef)
    .accounts({
      user: provider.wallet.publicKey,
      market: marketPk,
      vault: (await PublicKey.findProgramAddressSync([Buffer.from("vault"), marketPk.toBuffer()], program.programId))[0],
      tokenProgram: anchor.web3.SystemProgram.programId
    })
    .rpc();
}

5) REST Endpoints

Public stateless endpoints for odds & proofs. Rate limited.

GET  /api/markets?status=live
GET  /api/markets/:slug
GET  /api/odds/:slug              // returns latest verified odds + proofRef
GET  /api/proofs/:proofRef        // returns proof blob (groth16/plonk/etc)
POST /api/submit                   // optional relay to submit signed tx
// Example response for /api/odds/election-usa-2026
{
  "market":"election-usa-2026",
  "probs":{"YES":0.62,"NO":0.38},
  "model_commit":"0xabc123...",
  "features_commit":"0x4c3ef...",
  "proofRef":"0xproofdeadbeef",
  "ts":1730160000
}

6) Market Lifecycle

  1. Create: authority calls createMarket with outcomes & deadline.
  2. Odds: off-chain AI computes probs → ZK Prover emits proof → Verifier stores zkOddsRef.
  3. Betting: users place private bets referencing zkOddsRef.
  4. Resolve: authority supplies resolution oracle → program settles payouts.
  5. Accounting: fees routed to LPs/treasury; events emitted for indexers.

7) Privacy & ZKML

  • Private Inputs: user amounts/outcomes are shielded client-side (commitment scheme); only settlement deltas are public.
  • Model Integrity: proof binds output probs to model_commit + features_commit.
  • Verifier: on-chain program checks proof and stores a short reference (zkOddsRef) used by bets.
// Verifier interface (pseudo)
verify(proof, publicSignals) -> bool
// publicSignals: { model_commit, features_commit, probs_hash }

8) FAQ

Does Polycast custody funds?
No. Bets & payouts are executed by Solana programs; users keep control of their wallets.

Can I run my own Odds Engine?
Yes. Provide your model_commit, publish proofs, and point Verifier to your proof format.

Where are proofs stored?
Off-chain blob store (content-addressed). The chain stores only a small reference & verification state.

© Polycast — Documentation.