Many people who have traded on Cardano have used an automated market maker: you swap against a pool, and the price moves with the pool's balance. Nightshade DEX, which is now live on Midnight mainnet, takes the other route. It keeps an order book, and every order on it is placed and filled through zero-knowledge proofs. This is how that works, and what we learned building it.
Midnight in one paragraph
Midnight is Cardano's partner chain built for data protection. Contracts are written in Compact, Midnight's smart-contract language, and every contract call carries a zero-knowledge proof that it followed the contract's rules. Network fees are paid in DUST, which is generated by holding NIGHT, so a NIGHT holder can cover their own fees without buying a separate gas token.
An order book instead of a pool
On Nightshade you can swap at the best prices currently on the book, or place a limit or stop order at the price you choose. A limit order rests on the book until someone trades against it or you cancel it. The fee follows the usual order-book split: whoever takes liquidity pays a 0.2% taker fee, whoever provides it pays no maker fee, and DUST pays the network fee either way.
The proof is made on your device
Because every contract call needs a proof, the question is where that proof gets made. On Nightshade it is made in your browser, on your own device, so there is no proof server to install or trust. You can connect with the Lace wallet, or use a passkey wallet that opens with Face ID or Touch ID and keeps the wallet on your device.
Keeping the books honest
An exchange contract has to account for every token it holds. Our contract tests run each circuit in process, without a network or proofs, and after every call check that what the contract holds of each token matches exactly what its pools, orders and fees account for. The website plans orders with its own copy of the book's planning logic, written in Rust, and a fixture test fails as soon as it would plan an order differently from what the contract accepted.
What we hit along the way
Building on a young network means finding its rough edges. We ran into a bug in Midnight's ledger and reported it as servicedesk issue #299 (ChargedState). If you are building on Midnight and your contract calls start failing without an obvious cause, it is worth a look.
Try it
Nightshade DEX is live at nightshade.finance, with documentation linked from the site. We would welcome feedback, bug reports and questions from the Cardano community, on X at @NightshadeDEX.
The Nightshade DEX team