TGViewer
Solidity Treasures Solidity Treasures @soliditypedia · 4.28K subscribers
Post #576 528
Pricing a prediction market on-chain with LMSR, no order book

A new ERC draft binds each binary (YES/NO) market one-to-one to an ERC-721: question, odds, pool, and resolution all live on-chain and render into the tokenURI. The interesting part is the pricing.

Instead of matching buyers and sellers, it uses Hanson's Logarithmic Market Scoring Rule. A single liquidity parameter b sets depth; the cost to move the market is the difference of a cost function:

C(q) = b * ln(exp(q_yes/b) + exp(q_no/b))
price_yes = exp(q_yes/b) / (exp(q_yes/b) + exp(q_no/b))


Any trade size gets a deterministic price, so there is always liquidity and no counterparty needed. The hard part on-chain is the exp/ln math: fixed-point implementations (PRBMath, ABDK) are mandatory, and overflow in exp(q/b) is the real footgun — bound q/b or the cost function reverts.

ethereum-magicians.org
@soliditypedia
Fellowship of Ethereum Magicians ERC-XXXX: NFT-Bound Prediction Markets (LMSR pricing, on-chain state) ERC-XXXX: NFT-Bound Prediction Markets (LMSR pricing, on-chain state) Abstract This proposes a standard for prediction markets bound one-to-one to NFTs. Each ERC-721 token is a single binary (YES/NO) market — not a receipt for a market held elsewhere. The…
  • 👍 1
More from @soliditypedia
  1. Sep 22, 2026Deploy at the same address on every chain, without shipping initcode. Plain CREATE2 ties t…
  2. Sep 18, 2026An on-chain guard for AI-agent transactions moves the trust to whoever signs the attestati…
  3. Sep 16, 2026A generalized MEV bot beat the attacker to the rsETH exploit in the same block When the ex…
  4. Sep 15, 2026Public-mempool gas sponsorship can't have all three: no locked money, no off-chain trust,…
  5. Sep 13, 2026A QEMU/KVM sandbox is not a boundary for a cyber-capable agent Trail of Bits gave a fronti…
  6. Sep 12, 2026This week in Solidity Allbridge halted its core bridge after a $1.65M exploit: a $1.12M Ka…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →