Example: On-Chain Orderbook

The North Star Orderbook (live demoarrow-up-right | sourcearrow-up-right) demonstrates a fully on-chain central limit orderbook — a workload that is effectively impossible on a shared execution environment at production scale.

North Star Orderbook

Why Orderbooks Need Ephemeral Rollups

Requirement
Shared Execution
Dedicated ER

Matching latency

≥400ms (slot time)

<50ms

Throughput

~65K TPS shared

>1M TPS dedicated

Account writes

30-50K writes/s for a single market

Unlimited within session

Cost at 10K orders/s

~$648/day ($236K/year)

Near-zero (session fee only)

  • Matching latency: <10ms order-to-fill is required for competitive market making. Shared execution means market makers face >400ms adverse selection risk per order.

  • Throughput: A liquid SOL/USDC market generates 5,000–50,000 order events/second (places, cancels, amendments).

  • State updates: Each order modification touches 3-5 accounts. At 10K orders/s, that's 30-50K account writes/s for a single market.

  • Cost: At 10K orders/s × $0.00075/tx = $648/day in fees. Professional market makers would pay >$200K/year in execution fees alone.

Architecture

Frontend (Reactarrow-up-right + Vitearrow-up-right)

Order Types

  • Limit orders: placed at a specific price level, rest on the book until filled or cancelled

  • Market orders: execute immediately against the best available price

  • Order sizes follow a power-law distribution: 60% small (0.5–20 SOL), 30% medium (20–100 SOL), 10% large (100–500 SOL)

Matching Engine (on ER)

The matching engine runs as a Solana program on the Ephemeral Rollup. Orderbook state (bids, asks, user positions) is delegated to the ER at session start. Matching executes in <1ms per order. Token vaults remain on L1 — the ER reads them in readonly mode and settles via the Portal on session close.

Performance Characteristics

Metric
Value

Order placement → fill

<50ms (vs. >400ms on shared L2)

Orderbook depth

18 levels × 2 sides = 36 price levels per tick

Tick rate

500ms (2 Hz) — scales to 100Hz+ on dedicated ER

Spread

0.01–0.08 tick size

Settlement

Batch to L1 on session close — net token transfers, not per-trade

Last updated