Skip to content
AnnouncementSomnia Oracle settles event contracts onchain, in minutes, with receipts.

Onchain order books for any market.

Somnia Markets is one fully onchain order-book engine for spot pairs, binary event contracts and perpetuals. Matching, escrow, settlement, market creation and resolution all run in public contracts; the SDK and APIs are conveniences over them, with no privileged access.

Product statusSomnia docs
Spot
Live on mainnet
Event contracts
Live on mainnet
Perpetuals
Testnet · mainnet coming soon
Liquidity Vaults
Coming soon
Quote and collateral
USDso
Protocol fee
None · venue and builder fees may apply

Live spot pairs: WETH, WBTC, SOMI and USDC.e against USDso.

Venue front end (Branded app, your fee), TypeScript SDK (Books, trades, positions), Raw contracts (Any language, RPC and ABIs) reach One order-book engine: Price-time matching, Escrow on placement, Same-block settlement. It runs Spot (Live on mainnet), Binary events (Live on mainnet), Perpetuals (Testnet · mainnet coming soon), with Index price feed: Mark prices for stops and margin; Somnia Oracle: Resolves binary markets; GraphQL indexer: Books, fills and candles. Every step onchain · APIs add no privilege.

From order to fill, in one state transition.

Placing an order escrows its worst-case value up front. The matching contract pairs orders by price and time, and balances move in the same transition as the match: a fill is complete and final, or it never happened.

Place order: Venue app, SDK or code. Escrow: Buys lock quote, sells lock base. Match: Price-time priority. Settle: Balances move with the match. Index and stream: Shared GraphQL indexer. One state transition: match and settle. No offchain matcher · No batch reconciliation · A fill is final or never happened.

Three market families. One engine.

Spot, binary event contracts and perpetuals share one order-book core, one settlement path and one indexer. Each family keeps its own rules.

  • Spot

    Live on mainnet

    Base and quote books against USDso, for crypto and tokenized RWAs.

    Orders
    GTC, IOC, FOK and post-only
    Stops
    Stop-loss and take-profit, onchain registry
    Quoting
    Amend, batch place and batch cancel
    Live pairs
    WETH, WBTC, SOMI, USDC.e
  • Event contracts

    Live on mainnet

    A yes or no question whose shares trade at prices that read as probabilities.

    Shares
    ERC-6909, backed 1:1 by collateral
    Payout
    1 USDso per winning share, less venue settlement fee
    Void
    Refunds 0.5 USDso per side
    Resolution
    Somnia Oracle via Reactivity
  • Perpetuals

    Testnet

    Linear, collateral-settled perps on crypto and RWAs, on the same engine. Mainnet is coming soon.

    Margin
    Cross-margin from one USDso pool
    Funding
    Settled onchain between longs and shorts
    Mark
    EMA price, published onchain
    Liquidation
    Staged waterfall to auto-deleveraging

Liquidity Vaults are coming soon. Further details will follow.

Perpetuals docsEvent contracts docs

What a trade costs, and who sets each part.

Somnia Markets charges no protocol fee. That does not make trading free: venue fees, builder fees, gas, spread and, on perps, funding and liquidation are separate costs.

Costs on Somnia MarketsRead live values onchain
CostWho sets itWhere it applies
Protocol feeSomnia Markets: noneEvery market
Venue feeThe venue. On binary markets, maker, taker and settlement rates are frozen at market creationMarkets the venue operates
Builder feeThe routing front end, after the trader approves it for that pool, up to the pool’s capOrders that carry builder attribution
Network gasThe Somnia network; venues can sponsor it on core pairsEvery transaction
Funding and liquidationOnchain perp rulesPerpetuals, on testnet
SpreadThe order bookEvery taker trade

Who controls what, written into the contracts.

A venue configures its markets. A trader keeps control of funds and approvals. The protocol runs the parts no venue or API can bend.

  • TraderSelf-custody
    Funds
    Escrowed by the pool contract, not held by a venue
    Builders
    Approved per pool, with a maximum fee
    Keys
    Operators and session keys can trade spot and perps without custody
    Orders
    Expiry and self-match choice on every order
  • Venue operatorConfigurable
    Venue
    Registered under your operator address
    Market type
    Fixed when the venue is created
    Fees
    Rates and recipient; binary rates frozen per market
    Listing
    Open or gated market creation
    Users
    Open or allow-list, optional gas sponsorship
  • ProtocolSame for every venue
    Matching
    Price-time, deterministic within the block
    Settlement
    Atomic with the match
    Resolution
    Binary markets resolve onchain, no operator in the loop
    Prices
    Each pool pushes its own mark price
    APIs
    Conveniences over public contracts, no privilege

Start building. Two ways in.

Both paths reach the same public contracts. Build and test on the Shannon testnet first, then point the same code at mainnet.

TypeScript SDK@somnia-chain/markets-sdk
pnpm add @somnia-chain/markets-sdk viemconst exchange = new SomniaMarkets(config);await exchange.loadMarkets();const book = await exchange.watchOrderBook(symbol);

For apps and bots in a JS runtime

Realtime books, trades, candles and positions, plus a typed trader for orders, margin and outcome shares.

Raw smart contractsAny language

No SDK needed. Discover markets, place orders and build a live local order book straight from contract events.

Needs
An RPC node and the contract ABIs
Pools
SpotPool, BinaryPool and PerpPool
Book
Materialized from contract events
Live view
System page: contracts, owners, indexer health

Put your market on Somnia Markets.

Talk to the team about launching a venue, quoting the books or routing flow, or start in the docs today.