Skip to content
commit-reveal Source  →

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

  1. 01 Commit phase: each trader publishes commitment = H(intent ‖ salt). The order parameters are hidden.
  2. 02 The sealed window closes on a deadline or a batch boundary — no new information can enter it.
  3. 03 Reveal phase: traders reveal (intent, salt); the timing-safe check confirms each matches its commitment.
  4. 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)