HOME
/
GLOSSARY
/
Sandwich Trading

Sandwich Trading

A sandwich attack is a form of MEV (Maximal Extractable Value) manipulation where a bot spots your pending swap in the mempool, places a buy order just before your trade and a sell order right after it, and profits from the price movement your trade causes. You pay more for the tokens you are buying, and the bot pockets the difference.

How a Sandwich Attack Works

Every transaction on Ethereum and most EVM-compatible chains sits in a public waiting area called the mempool before a validator includes it in a block. MEV bots monitor this mempool in real time, scanning for large token swaps on decentralized exchanges like Uniswap.

When a bot detects your swap, it runs a quick calculation. If your trade is large enough to meaningfully move the price of the token, the bot has a profitable opportunity. It submits two transactions: one to buy the token just before your trade, and one to sell immediately after. The bot pays a higher gas fee to push its buy order in front of yours, and a lower fee to place its sell order just behind you.

Your trade arrives in the middle of those two bot transactions, like meat in a sandwich. The bot's buy order raises the price you receive. Your trade pushes it higher. The bot sells into that elevated price and exits with a gain. You get fewer tokens than you expected at the start.

Why You Are a Target

The size of your trade and your slippage tolerance determine whether sandwich attacks are worth targeting. If you set a wide slippage tolerance, say 5% or 10%, you are telling the bot exactly how much it can extract before your transaction reverts. Bots use that tolerance ceiling as a profit guide.

Large swaps in thin liquidity pools are the most vulnerable. A $100,000 swap in a pool with $500,000 of liquidity can move price by several percentage points. That magnitude of movement is worth the gas cost for a bot to exploit.

How to Reduce Your Exposure

You can take several practical steps to make your swaps less attractive to sandwich bots.

  • Lower your slippage tolerance. Set slippage to 0.5% or 1% for liquid pairs. Your trade may revert more often, but that is better than being systematically front-run.
  • Use a private RPC endpoint. Services like Flashbots Protect route your transaction directly to validators without broadcasting it to the public mempool. Bots cannot front-run transactions they cannot see.
  • Break large trades into smaller ones. Multiple smaller swaps generate less price impact per transaction and reduce the profit available to front-running bots.
  • Use MEV-protected DEX aggregators. CoW Protocol (Coincidence of Wants) batches orders off-chain and settles them together, eliminating individual front-running exposure. 1inch Fusion uses a similar approach.

The Broader MEV Problem

Sandwich attacks are one type of MEV extraction. The broader category includes arbitrage, liquidation running, and transaction ordering manipulation. Flashbots, an Ethereum research organization, estimates that hundreds of millions of dollars in MEV were extracted annually from Ethereum users prior to the Merge in 2022. Addressing MEV is an active area of protocol research, with proposals like encrypted mempools and MEV smoothing discussed as potential long-term solutions.

Sources

https://www.flashbots.net/mev-explore
https://ethereum.org/en/developers/docs/mev
https://cow.fi
https://docs.uniswap.org/concepts/protocol/swaps

About the Author
Jan Strandberg is the Founder and CEO of Acquire.Fi. He brings over a decade of experience scaling high-growth ventures in fintech and crypto.

Before founding Acquire.Fi, Jan was Co-Founder of YIELD App and the Head of Marketing at Paxful, where he played a central role in the business’s growth and profitability. Jan's strategic vision and sharp instinct for what drives sustainable growth in emerging markets have defined his career and turned early-stage platforms into category leaders.
Buy and sell secondaries
Trade SAFT, SAFE notes, locked tokens, and other digital assets in the public Secondaries and OTC marketplace
Acquire a frontier tech business
Browse our curated list of frontier tech businesses and projects available for acquisition; including revenue-generating crypto platforms, DeFi projects, and licensed financial organizations.