Inspiration

When you try to execute a large trade on a standard DEX, the order size and price limits are completely visible in the public mempool before execution. Trading bots immediately pick up these signals, front-run the position, and spike the clearing price. We wanted to build a decentralized dark pool that stops this front-running manipulation entirely without compromising on regulatory compliance.

What it does

Obsidian is an over-the-counter dark pool that uses zero-knowledge proofs to hide order details. When a user submits an order, it shows up on the block explorer as a blind 32-byte hash instead of cleartext. An off-chain matchmaker couples buyers and sellers privately. Then, our smart contract cryptographically verifies that the assets match and the prices overlap without revealing the actual numbers. After a match, the contract deletes the active order slots from the ledger and inserts an encrypted compliance payload for audit purposes.

How we built it

The core architecture is a Compact smart contract on Midnight for submit, match, and settle on the public ledger. Every on-chain step (submit_order, propose_match, atomic_settle) goes through a zk-proof pipeline: the Compact compiler emits circuit artifacts (prover keys, verifier keys, ZKIR), and each transaction is proven via Lace’s proving provider or the local HTTP proof server before it’s submitted. Traders only publish opaque 32-byte commitments and nullifiers on-chain; matching still happens off-chain in a TypeScript relayer that reads a cleartext intent pool to see where BUY and SELL legs cross, then calls propose_match with price and asset bounds as circuit inputs so the ledger can enforce buyer_max ≥ seller_min and same-asset rules without a public order book. The rest runs locally in Docker, a React UI on Lace + proof server.

Challenges we ran into

We wanted the contract circuit to handle real shielded token swaps directly but we realized the current compiler version restricts custom contracts to ledger map coordination, meaning they cannot physically hold or swap native tokens. We had to pivot to a clearing architecture where the contract acts as a secure match gatekeeper instead of a direct token router. We also had to save circuit space by indexing matches under just the buyer commitment, shifting the pairing logic to our off-chain TypeScript code.

Accomplishments that we're proud of

We are proud of tackling a fundamentally crypto-native problem by keeping large order parameters safe from predatory front-running bots. We got the entire zero-knowledge state machine running smoothly on a local devnet sandbox. The test suite successfully handles deployment, registers hidden intents across separate wallets, validates price overlap rules, and clears ledger tracks upon settlement. We are especially proud of the architectural design and the fact that the entire system loops reliably end to end.

What's next for Obsidian

We need to build automated execution tracking. Once the network infrastructure expands its standard library token APIs, we plan to wire native shielded wallet transfers directly to our on-chain settlement confirmations. We also want to migrate our off-chain matchmaker to a decentralized peer-to-peer network and implement asymmetric encryption for the regulatory compliance data map.

Built With

Share this project:

Updates