Technical Definition

Sandwich attack

A sandwich attack places one trade before and another after a user's DEX trade to profit from the price movement caused by that user's transaction.

By Crypto University Editorial
MEVFront-runningSlippage

✦ Key Insight

Sandwiching can directly worsen execution for DEX users. Larger trades, thin liquidity, and wide slippage settings can make a transaction more attractive to sandwich searchers.

✕ Common Misconceptions

Setting extremely tight slippage can reduce sandwich room but may also make legitimate transactions fail. Use reputable routing, reasonable slippage settings, and protective transaction-routing features where available.

Detailed Explanation

The attacker or searcher first trades in the same direction as the user's pending swap, moving the price against the user. The user's trade then executes at a worse price within its slippage tolerance. The searcher trades back afterward and attempts to keep the difference as profit.

In Practice

“A user submits a large token swap with 3% slippage. A searcher buys first, the user's swap pushes the price higher, and the searcher sells immediately afterward at the higher price.”

Dig Deeper