How can decentralized exchanges mitigate sandwich attacks without reducing liquidity?

Sandwich attacks occur when a hostile actor observes a pending trade that will move an automated market maker price, places a buy (or sell) order immediately before it, and a counter-order immediately after, capturing profit at the trader’s expense. The root cause is exposed transaction ordering and a public mempool that enables real-time extraction of information. Consequences include worse execution for retail traders, increased slippage, higher implicit costs that push traders to centralized venues, and long-term pressure toward centralization of block production and private relays.

Cryptographic and market-design mitigations

Research by Philip Daian Cornell University highlighted miner and validator incentives that enable these extraction strategies, motivating technical responses that preserve on-chain liquidity while reducing extractable rent. One effective approach is encrypted mempools and threshold encryption, where transactions are submitted encrypted and only revealed in order once a block is proposed. This prevents front-runners from seeing actionable intents before inclusion, while allowing the same transactions to execute on-chain so liquidity is not removed. Another approach is batch auctions that group transactions and determine clearing prices simultaneously; by eliminating sequential ordering within a batch, opportunities for sandwiching are greatly reduced without shrinking available liquidity. Commit-reveal schemes can achieve similar effects for specific order types by committing to intent first and revealing details later, although they introduce latency.

Sequencing services and private relays

Emerging infrastructural models such as proposer-builder separation and dedicated private relays let builders or relays aggregate transactions off the public mempool and deliver bundles to proposers in ways that disincentivize sandwich strategies. When combined with transparent auction mechanisms for block-building fees, these systems can align incentives against predatory ordering while keeping AMM pools fully accessible. Careful design is required to avoid replacing one central point of extraction with another.

Trade-offs and cultural implications

No single fix is free. Cryptographic solutions add complexity and require coordination among validators, while batch auctions can increase execution latency that matters for some trading strategies. Socially and territorially, traders in regions with limited infrastructure may favor low-latency trades and thus experience disparate impacts; governance choices about sequencing services reflect cultural priorities between fairness and speed. Overall, layered solutions that mix encryption, fair sequencing, and incentive-aligned builder markets offer the most promising path to mitigate sandwich attacks without reducing on-chain liquidity.