Skip to main content

How Does a Commit-Reveal Scheme Protect a Trade from Being Front-Run?

A commit-reveal scheme works in two phases. In the "commit" phase, a trader submits a cryptographic hash of their transaction (the commitment) to the blockchain, but the actual trade details are kept secret.

In the later "reveal" phase, the trader submits the original, unhashed transaction data. Since the front-runner only sees the hash in the mempool, they cannot determine the trade's details or profitability to exploit it, thus ensuring the trade is executed fairly.

Define ‘Front-Running’ in the Context of DeFi and Oracle Feeds
What Is a “Front-Running” Attack in DeFi and How Does It Undermine Trustless Execution?
How Do Private Transaction Relays Work to Hide Orders from Front-Runners?
What Is a Second-Preimage Attack and How Does It Differ from a First-Preimage Attack?