What Is Polymarket and Why Build a Fork?
Prediction markets are platforms where participants trade on the outcome of future events. Instead of placing a traditional bet, users buy and sell outcome tokens whose prices reflect the market's collective probability estimate. If you hold a "Yes" token for an event that resolves as true, you receive a payout. If the event resolves as false, the token is worth nothing.
Polymarket is the dominant prediction market platform today. Built on Polygon, it surged to mainstream prominence during the 2024 US presidential election, processing over $3.5 billion in trading volume on election-related markets alone. At its peak, Polymarket attracted hundreds of thousands of active traders and became a go-to source for real-time probability data, even being cited by major news outlets.
So why would anyone want to build a Polymarket fork? There are several compelling reasons:
- Niche markets — Polymarket focuses on major global events. There is untapped demand for prediction markets focused on specific verticals: sports, crypto prices, regional politics, entertainment, corporate earnings, or even internal company decision-making.
- Regional focus — Polymarket is restricted in the US and other jurisdictions. Builders in permitted regions can serve local audiences with localized markets and languages.
- Different tokens and chains — Polymarket runs on Polygon with USDC. You might want to deploy on BSC, Arbitrum, Base, or another EVM chain, using native tokens or stablecoins that your community prefers.
- Revenue from fees — Prediction markets generate revenue through trading fees, market creation fees, and resolution fees. Running your own platform means capturing that revenue stream directly.
- Customization and control — You can design your own UX, add features Polymarket lacks (like on-chain order books, limit orders, or multi-outcome markets), and retain full control over the platform's direction.
Polymarket uses the Polygon network for low transaction costs and relies on a combination of the Gnosis Conditional Token Framework (CTF) for its outcome tokens and UMA's optimistic oracle for market resolution. Understanding this architecture is the first step toward building something similar.
How Prediction Markets Work (Technical Overview)
Before diving into how to build a Polymarket fork, it helps to understand the core mechanics that make prediction markets function on-chain.
Binary Outcome Markets
The simplest prediction market is a binary market: an event resolves as either "Yes" or "No." When a user deposits collateral (say, 1 USDC), they receive one Yes token and one No token. These tokens are complementary — together they always equal the collateral value. The market price of each token fluctuates based on supply and demand, reflecting the crowd's probability estimate.
If the event resolves as "Yes," each Yes token is redeemable for 1 USDC, and each No token becomes worthless. The reverse applies if the event resolves as "No."
AMM vs. Order Book
There are two main approaches to facilitating trades:
- Automated Market Maker (AMM) — A smart contract holds a liquidity pool and uses a bonding curve (like constant product) to price tokens. Simpler to implement but can suffer from impermanent loss and wider spreads. Augur V2 and early prediction markets used this approach.
- Central Limit Order Book (CLOB) — Users place limit orders at specific prices. A matching engine pairs buy and sell orders. Polymarket uses a hybrid CLOB model with an off-chain matching engine and on-chain settlement. This provides tighter spreads and better capital efficiency but is more complex to build.
Conditional Token Framework (CTF)
The Gnosis Conditional Token Framework is an open-source ERC-1155 token standard specifically designed for prediction markets. It allows you to:
- Split collateral into conditional outcome tokens
- Merge outcome tokens back into collateral
- Create markets with any number of outcomes
- Compose conditions (e.g., "Team A wins AND total score is over 50")
CTF is the foundation that Polymarket builds on, and it is fully open source under the LGPL license.
Resolution and Oracles
Every prediction market needs a mechanism to determine the outcome once the event occurs. This is called resolution. The entity or system that provides the answer is the oracle. Oracle design is arguably the most critical and challenging aspect of building a prediction market — we dedicate a full section to it below.
Approaches to Building a Prediction Market
There are three realistic paths to launching your own prediction market platform, ranging from building from scratch to using a ready-made solution.
Option 1 — Fork Polymarket (Hardest)
This is what most people search for when they look up "Polymarket fork," but it is important to be transparent: Polymarket is NOT fully open source. Here is what you can and cannot access:
What IS open source or publicly available:
- Gnosis Conditional Token Framework (CTF) — the core token contracts
- Polymarket's CTF Exchange contract — available on GitHub
- Polymarket's NegRiskAdapter — for multi-outcome markets
- Some SDK libraries and tooling
What is NOT open source:
- The off-chain order matching engine (the core of Polymarket's CLOB system)
- The complete frontend application
- The market creation and curation infrastructure
- The resolution pipeline and oracle integration layer
- Backend APIs, indexers, and data infrastructure
In practice, "forking Polymarket" means using the same on-chain primitives (CTF + their exchange contract) but building everything else yourself. This is a massive engineering effort that could take a team of experienced developers 6-12 months to complete. You would need to build the matching engine, the frontend, the data pipeline, the oracle integration, and operational tooling from scratch.
Option 2 — Use Gnosis Conditional Token Framework
A more practical approach is to start with the CTF primitives and build a simpler system on top. Instead of replicating Polymarket's CLOB, you can use an AMM approach:
- Deploy Gnosis CTF contracts on your target chain
- Build an AMM contract that provides liquidity for outcome tokens
- Integrate an oracle for resolution (UMA, Chainlink, or a simpler centralized oracle)
- Build a React frontend for market creation, trading, and portfolio management
This approach gives you genuine prediction market mechanics with lower complexity. However, it still requires significant smart contract expertise, frontend development, and careful oracle design. Expect 3-6 months of development time for a competent team.
Option 3 — Use a Ready-Made Platform
The fastest path is to use a platform that gives you a deployable prediction market out of the box. These solutions handle the smart contracts, frontend, and admin tooling, letting you focus on market creation and community building.
Ready-made platforms typically include:
- Deployed and audited smart contracts
- Trading interface with order book or AMM
- Admin panel for creating and resolving markets
- Fee configuration and revenue collection
- Multi-chain deployment support
The tradeoff is less customization at the contract level, but you can be live in days instead of months. For most entrepreneurs and crypto projects looking to add prediction market functionality, this is the most practical path.
Core Smart Contract Architecture
Whether you build from scratch or customize an existing solution, understanding the smart contract architecture of a prediction market is essential. Here are the key contracts you need:
MarketFactory
This contract creates new prediction markets. It stores market metadata (question, resolution date, outcome labels) and deploys or configures the associated token and pool contracts. The factory pattern keeps deployment costs predictable and makes it easy to enumerate all markets.
ConditionalToken / Binary Option Contract
This contract manages the outcome tokens. In the CTF model, it uses ERC-1155 with position IDs derived from the condition and outcome index. A simpler approach uses separate ERC-20 tokens for each outcome. Below is a simplified example of a binary market contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract BinaryMarket {
IERC20 public collateral;
address public oracle;
string public question;
uint256 public resolutionTime;
// Outcome balances: user => outcome (0=No, 1=Yes) => amount
mapping(address => mapping(uint8 => uint256)) public balances;
uint256 public totalCollateral;
bool public resolved;
uint8 public winningOutcome; // 0 = No, 1 = Yes
event TokensMinted(address indexed user, uint256 amount);
event MarketResolved(uint8 outcome);
event Redeemed(address indexed user, uint256 payout);
constructor(
address _collateral,
address _oracle,
string memory _question,
uint256 _resolutionTime
) {
collateral = IERC20(_collateral);
oracle = _oracle;
question = _question;
resolutionTime = _resolutionTime;
}
/// @notice Deposit collateral, receive 1 Yes + 1 No token
function mint(uint256 amount) external {
collateral.transferFrom(msg.sender, address(this), amount);
balances[msg.sender][0] += amount; // No tokens
balances[msg.sender][1] += amount; // Yes tokens
totalCollateral += amount;
emit TokensMinted(msg.sender, amount);
}
/// @notice Oracle resolves the market
function resolve(uint8 outcome) external {
require(msg.sender == oracle, "Only oracle");
require(block.timestamp >= resolutionTime, "Too early");
require(!resolved, "Already resolved");
require(outcome <= 1, "Invalid outcome");
resolved = true;
winningOutcome = outcome;
emit MarketResolved(outcome);
}
/// @notice Redeem winning tokens for collateral
function redeem() external {
require(resolved, "Not resolved");
uint256 payout = balances[msg.sender][winningOutcome];
require(payout > 0, "Nothing to redeem");
balances[msg.sender][0] = 0;
balances[msg.sender][1] = 0;
collateral.transfer(msg.sender, payout);
emit Redeemed(msg.sender, payout);
}
}
This simplified contract demonstrates the core flow: deposit collateral to mint outcome tokens, oracle resolves the market, and winners redeem their tokens for collateral. A production contract would add trading functionality (AMM or order book), fee collection, emergency mechanisms, and proper access control.
Oracle / Resolution Contract
This contract (or external integration) determines the outcome. It may be a simple admin address, a multi-sig, or an integration with a decentralized oracle system. We cover this in detail in the next section.
AMM Pool
If you use the AMM approach instead of an order book, you need a pool contract that holds liquidity and prices outcome tokens using a bonding curve. The Logarithmic Market Scoring Rule (LMSR), used by early prediction markets like Augur, or a simpler constant product formula can work here.
Launch a Prediction Market Without Building From Scratch
Onout Prediction Market gives you a deployable prediction market with admin panel, on-chain order book, and price charts. Create markets, set outcomes, manage resolutions — deploy on any EVM chain.
Oracle and Resolution Design
The oracle problem is the single hardest challenge in building a prediction market. How do you trustlessly determine whether a real-world event happened? There is no perfect solution — only a spectrum of tradeoffs between decentralization, speed, cost, and reliability.
Centralized Oracle (Admin Resolves)
The simplest approach: a designated admin address (or multi-sig) calls the resolution function when the event outcome is known. This is fast, cheap, and reliable for trusted operators.
- Pros: Simple to implement, fast resolution, no oracle fees
- Cons: Requires trust in the admin, single point of failure, can be perceived as unfair
- Best for: Private platforms, corporate prediction markets, bootstrapping a new platform
UMA Optimistic Oracle
Polymarket uses UMA's optimistic oracle. Someone proposes an outcome, and there is a challenge period during which anyone can dispute it. If disputed, it goes to UMA token holders for a vote.
- Pros: Decentralized, battle-tested (Polymarket's volume proves it), handles ambiguous cases
- Cons: Resolution can take hours or days, requires UMA token staking for disputes, complexity
- Best for: High-stakes markets where trust minimization matters
Chainlink
Chainlink provides data feeds for prices, sports scores, and other structured data. For markets tied to verifiable on-chain or API data (e.g., "Will BTC be above $100K on June 1?"), Chainlink can provide automated resolution.
- Pros: Automated, reliable for data-driven markets, widely supported
- Cons: Limited to data Chainlink already provides, not suitable for subjective or novel questions
- Best for: Price-based markets, sports, weather, quantifiable events
Reality.eth
An on-chain escalation game where anyone can post an answer with a bond. If someone disagrees, they can post a larger bond with a different answer. Final arbitration goes to a designated arbitrator contract.
- Pros: Decentralized, economic incentives align reporters with truth, flexible
- Cons: Can be slow under dispute, bond requirements, potential for manipulation on low-liquidity markets
- Best for: General-purpose markets with moderate stakes
Many production systems use a hybrid approach: centralized resolution for speed with an escalation path to a decentralized oracle for disputes. This gives you fast resolution in the 99% of cases where the outcome is unambiguous, with a safety net for contested results.
Frontend Architecture
A prediction market frontend needs to handle several distinct user flows. Here is what a complete UI requires:
Market Listing
The homepage displays all active markets with their current probabilities, volume, and time remaining. Markets are typically categorized (politics, crypto, sports, etc.) and sortable by volume, recency, or closing date. Each market card shows the Yes/No probability as a percentage, which is derived from the last trade price or AMM state.
Trading Interface
The core trading view for a single market. Users need to see:
- Current Yes/No prices and probabilities
- Price history chart
- Order book depth (if CLOB-based)
- Buy/sell interface with amount input and slippage settings
- Market metadata: question, resolution source, resolution date, rules
Portfolio View
Users need to see their open positions across all markets, current profit/loss, and the ability to sell positions before resolution. This requires indexing on-chain events (token mints, trades, redemptions) and presenting them in a coherent dashboard.
Market Creation (Admin)
Admin users need an interface to create new markets, specifying the question, outcome options, resolution date, oracle configuration, initial liquidity (if AMM-based), and fee parameters. A good admin panel also provides market management tools: pausing trading, extending resolution deadlines, and manual resolution.
The typical tech stack is React (or Next.js) with wagmi and viem for wallet connectivity and contract interaction. Data indexing is handled by The Graph or a custom indexer. For a Polymarket fork with an order book, you also need a WebSocket server for real-time order updates.
Prediction Market Platforms Compared
Here is a comparison of the major options available if you want to launch a prediction market in 2026:
| Platform | Open Source | Deployable | Chain | Oracle | Cost |
|---|---|---|---|---|---|
| Polymarket | Partial (contracts only) | No | Polygon | UMA Optimistic | N/A (proprietary) |
| Augur | Yes | No (defunct) | Ethereum | REP token voting | N/A (discontinued) |
| Azuro | Partial | Limited | Polygon, Gnosis, Arbitrum | Centralized (sports data) | Revenue share |
| Gnosis CTF | Yes | Framework only | Any EVM | BYO (bring your own) | Free (build cost only) |
| Onout Prediction Market | Yes | Yes (full platform) | Any EVM | Admin + configurable | $899 one-time |
As the table shows, most existing prediction market platforms are either proprietary (Polymarket), defunct (Augur), or narrowly focused (Azuro on sports). Gnosis CTF gives you open-source building blocks but requires substantial development to turn into a usable product. Onout Prediction Market is the only option that gives you a complete, deployable prediction market platform with source code, admin panel, and on-chain order book — ready to launch on any EVM chain.
Legal Considerations
Prediction markets exist in a complex regulatory landscape, and any builder in this space needs to be aware of the legal environment.
In the United States, the Commodity Futures Trading Commission (CFTC) considers many prediction markets to be derivatives or event contracts. Polymarket settled with the CFTC in 2022 for $1.4 million and subsequently geo-blocked US users. The CFTC has taken enforcement action against other prediction market operators as well. In 2024, a court ruling allowed Kalshi to offer election contracts, but the regulatory picture remains uncertain.
In the European Union, prediction markets may fall under MiCA (Markets in Crypto-Assets) regulation or gambling laws depending on the jurisdiction and market type.
In other jurisdictions, the legal status varies widely. Some countries have clear frameworks for betting and prediction markets, while others have no specific regulation.
Key legal considerations:
- Licensing — Depending on your jurisdiction, you may need a gambling license, a financial services license, or both.
- KYC/AML — Many jurisdictions require identity verification for financial services platforms.
- Geo-blocking — You may need to restrict access from certain jurisdictions (as Polymarket does with the US).
- Market types — Markets on certain topics (elections, assassinations) face additional scrutiny or outright bans in some jurisdictions.
Disclaimer: This article is for informational purposes only and does not constitute legal advice. Consult with a qualified attorney in your jurisdiction before launching a prediction market platform.
Frequently Asked Questions
Is Polymarket open source?
Partially. Polymarket's smart contracts, including its CTF Exchange contract and NegRiskAdapter, are open source on GitHub. However, the off-chain matching engine, frontend application, backend APIs, and operational infrastructure are all proprietary. You cannot simply clone a repository and run your own Polymarket instance. The underlying Gnosis Conditional Token Framework that Polymarket builds on is fully open source.
Can I fork Polymarket?
You can use the same on-chain primitives (Gnosis CTF + Polymarket's exchange contracts), but you would need to build the matching engine, frontend, data indexing, oracle integration, and backend infrastructure yourself. This is a substantial engineering effort — think 6-12 months for a skilled team. For a faster path, consider using the Gnosis CTF with a simpler AMM model, or a ready-made platform like Onout Prediction Market that provides the complete stack.
How do prediction market smart contracts work?
At the core, users deposit collateral (e.g., USDC) and receive outcome tokens (one for each possible result). These tokens trade freely, with prices reflecting the market's probability estimate. When the event occurs, an oracle resolves the market, and holders of the winning outcome token can redeem it for the full collateral value. The main contracts are: a factory contract that creates markets, a conditional token contract that manages outcome tokens, an oracle contract that handles resolution, and a trading contract (AMM pool or order book) that facilitates token exchange.
What oracle should I use for market resolution?
It depends on your trust model and market types. For a new platform, starting with a centralized oracle (admin or multi-sig resolution) is pragmatic — it is fast, cheap, and simple. As you scale, you can add UMA's optimistic oracle for decentralized resolution, Chainlink for automated data-driven markets, or Reality.eth for community-driven resolution. Many successful platforms use a hybrid approach: fast admin resolution with a decentralized dispute escalation path.
How much does it cost to build a prediction market?
Building from scratch with a custom matching engine, frontend, and oracle integration typically costs $100,000-$300,000+ in development and takes 6-12 months. Using Gnosis CTF with a simpler AMM approach reduces this to $30,000-$80,000 and 3-6 months. A ready-made solution like Onout Prediction Market costs $899 as a one-time purchase and can be deployed in days. Smart contract auditing, which is critical for any DeFi platform handling user funds, adds $10,000-$50,000 regardless of approach.
Ready to Launch Your Own Prediction Market?
Skip months of development. Onout Prediction Market gives you a complete, deployable platform with on-chain CLOB order book, admin panel, price charts, and multi-chain support. Create your first market today.