Glossary entry
Sandwich Attack
Wallets & SecurityA sandwich attack brackets a pending swap with a buy and a sell. How slippage tolerance enables it and which defences actually reduce exposure.
Definition
A sandwich attack surrounds a victim's pending swap with two transactions from the attacker: a buy placed just before it, which pushes the pool price up, and a sell placed just after, which unwinds the position at the worse price the victim's own trade created. It works only because transaction ordering inside a block can be bought, and because the victim's transaction was visible in the mempool with a slippage tolerance loose enough to absorb the move. Defences are practical rather than cryptographic: set a tight slippage limit so an unfavourable fill simply reverts, break large swaps into smaller ones, use pools deep enough that the manipulation is unprofitable, or submit through a private relay.
Next