Dark Pool Trading

The Obelysk Dark Pool is a commit-reveal batch auction that eliminates front-running, sandwich attacks, and MEV extraction. All orders in an epoch are matched at a single uniform clearing price per trading pair.

5
Trading Pairs
3 blocks
Epoch Length
0
MEV Extracted
30bps
Fee

Why a Dark Pool?

On regular DEXes, your orders are visible in the mempool before execution. This enables:

  • Front-running: Bots see your buy order and buy first, profiting from the price impact
  • Sandwich attacks: Bots buy before you and sell after, extracting value from your trade
  • MEV extraction: Validators reorder transactions to maximize their profit at your expense

The Dark Pool eliminates all of these by hiding orders until after the commit phase closes.

Epoch Lifecycle

Each epoch spans 3 consecutive Starknet blocks:

1
Block N — COMMIT Phase
Traders submit sealed orders. Only the order_hash and amount_commitment are visible on-chain. Price, quantity, and direction are completely hidden. Even the contract cannot see your order details.
2
Block N+1 — REVEAL Phase
Traders open their commitments by revealing price, amount, and salt. The contract verifies each reveal matches its committed hash. No new orders can be placed.
3
Block N+2 — SETTLE Phase
Permissionless on-chain settlement. All orders per pair are matched at a single uniform clearing price P*. Buy orders at P* or above and sell orders at P* or below are filled.
Uniform Clearing Price

Unlike a traditional orderbook where each order gets a different price, the dark pool settles ALL orders in an epoch at one price. This means there's no advantage to being first — everyone gets the same deal.

Order Commitment Scheme

During the COMMIT phase, orders are sealed using:

order_hash = Poseidon(price || amount || salt || side || pair_id)
amount_commitment = amount · G + blinding · pk   (ElGamal encrypted)
balance_proof = Schnorr proof of sufficient balance
Why Salt?

The salt is a random value that prevents rainbow table attacks on the order hash. Without it, someone could try hashing all possible (price, amount, side) combinations to reverse the commitment.

Supported Trading Pairs

PairBase AssetQuote Asset
ETH/STRKETHSTRK
ETH/USDCETHUSDC
wBTC/ETHwBTCETH
wBTC/STRKwBTCSTRK
wBTC/USDCwBTCUSDC

Privacy Guarantees

PropertyDuring CommitDuring RevealAfter Settlement
Order priceHiddenVisibleVisible
Order amountHiddenVisibleVisible
Trader identityHidden (relayer)Hidden (relayer)Hidden (relayer)
Front-runningImpossibleImpossibleN/A
MEV extractionImpossibleImpossibleImpossible
Relayer Privacy

Orders are submitted through the Dark Pool Relay at https://relay.bitsage.network. The relay uses session keys (SNIP-9 outside execution) so the on-chain transaction comes from the relay account, not your address.

SDK Usage

// 1. Deposit tokens into the dark pool
await obelysk.darkPool.deposit({ token: 'sage', amount: '10000' });

// 2. Check current epoch
const epoch = await obelysk.darkPool.getEpochInfo();
console.log(`Epoch ${epoch.epochNumber}: ${epoch.phase}`);

// 3. Commit an order (during COMMIT phase)
const order = await obelysk.darkPool.commitOrder({
  pair: 'SAGE/STRK',
  side: 'sell',
  price: '0.011',
  amount: '5000',
});

// 4. Reveal the order (during REVEAL phase)
await obelysk.darkPool.revealOrder({
  commitment: order.commitment,
  pair: 'SAGE/STRK',
  side: 'sell',
  price: '0.011',
  amount: '5000',
  salt: order.salt,
});

// 5. Claim fills after settlement
await obelysk.darkPool.claimFill({
  epochNumber: epoch.epochNumber,
  pair: 'SAGE/STRK',
});

Contract Details

  • Address: 0x0230b5822556f0d9afca7b02f01e37cb9cf2a7e8d590a9020e9bbca183ea7727
  • Fee: 30bps on matched trades (per-asset accumulation)
  • Upgrade timelock: 48 hours
  • Session key registry: SNIP-9 outside execution support

Next Steps