How to Build a Prediction Market Platform Securely
Part of our guide to the EVM

Quick answer. Choose how to build a prediction market platform: route orders or run a venue. Set custody, collateral, resolution, and settlement rules; secure accounts and APIs; establish market surveillance; confirm operating permissions; and test payouts and emergency exits before deposits.
Video transcript
Before you build a prediction market, decide whether to route orders or run the venue. Then map who can move funds, halt trading and finalize outcomes.
Route orders if existing listings and liquidity meet your needs. If you run a venue, start with one fully collateralized yes or no market, one collateral asset and one way to execute trades.
Before trading opens, lock the question, the evidence sources and the trading cutoff. Decide who can finalize the outcome and how users get paid if the result is invalid.
In a hybrid order book, the settlement contract should enforce what the user signed, including price and size limits. Show when a cancellation actually blocks settlement.
Keep login and trading separate from withdrawals. Require fresh approval for the exact amount and destination, and test that revocation reaches sessions, API credentials and delegated keys.
Before listing, have counsel confirm which permissions apply in each jurisdiction. Give surveillance staff a timeline that connects orders, cancellations and fills with the evidence used to resolve the market.
At design freeze, sign off on who controls funds and outcomes. Before deployment, review contracts and test the app separately. Before deposits, verify production permissions and rehearse a payout and emergency exits.
Read the full launch checklist, or bring your market rules and settlement design to Guardian for a prediction market audit.
Choose the Architecture
Route orders if existing listings and liquidity meet your needs. Operate a venue if you need control over listings or execution.
Our guide to prediction market manipulation covers oracle risks, ambiguous wording, insider trading, and frontend threats.
In Polymarket’s builder model, the app forwards orders and Polymarket matches them. Verify what your app may sign and which upstream record supplies fill and cancellation status.[1]
If you run a venue, start with one fully collateralized Yes or No template, one collateral asset, and one execution model.
Draw the path from deposit to redemption. Name who can move collateral, upgrade contracts, halt trading, and publish the outcome.
If you hold user funds, reconcile the customer ledger against custody balances and control withdrawals separately. For user wallets, inventory approvals, delegated signers, and recovery powers.
Put collateral backing and payout math in the prediction market audit scope. Review the matcher, API, and signing interface separately.
| Execution model | Where trades execute | What to verify |
|---|---|---|
| Onchain liquidity pool | Traders take prices from a pool of outcome tokens | Test slippage limits, thin liquidity, and liquidity-provider exits. |
| Onchain order book | Orders and matching rules live onchain | Test ordering, transaction costs, and cancellations during congestion. |
| Hybrid order book | An offchain operator matches; contracts settle onchain | Enforce trade limits onchain; plan for operator downtime and sequencing disputes. |
Conditional Tokens and Resolution
Assign listing approval to a named reviewer and freeze the question, primary and fallback sources, and rules for corrections, postponements, and invalid outcomes. Decide whether to allow clarifications after opening; log any without changing payout terms.
Set a UTC trading cutoff that the matcher and settlement contract both enforce. Trueo’s documented earliest resolution time is a different kind of setting: it does not close trading.[2]
With Gnosis conditional tokens, a simple binary market can split one collateral unit into one Yes and one No token. Merge equal amounts back into collateral.[3, 4]
After finalization, the same contract burns redeemed positions and pays according to the recorded shares. Publish payouts for both valid and invalid outcomes.
Bind the market to its resolver. Gnosis derives the condition ID from the oracle address, question ID, and outcome count.
Polymarket’s published conditional tokens adapter shows the boundary: it takes an UMA Optimistic Oracle V2 result and reports the payout shares to the token contract.[5]
UMA lets integrations set bonds and challenge windows. Size bonds to exposure and test that funded primary and backup challengers can afford them, verify evidence, and act within the window.[6]
Show closed, proposed, disputed, and finalized separately; name who can advance each state. The contract’s recorded payout governs redemption.
For a price feed, fix the source, observation time, staleness limit, and missing-data policy. In either design, reject conflicting results after finalization.
Match and Settle Orders
Publish how the engine prioritizes orders at the same price. Record the sequence it accepted, even when settlement fails.
In a hybrid book, the settlement contract must verify the exact signed outcome token ID, signer, and side. Enforce the signed size, price, and fee bounds.
EIP-712 can bind signatures to a chain and verifying contract, but not prevent replay. At settlement, enforce expiry, cancellation, and remaining fill allowance by unique signed order ID.[7]
Separate order acceptance from matched, submitted, and confirmed trades, and retries from permanent failures. Polymarket’s mined trades aren’t final.[8]
Document whether cancelling on the book also blocks settlement. If not, show users what invalidates the signature in your design and when that action is final.
After a restart or chain reorganization, reconcile the book and indexer with chain receipts. Retrying a settlement must not count a fill twice.
In Trueo’s reviewed onchain order manager, filling the last small remainder deleted the order but could requeue its ID. Guardian marks L-05 resolved.[9]
Test that terminal orders remain unfillable and out of pending queues after retries or rounding. Document how users can cancel or exit if the matcher goes offline.
Secure Accounts and Wallets
Separate login, trading, and withdrawals. Bind fresh authorization for a withdrawal to its actual amount and destination, not just to an unlocked session.
Give delegated trading keys explicit permissions, limits, and expiry. Keep withdrawal and recovery powers out of those grants.
NIST distinguishes the identity provider’s session from the app’s session. Logging out at the provider does not necessarily end the app session.[10]
Set a revocation deadline and test it against active sessions, API credentials, streaming connections, and delegated signers. Include lost-device recovery in the drill.
At the API, check order ownership for private details and cancellations. Require separate roles for listing and pausing.
Apply per-account limits to order submission and cancellation. Give cancellations their own capacity so a surge of new orders does not crowd out exits.
Keep optional scripts off trading and signing pages. Subresource Integrity can block altered downloads, but it does not limit what an approved script can do.[11]
Build Market Integrity Controls
Before listing, have counsel classify the product and the operator, router, custodian, and creator in each target jurisdiction. Ask which access controls and records each role needs.
The CFTC’s June proposal preamble says existing law requires venues within its jurisdiction to register as designated contract markets to offer event contracts as futures or swaps to the U.S. public. Part 40 covers certification and approval.[12, 13]
Part 38 requires designated contract markets to list contracts not readily susceptible to manipulation. It also requires real-time surveillance, trade reconstruction, and pre-trade risk controls.[14]
At listing review, ask who can influence the outcome and who learns it before the public. Record conflicts and decide whether to restrict participation or reject the market.
Give surveillance staff a timeline joining order submissions, amendments, cancellations, fills, access decisions, and resolution evidence. Preserve enough detail to explain a price move or missed cutoff.
Flag suspected wash trading, spoofing, and unusual trading before public announcements. Send those signals to a named reviewer; they are not findings of misconduct.
Public trade disclosure under 17 CFR § 16.03(f) has a January 29, 2027 compliance date. Designated contract markets must publish each Covered Event Contract transaction’s execution timestamp, ticker, quantity, and USD price as soon as technologically practicable.[15]
If the reporting rule applies, reconcile every required feed field against executions and measure time from execution to publication.
Set Launch Gates
Give each gate a sign-off owner and a record you can inspect. A passing contract review does not sign off the web app or the production configuration.
Test the whole market lifecycle, including a dispute and an invalid result. Make the product, engineering, and operations owners agree on the expected balances and states.
Fuzz the prediction market smart contract for collateral conservation, bounded fills, and one-time payouts. Check that every bond is returned or slashed according to the rules.
Rehearse a pause that blocks new risk without trapping safe cancellations, claims, or withdrawals where the design allows. Write down who can reopen trading.
- Design freeze: product signs off one listing’s rules and the diagram of who controls funds, trading, and resolution.
- Before deployment: record sign-off on the independently reviewed frozen commit, passing invariants, and separate wallet, API, and relayer test results.
- Before deposits: operations matches deployed bytecode and permissions to the reviewed release and reconciles a test trade through redemption.
- Assign each production alert an owner and action. Raise initial caps only after oracle-delay, matcher-outage, and session-compromise drills meet written criteria.
Review the Contracts Before Deposits
Bring your market rules, settlement design, and deployment scope to Guardian for a prediction market audit. Start with what must stay true from the first deposit to the last payout.
Frequently Asked Questions
Do you need a new token contract for each market?
No. The Gnosis Conditional Tokens Framework can track multiple conditions in one token contract. When indexing balances, use the position identifier, which incorporates the collateral token and outcome collection, not just a display label like Yes.[3]
How should a price market handle a tie?
Polymarket’s Up or Down markets that use Chainlink time-weighted average prices resolve Up when the starting and ending averages are equal. That is Polymarket’s rule, not a default: specify your tie outcome before trading opens.[16]
Related reading
- The Polymarket Hack Explained: A Third-Party Script
- The Predict.fun Hack Explained: A Third-Party Docs Site
- What Is Web3 MDR? Managed Detection and Response for Crypto
Sources
- Polymarket: Polymarket Builder Program Overview
- Trueo: Trueo Market Creation and Parameters
- Gnosis: Conditional Tokens Framework Contract
- Gnosis: Automated Market Makers for Prediction Markets
- Polymarket: Polymarket UMA Conditional Tokens Adapter
- UMA: Setting Custom Bond and Liveness Parameters
- Ethereum Improvement Proposals: EIP-712: Typed Structured Data Hashing and Signing
- Polymarket: Polymarket Order Lifecycle
- Guardian: Trueo Staking Updates: Round Three L-05, Dust Partial Fills Requeue Deleted Orders
- National Institute of Standards and Technology: NIST SP 800-63B-4: Authentication and Authenticator Management
- MDN Web Docs: Subresource Integrity
- Federal Register: Prediction Markets; Public Interest Determinations, June 2026 Proposed Rule
- Office of the Federal Register: 17 CFR Part 40: Provisions Common to Registered Entities
- Office of the Federal Register: 17 CFR Part 38: Designated Contract Markets
- Federal Register: Data Reporting Requirements for Certain Event Contracts
- Polymarket: Polymarket Resolution
- OWASP: OWASP Top 10 API Security Risks, 2023
- ethereum.org: Ethereum Smart Contract Security
- Office of the Law Revision Counsel: 7 U.S.C. Section 7a-2: Common Provisions Applicable to Registered Entities
- The File: Regulator Spells Out How It Will Judge Prediction-Market Bets on War, Terror and Sports
- U.S. Government Publishing Office: S. 4060: Prediction Markets Security and Integrity Act of 2026
- Guardian: Sapience LayerZero Composer: L-02, Lacking Receiver Settlement Check
- Guardian: Longshot Protocol Review: M-06, Privy JWKS Revocation Delay