๐Ÿ“šDocumentation

How Sorocast Works

Decentralized prediction markets powered by mathematics and game theory

๐ŸŒŸ

Introduction

A revolutionary approach to prediction markets using automated market makers

Sorocast reimagines prediction markets by eliminating traditional order books in favor of algorithmic market making. Our novel multi-seeder LMSR implementation creates always-available liquidity while maintaining mathematical elegance and fairness. This documentation explains the theory, implementation, and economics behind our decentralized prediction market protocol.

๐ŸŽฏ

Goal & Vision

Enable open, on-chain prediction markets to crowdsource insights and incentivize accurate forecasting using Soroban smart contracts.

โœฆ Platform Capabilities

  • โ€ขCreate and trade on outcome-based markets for any event - elections, sports, crypto trends, and more
  • โ€ขUse conditional tokens and liquidity pools for transparent, trustless market resolution
  • โ€ขImplement reputation and staking mechanics to ensure market quality and truthful participation

โœฆ Ecosystem Impact

Brings powerful crowd-driven forecasting to the Stellar ecosystem, showcasing the utility of oracles and smart contracts while opening new DeFi-aligned use cases for speculation, governance, and collective intelligence.

๐ŸŒŠ

The Disruption

Race to Zero Platform Fees

OPEN SOURCE REVOLUTION

This platform will be completely open-sourced, creating a fundamental disruption in the prediction market space.

๐Ÿ”“

Fully Open

All smart contracts and UI code open-sourced and verifiable

๐Ÿค–

Code is Law

No administrators, no company cuts, only transparent smart contracts

๐Ÿ”

Verifiable

Compile code yourself and verify bytecode hashes on-chain

โš ๏ธ Author Disclaimer

The author receives no fees from this platform. This documentation serves as a complete specification enabling anyone to build competing implementations. The goal is to commoditize prediction market infrastructure and drive platform fees to zero through open competition.

๐Ÿง 

The Problem with Order Books

โŒ Liquidity Issues

Traditional order books require matching buyers and sellers. If you want to buy YES at $0.70, someone must sell NO at $0.30. This creates friction, wide spreads, and poor liquidity, especially in niche markets.

โŒ Price Slippage

The "thin market" problem means large trades cause significant price movement. This discourages informed traders from participating, reducing the market's ability to aggregate information effectively.

These fundamental flaws limit prediction markets' potential for accurate price discovery

โš™๏ธ

LMSR: Always Available Pricing

The Logarithmic Market Scoring Rule (LMSR) eliminates the need for counterparties through algorithmic market making.

๐Ÿ’ง

Seeders

Provide initial capital that creates market liquidity and earn fees from trades. Think of seeders as the insurance companies - they take on risk to make markets possible and profit from trading activity, not from predicting outcomes.

๐Ÿ“ˆ

Traders

Buy or sell shares based on their beliefs about outcome probabilities. Traders profit when they buy shares at prices lower than the true probability of an event occurring.

Key Innovation: LMSR provides continuous pricing based on mathematical formulas, ensuring traders can always buy or sell at deterministic prices regardless of market activity.

๐Ÿ“Š

Visualizing Market Dynamics

An animated comparison illustrating how an Automated Market Maker's (AMM) pricing curve offers continuous liquidity across a range of prices, contrasted with a traditional order book's discrete depth levels and bid-ask spread. Observe the dynamic shifts as market conditions evolve.

Comparing Market Liquidity: AMM vs. Order Book

Animated visualization showing how an Automated Market Maker's (AMM) pricing curve offers continuous liquidity across a range of prices, contrasted with a traditional order book's discrete depth levels and bid-ask spread. Observe the dynamic shifts as market conditions evolve.

  • AMM Ask Curve
  • AMM Bid Curve
  • Order Book Bids
  • Order Book Asks

Keen-eyed and mathematically inclined viewers might notice a resemblance between the AMM graph, particularly the shape of the buy and sell curves, and an inverted logistic function. This is indeed an expected characteristic. LMSR utilizes a softmax function to determine pricing. When you consider a cross-section of the softmax function in one particular direction (isolating the probability of one outcome against all others), it mathematically simplifies to a logistic function. Therefore, the observed sigmoidal shape in the visualization is a direct consequence of the underlying mathematics and is to scale. More detailed explanations of the mathematical underpinnings are provided in later sections.

โš–๏ธ

LMSR vs Order Books

โœ“ LMSR Advantages

  • โ€ขAlways available liquidity without counterparties
  • โ€ขDeterministic pricing based on mathematical formulas
  • โ€ขWorks well in low-volume markets
  • โ€ขBounded loss for liquidity providers
  • โ€ขNo bid-ask spread (in the traditional sense)

โœ— LMSR Challenges

  • โ€ขSeeders likely lose most capital at resolution
  • โ€ขSeeder returns depend on uncertain trading volume
  • โ€ขPrice impact for large trades can be significant
  • โ€ขMore complex mathematics than order books
  • โ€ขRequires initial seeding capital

๐Ÿ’ฐ Money Conservation Principle

All money is fully collateralized and conserved within the market. The protocol itself never takes any funds - all money flows only between participants (seeders and traders). This creates a zero-sum game where profits and losses balance exactly, ensuring market integrity.

๐Ÿ”„

A Novel Multi-Seeder LMSR

Revolutionary Design

Sorocast implements a custom LMSR that allows seeders to join at any time, even after trading has started. Traditional implementations have a fixed liquidity parameter set at market creation - ours dynamically grows as new seeders join.

1

Dynamic Liquidity

The effective liquidity parameter increases as new seeders join, improving market depth over time.

2

Individual Markets

Each seeder has their own market. When traders trade, shares are traded in each seeder's individual market proportionally.

3

Unified Interface

Traders see a single market with unified pricing, while the protocol manages the complexity of multiple individual markets seamlessly.

๐Ÿ“

The Mathematics

Cost Function

The LMSR uses a cost function that determines how much traders pay to buy shares. This function ensures that prices always sum to 1 (100%) and provides bounded loss for liquidity providers.

The market maintains a cost function where is the vector of shares outstanding for seeder j, is the liquidity parameter for seeder j, is seeder j's prior probability for outcome i, and is an arbitrary constant. Only the difference in cost matters, not the actual value, similar to comparing definite to indefinite integrals.

Liquidity Parameter Calculation

The liquidity parameter determines market depth and maximum loss. For the initial seeder with uniform prior for all outcomes:

For subsequent seeders joining at current market probabilities :

Where is the minimum probability across all outcomes at the time of seeding.

Multiple Seeders Mathematics

When multiple seeders join a market, each with their own priors and b values, they don't simply combine into one larger b parameter. Instead:

Individual Cost Functions

Each seeder j has their own cost function based on their individual b value and prior:

Proportional q-splitting

Unlike the single universal shares vector for a single seeder LMSR, each new seeder j gets a brand new initialized when they seed and updated like so when somebody trades:

Combined Cost Function

The combined cost function is the sum of individual cost functions, each incorporating the seeder's prior and shares sold:

Combined Pricing

The market price for outcome i is determined by the contributions from all seeders, each with their own priors:

Where is seeder j's prior probability for outcome i, is their shares sold, and is seeder j's liquidity parameter.

New Seeder Price Neutrality

When new seeders join, their priors are set to current market prices. This ensures that adding a new seeder doesn't immediately change market prices. If a new seeder's priors were different from current prices, their entry would shift the market, creating potential manipulation opportunities:

Price Calculation

For a single seeder with prior for outcome i, prices are calculated as:

With multiple seeders, each with their own priors and liquidity parameters, the price is:

Prices always sum to one: . This property ensures that the prices can be interpreted as probabilities.

Cost of Trading

When traders buy or sell shares, they pay the difference in the total cost function before and after the trade:

This can be decomposed as the sum of individual cost contributions from all seeders:

Each seeder's individual cost function contributes to the total cost of the trade. This ensures that the risk is properly distributed among seeders according to their individual b values and priors.

Fee Structure

Fees are only applied to buy orders, not sell orders. The fee structure is designed to award seeders for taking the risk while not being too high to drive away prospective buyers:

This constant fee ensures seeders receive compensation for providing liquidity, while keeping trading costs predictable and reasonable for traders.

๐Ÿ’ฐ

Seeder Economics

The Business of Uncertainty

Seeders are uncertainty merchants.

They profit from the journey, not the destination.

๐Ÿ’ธ

Fee Collection

Earn fees on every trade. The more trading activity, the more fees collected. High-volume controversial markets are a seeder's best friend.

๐ŸŽฒ

Uncertainty Profits

Markets that stay uncertain and active generate the most fees. Price swings and changing sentiment create trading volume.

๐Ÿ†

Underdog Windfalls

If a low-probability outcome wins, seeders can make significant profits on their capital in addition to collected fees.

The ideal seeder market: Stays controversial for a long time, generates high volume with traders on both sides, and has multiple price swings as new information emerges.

๐Ÿ”„

Secondary Market for b-tokens

Seeders can exit positions before market resolution through our innovative secondary market.

๐Ÿช™

b-tokens

Your seed becomes b-tokens representing your share of market liquidity and fee rights

๐Ÿ“Š

Order Book

Simple auction mechanism where buyers and sellers set their own prices

๐Ÿ’ฑ

Dynamic Pricing

b-tokens trade at premiums or discounts based on market conditions

For Sellers

  • โ€ข Exit positions before resolution
  • โ€ข Realize profits early
  • โ€ข Manage risk exposure
  • โ€ข Redeploy capital efficiently

For Buyers

  • โ€ข Enter established markets
  • โ€ข Buy b-tokens at discounts
  • โ€ข Acquire specific b-values
  • โ€ข Diversify across markets
๐Ÿ’ก

How to Participate

๐Ÿ“ˆ

Trading

Buy low, sell high, profit from knowledge

Buy shares when you believe the market price is wrong. Your profit comes from the difference between your purchase price and the final resolution price (1 XLM for winning outcomes, 0 for losing).

Example: If a market shows 30% chance of an event but you believe it's 70%, buy YES shares. If correct, you profit from the 40% difference.

Trading Strategies

โ€ข
Value Trading:Buy underpriced outcomes based on analysis
โ€ข
Momentum Trading:Follow market trends and sentiment
โ€ข
Arbitrage:Exploit price differences across markets
โ€ข
Hedging:Use markets to offset real-world risks
๐Ÿ’ง

Seeding

Provide liquidity, collect fees, enable markets

Provide liquidity to markets and earn fees from trading activity. Your profit comes primarily from collecting fees during the market's active life, though you can also profit if an underdog outcome wins.

Example: Seed 1000 XLM in a market that generates 100,000 XLM volume. With 2% fees, you collect 2,000 XLM. If a 10% underdog wins, you could profit even more.

Seeding Strategies

โ€ข
Volume Hunting:Target controversial, high-activity markets
โ€ข
Early Entry:Seed markets with long time horizons
โ€ข
Active Management:Trade your own markets for extra profit
โ€ข
Portfolio Approach:Diversify across multiple markets
๐Ÿ›๏ธ

Market Parameters

ParameterValuePurpose
Creation Bond1000 XLMPrevents spam markets and ensures creator commitment. Returned after successful resolution.
Minimum Seed1000 XLMEnsures sufficient liquidity for trading. Higher seeds create deeper markets.
Fee Structure0.02 XLM/shareFlat fee per share to encourage trading volume and price discovery.
Liquidity (b)DynamicCalculated as for each seeder.
Resolution TimeCreator SetWhen the market will resolve. Can be date or event-based.

Note: Parameters are subject to change based on testing and market feedback. These values are placeholders for initial markets.

๐Ÿ“

Fair Market Design

Starting Fair

All markets begin with uniform priors where each outcome has equal probability, ensuring a neutral starting point without bias.

Starting with uniform priors ensures no manipulation and provides a fair starting point. For the initial seeder, the minimum probability is , so their maximum loss is .

Market Rules

โœ“

Seeders can also trade to correct prices if they believe the market is mispriced, aligning their incentives with market accuracy

โœ“

New seeders enter at current prices, preventing dilution of existing positions and ensuring fair participation

โœ“

Seed capital is locked until market resolution, preventing liquidity withdrawal attacks

โœ“

Trading fees are distributed proportionally to seeders based on their individual b values

โœ“

Market creators must post a bond to create markets, ensuring they have skin in the game

๐Ÿ’ป

Technical Implementation

Built on Stellar blockchain for fast, low-cost transactions with robust smart contracts.

๐Ÿ”—

Smart Contracts

On-chain contracts for market creation, trading, seeding, and resolution with full transparency

๐Ÿ“Š

LMSR Calculations

On-chain mathematical operations for transparent and verifiable pricing using fixed-point arithmetic

๐Ÿ”ฎ

Oracle System

Decentralized oracle system for reliable market resolution without central authority

๐ŸŒ

Web Interface

User-friendly interface for market creation, trading, and portfolio management

๐Ÿ”ฌ

Mathematical Implementation Details

Fixed-Point Arithmetic

Stroop Conversion

XLM amounts multiplied by 10โท to convert to stroops (1 XLM = 10โท stroops) XLM amounts multiplied by 10โท to convert to stroops (1 XLM = 10โท stroops), ensuring all calculations work with integers and maintain precision down to the smallest unit

Rust Fixed Crate

Uses the Rust fixed crate's built-in ln() and exp() functions, which provide deterministic results across all blockchain nodes without custom implementations

Deterministic Results

The fixed crate ensures identical results across all network nodes, preventing consensus issues that could arise from floating-point arithmetic

Computational Efficiency

LMSR Operations

  • ln() and exp():~10-50ns
  • Cost function:~100ns
  • Price calc:~50ns
  • Total per trade:~200ns

Cryptographic Operations

  • Ed25519 verification:~50-100ฮผs
  • Transaction auth:~100-200ฮผs
  • Crypto overhead:~300ฮผs

Mathematical operations are 1000x faster than cryptographic operations, making LMSR calculations negligible in terms of computational cost.

๐Ÿ”

Risk Warning

All prediction market participation involves risk:

โš ๏ธ

Seeders

Should expect to lose most or all seed capital at resolution. Profitability depends entirely on collecting sufficient trading fees during the market's active life, which cannot be guaranteed.

โš ๏ธ

Traders

Can lose their entire stake if they bet on incorrect outcomes or sell at unfavorable prices. Market manipulation and unexpected events can impact outcomes.

Only participate with funds you can afford to lose. Past performance of similar markets is not indicative of future results.

๐Ÿ“š

Further Reading

  • ๐Ÿ“„Ludwig Boltzmann, "Studien รผber das Gleichgewicht der lebendigen Kraft zwischen bewegten materiellen Punkten" (1868)
  • ๐Ÿ“„Robin Hanson, "Logarithmic Market Scoring Rules for Modular Combinatorial Information Aggregation"
  • ๐Ÿ“„Abraham Othman, et al., "Automated Market Makers for Prediction Markets"
  • ๐Ÿ“„Sorocast Technical Whitepaper (coming soon)