Prysm: Permissionless Prediction Market Orderbooks
Abstract
Prysm is an open-source protocol for running permissionless prediction market orderbooks on Polymarket. It lets anyone operate a decentralized orderbook — posting, matching, and settling trades — without relying on Polymarket's centralized API or any single server operator.
The protocol ships as a TypeScript SDK paired with Solidity settlement contracts deployed on Polygon. Orders are signed client-side using EIP-712, encoded into a canonical wire format, and settled atomically on-chain through Polymarket's Conditional Token Framework (CTF). Every trade follows the split-share model: both sides post USDC collateral, the contract mints YES and NO outcome tokens via CTF.splitPosition(), and tokens are distributed to each counterparty — all in a single transaction. If any step fails, the entire settlement reverts.
Prysm solves four problems with existing prediction market infrastructure:
- No standard order format. Every integration re-invents encoding, signing, and serialization. Prysm defines a canonical ABI-encoded
WireOrderstruct that works identically as Polygon calldata, Ethereum blob data, x402 payment headers, or AI agent messages.
- Off-chain expiry is unreliable. Clock skew and relay delays can cause expired orders to settle. Prysm enforces expiry at the smart contract level —
block.timestampis the source of truth.
- Fee infrastructure is rigid. Existing systems apply a single global fee. Prysm supports per-order fee switches (zero-fee promotions, VIP tiers, market maker rebates) and multi-level affiliate attribution with deterministic conflict resolution.
- Settlement is not atomic. Multi-step settlement across separate transactions can leave the system in an inconsistent state. Prysm batches everything — collateral collection, share minting, token distribution, fee payouts — into a single
SettlementRoutercall.
The protocol provides two settlement paths: an off-chain matching engine with atomic on-chain settlement via SettlementRouter, and a fully on-chain orderbook contract (PrysmOrderbook) for serverless operation where no centralized infrastructure is desired. Both paths use the same wire format, the same CTF integration, and the same atomic guarantees.
Prysm is designed to be embedded — by frontend teams building trading UIs, smart contract wallet integrators, and AI agent frameworks. The SDK is open-source (MIT). Alpha deployment targets the Polygon network.
Protocol: Prysm | SDK: `prysm-sdk` | License: MIT | Alpha chain: Polygon (137)