The Logarithmic Market Scoring Rule (LMSR) is the pricing engine behind FlipCoin prediction markets. It guarantees instant fills, bounded loss for traders, and always-available liquidity.
LMSR is an automated market maker designed by Robin Hanson for prediction markets. Unlike traditional order books that require counterparties, LMSR provides instant liquidity for any trade size using a mathematical cost function.
In a YES/NO market, LMSR tracks two quantities: q(YES) and q(NO) — the net share inventories. The price of each outcome is determined by a sigmoid function of these quantities, ensuring prices always sum to 100%.
The YES price is calculated as: price = e^(qYes/b) / (e^(qYes/b) + e^(qNo/b)). This sigmoid curve ensures prices smoothly move between 0% and 100% as traders buy and sell shares.
priceYes = exp(qYes / b) / (exp(qYes / b) + exp(qNo / b))
The cost to buy shares is the difference in the cost function before and after the trade: Cost(q) = b * ln(e^(qYes/b) + e^(qNo/b)). This Log-Sum-Exp formulation prevents overflow and ensures numerical stability.
cost = b * ln(exp(qYes/b) + exp(qNo/b))
The parameter b controls how sensitive prices are to trades. Larger b means more liquidity: trades move the price less. Smaller b means thinner markets where each trade has more price impact. b is set at market creation based on the seed amount.
FlipCoin enforces a Polymarket-style guarantee: shares received are always greater than or equal to USDC spent (net of fees). This means your maximum loss if you win is the fee only — share price never exceeds $1.
sharesOut ≥ netUsdc (guaranteed by smart contract)
Deposit USDC
Trader deposits USDC into their Vault
Fee Deduction
Fee deducted: net = amount - fee
Cost Calculation
LMSR calculates cost delta for shares
Share Minting
ERC-1155 shares minted to trader
Price Update
q-values update, new price reflected
FlipCoin uses a hybrid model that combines LMSR with a Central Limit Order Book (CLOB). The Quote API automatically routes trades to the best venue.
Smart routing: The Quote API checks CLOB depth first. If the order book can fill at a better price than LMSR, it routes to CLOB. Otherwise, LMSR acts as the backstop — guaranteeing every trade can execute.
No Bootstrap Problem
Traditional order books need market makers. LMSR provides liquidity from day one — critical for new markets with no trading history.
Truthful Pricing
LMSR prices converge to true probabilities as informed traders buy and sell. This is the mechanism behind prediction market accuracy.
Composable for Agents
Deterministic pricing makes LMSR ideal for AI agents — the Quote API returns exact costs before execution, enabling precise trading strategies.