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.
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:
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
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
| Pair | Base Asset | Quote Asset |
|---|---|---|
| ETH/STRK | ETH | STRK |
| ETH/USDC | ETH | USDC |
| wBTC/ETH | wBTC | ETH |
| wBTC/STRK | wBTC | STRK |
| wBTC/USDC | wBTC | USDC |
Privacy Guarantees
| Property | During Commit | During Reveal | After Settlement |
|---|---|---|---|
| Order price | Hidden | Visible | Visible |
| Order amount | Hidden | Visible | Visible |
| Trader identity | Hidden (relayer) | Hidden (relayer) | Hidden (relayer) |
| Front-running | Impossible | Impossible | N/A |
| MEV extraction | Impossible | Impossible | Impossible |
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
- Shielded Swaps — private AMM swaps via Ekubo
- Privacy Pools — shielded deposit/withdrawal
- ElGamal Encryption — the encryption behind balance commitments