DEX, intent, and sequencer designers
Anti-MEV & fair ordering
Front-runners cannot react to orders they cannot yet see.
Order intents commit during a sealed window, then reveal for matching. Because a commitment leaks nothing, a searcher cannot front-run or sandwich an order until it is revealed — and by then the ordering is fixed. Commit-reveal removes the timing edge that MEV extraction depends on.
The problem
Most value extracted on public chains comes from one root cause: someone sees your transaction in the mempool and reacts before it is final. Sandwich attacks, front-running, and back-running are all timing attacks on information that leaked too early. Encrypting the mempool is one answer; committing to intents first is the simpler, dependency-free one.
How commit-reveal does it
- 01 Commit phase: each trader publishes commitment = H(intent ‖ salt). The order parameters are hidden.
- 02 The sealed window closes on a deadline or a batch boundary — no new information can enter it.
- 03 Reveal phase: traders reveal (intent, salt); the timing-safe check confirms each matches its commitment.
- 04 Matching runs over the revealed set. A searcher who never saw the orders cannot have reordered around them.
The code
scheme = CommitRevealScheme()
# --- commit phase (sealed window) ---
commitment, salt = scheme.commit("swap:1000 USDC->ETH,limit:2500")
publish(commitment) # intent is hidden until reveal
# --- reveal phase (window closed) ---
assert scheme.reveal("swap:1000 USDC->ETH,limit:2500", salt, commitment) More use cases
Verifiable on-chain AI
Independent agents answer without copying each other.
Sealed-bid auctions
No bidder can peek at another’s bid before the deadline.
Fair-launch randomness
Uniform, unmanipulable randomness with no trusted oracle.
Hidden ballots & market resolution
Vote or resolve in secret, prove the reveal is honest.
Teaching cryptography
A readable, zero-dependency reference you can teach from.