What Is a Sandwich Attack?
A sandwich attack wraps your trade between two of the attacker's: a buy placed just before yours pushes the price up, your swap executes at the worse price, and the attacker's sell right after harvests the difference. You receive fewer tokens than quoted; the gap is the attacker's lunch. It is the most common form of extractive MEV and it feeds on ordinary swaps daily.
How It Actually Works
- Your pending swap sits visible in the mempool with a slippage tolerance attached.
- A bot calculates exactly how much it can move the pool price against you while keeping your trade within tolerance, buys that amount first, lets your swap land, then sells.
- Your tolerance is the attacker's budget: 5 percent slippage invites a bite sized accordingly. The whole round trip fits in one block, risk-free when executed correctly.
Risks and Common Mistakes
- Cranking slippage to force a trade through a volatile launch, which converts your urgency into the bot's margin. This is half the true cost of chasing memecoin launches.
- Trading size against thin pools, where even tight tolerances leave a worthwhile gap.
- Blaming the DEX interface. The venue quoted honestly; the ordering around you did the damage.
Defenses That Actually Help
- Tight slippage, always, and accepting reverts as the cost of not being food.
- Private routing or MEV-protected RPCs where your wallet offers them, keeping your intent out of the public pool.
- Splitting large swaps and preferring deep pools; aggregators that route through them, like the one reviewed in my Jupiter review, reduce the exposed surface.
When It Matters
Every AMM swap, priced into DeFi like weather. Know the mechanism and set tolerances like someone who does.
Related Terms
Glossary · Learn · Resource Library · Return to Official Home Page
Copyright © 2026 Crypto Guidance Inc.