Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
A slippage sandwich lets a bot buy before and sell after your DEX swap. Here is how to spot one and defend your trades.
A slippage sandwich is when a bot spots your pending DEX swap and trades around it. It buys the same token right before you to push the price up. You fill at the worse price. Then it sells right after for profit.
You placed a swap. The quote promised one number. Your wallet received less. If a bot wrapped a trade around yours to skim the difference, you were sandwiched. It is one of the most common ways retail DeFi traders quietly lose money, and you never see the attacker.
This guide is for the trader who just got a bad fill and wants to know what happened. It separates normal slippage from a real attack. It walks the mechanism in order. And it gives you a concrete way to check if a past swap was sandwiched. Then it covers the defenses you can set up today across Ethereum, Layer 2s, and Solana.
A slippage sandwich is a bot placing one trade just before yours and one just after. Your swap fills at a worse price, and the bot pockets the difference. In trader talk, “slippage sandwich,” “sandwich attack,” and “getting sandwiched” all mean the same thing.
Picture a sandwich. The bot’s buy is the top slice of bread. Your swap is the filling. The bot’s sell is the bottom slice. Your trade sits squeezed in the middle, and the bot eats on both sides.
The name pairs “slippage” with “sandwich” for a reason. Slippage is the gap between the price you were quoted and the price you actually got. A sandwich attack widens that gap on purpose, then keeps the extra value for the bot.
This is a form of MEV, short for Maximal Extractable Value. That is the value someone can extract by controlling the order of transactions in a block.
You do not need to master MEV to grasp a sandwich. Just know that bots compete to sit next to your trade because doing so is profitable.
Here is the key point. This is not a bug in the DEX. The bot uses public data and valid transactions. It simply saw your swap coming and traded around it. That “you are the mark” dynamic is the same one behind being exit liquidity, where someone else’s exit is funded by your entry. A sandwich just does it in the space of a single block.
A slippage sandwich works because your transaction is visible before it settles. When you submit a swap on most DEXs, it sits in a public waiting area called the mempool. Bots watch that area constantly, scanning for swaps large enough to move a price.
The sequence runs in four beats.
First, the bot spots your pending swap and reads how much it will shift the price. Then it front-runs you. It buys that token first and pays a higher priority fee, so its transaction lands ahead of yours. That buy pushes the price up.
Next, your swap executes at the new, worse price. It fills right up to the limit your slippage tolerance allows. Finally, the bot back-runs. It sells the tokens it just bought, now at the price your trade helped create. The gap between the two is its profit.
All of this happens in one block, often within a couple of seconds. You never see a warning. You just get fewer tokens than the quote suggested.
The weak point is the public transaction itself. Because anyone can read the mempool, your intent to buy is broadcast before it is final. The bot is not guessing. It is reacting to a trade it can already see.
Bigger swaps and thinner liquidity pools make juicier targets, because your trade moves the price more. A tiny swap in a deep pool barely shifts anything, so bots ignore it.
This is one move in a wider family of predatory tactics. A liquidity hunt pushes price to trigger stops and grab liquidity. A sandwich squeezes value out of a single fill. Different tools, same goal: profiting from where your money sits and what it is about to do.
Slippage and a sandwich attack get conflated constantly, but they are not the same thing. Slippage is normal. A sandwich attack abuses it.
Slippage is the price movement between the moment you are quoted and the moment your trade settles. Prices move. Other people trade. In a fast or thin market, the price you get can drift from the price you saw. That drift is slippage. A small amount is unavoidable.
Your slippage tolerance is the maximum drift you agree to accept before the swap cancels. Set it to 0.5% and your trade fails if the price moves more than that against you. Set it to 20% and you are telling the DEX you will accept almost any fill.
That high tolerance is the door a bot walks through. The wider you leave it open, the more room the bot has to push the price before your swap still goes through. Your generous setting becomes its profit margin.
The table below sums up the split.
| Slippage | Sandwich attack |
|---|---|
| Natural price drift between quote and fill | A bot deliberately widening that drift |
| Happens with no attacker present | Requires a bot trading around you |
| You control it with your tolerance setting | It exploits a loose tolerance setting |
| Costs a little in normal conditions | Costs as much as your tolerance allows |
So slippage is the weather. A sandwich is someone using that weather against you. Controlling your tolerance is where you take back control. That is why the defenses later in this guide start there.
A bad fill is not proof of a slippage sandwich, so start by checking rather than assuming. Thin liquidity, a volatile minute, or a genuinely large order can all cost you tokens with no bot involved. Detection is about looking at the chain, not the quote.
Start with the gap. Compare the amount the DEX quoted against the amount your wallet actually received. A small difference is ordinary slippage. A large one on a fairly liquid pair is a red flag worth investigating.
Then open your transaction on a block explorer and look at the block it landed in. A sandwich leaves fingerprints in the same block as your swap.
Here is what to look for once you are on the explorer:
If you see a buy-then-sell wrapped around your swap by one address, that is the sandwich. The bot entered before you and exited after you, and the price it left behind is the price you paid.
Keep the caveat in mind. One bad fill during a volatile candle, or a swap into a shallow pool, can look painful without any attacker. The same-block, same-address buy-and-sell pattern is what separates a real sandwich from plain slippage.
Per trade, a sandwich often skims a few percent, not your whole balance. On a single modest swap that can feel like a rounding error. At scale, across millions of swaps, it adds up to serious money leaving retail wallets.
The aggregate numbers are large. MEV research firm EigenPhi has tracked sandwich attacks extracting hundreds of millions of dollars from DeFi users in a single year. That is value skimmed from ordinary traders one fill at a time.
Your personal exposure scales with two things. The first is trade size. A bigger swap moves the price more, and that gives the bot more room to work. The second is your slippage tolerance. A loose setting hands the bot a wider margin to capture.
Low-liquidity pairs get hit hardest. A swap into a thin meme-coin pool can move the price sharply, so even a small trade becomes worth sandwiching. The deeper and more liquid the pool, the less a given trade moves it and the less attractive you are as a target.
Cost is not always the visible headline number either. Some manipulation tactics inflate what you pay or push you into a worse decision. One example is fake trading volume that makes a dead pool look active right before you swap into it. The lesson is the same across all of them. Read the chain and the pool, not just the quote on your screen.
You cannot stop bots from watching the mempool, but you can make your swap a bad target. Most defenses come down to two ideas: give the bot less room, or hide your trade from it entirely.
Start with slippage tolerance. On liquid majors, set it tight, around 0.3% to 0.5%. That narrow band leaves almost no margin for a bot to push the price and still fill you. The trade-off is real. Set it too tight on a volatile or thin pair and your transaction may simply fail and need retrying.
The stronger fix is to keep your swap out of the public mempool. A private RPC routes your transaction through a protected channel, so bots cannot see it before it settles. Services like Flashbots Protect and MEV Blocker do this. In MetaMask, you add the private RPC as a custom network endpoint, then swap as usual. Your intent never hits the public waiting room. So there is nothing to sandwich.
Intent-based DEXs are another strong option. Instead of broadcasting a raw swap, you sign an intent. Then solvers compete to fill it at the best price. CoW Swap, UniswapX, and 1inch Fusion work this way, which removes most sandwich exposure by design.
The table below maps each defense to what it actually protects against.
| Defense | What it does |
|---|---|
| Tight slippage (0.3-0.5%) | Leaves a bot almost no price margin to capture |
| Private RPC (Flashbots, MEV Blocker) | Hides your swap from the public mempool |
| Intent-based DEX (CoW, UniswapX, Fusion) | Solvers fill your order without exposing raw trades |
| Splitting large orders | Reduces the price impact each swap creates |
| Avoiding thin pools | Removes the low-liquidity targets bots prefer |
Combine a couple of these and your exposure drops sharply. A tight setting plus a private RPC covers most retail swaps, and moving size trades to an intent-based venue handles the rest.
Sandwiching is not an Ethereum-mainnet-only problem. Anywhere transactions are visible before they settle and prices can be pushed, the attack is possible. That covers far more than Ethereum L1.
On Solana, sandwiching happens through the block-building layer rather than a classic public mempool. Infrastructure like Jito lets searchers bundle transactions. Some bundles wrap a victim’s swap the same way an Ethereum sandwich does. Solana’s speed does not make it immune. It just changes the plumbing.
Layer 2 networks such as Arbitrum and Base run their own sequencers. Their mempool behavior differs from Ethereum L1. That difference is why some people assume L2s are safe. In practice, the risk is reduced in places but not erased. And it shifts as sequencer designs change.
The chain matters most on low-liquidity trades. Solana is a hub for fast meme-coin swaps, many priced on a bonding curve, where a small trade can move the price a lot. Those thin, volatile pools are exactly what sandwich bots hunt, whatever the underlying chain.
So apply the same defenses everywhere. Use tight slippage. Prefer protected routing where it exists. Be extra careful on shallow pools, whatever chain you trade on. On Solana that often means a wallet or aggregator that supports Jito bundle protection. On an L2 it means checking whether your router offers private submission. Do not assume a faster or cheaper chain is a safer one.
Slippage sandwich attacks are generally not illegal in most places today, even though they feel predatory. This is not legal advice, and the picture is evolving, but the core reason is worth understanding.
A sandwich uses public on-chain data and valid, ordinary transactions. The bot did not hack your wallet or break the DEX. It read information anyone can read and paid a fee to have its trades ordered a certain way. Nothing there is obviously against the rules of the network.
That is also why it frustrates first-time victims. It is legal in a technical sense yet clearly unfair in feel. You carried the cost. A bot took the upside for doing nothing you would call productive. There is usually no counterparty to name, no support desk to email, and no refund to request.
Pushback is growing on two fronts. Regulators are paying more attention to MEV and market fairness in DeFi. And protocols are building defenses straight into how trades settle, from private routing to intent-based designs. The direction of travel is toward making sandwiching harder, not toward a formal ban.
For now, a sandwich is a risk you manage, not a crime you can report. Your realistic protection comes from settings and routing, not from any complaint you could file. So the defenses in this guide do far more for you than the legal system will.
You do not need to overhaul your setup to shut most slippage sandwiches out. A few concrete moves cover the majority of your exposure. The goal is not perfect protection. It is making your swap boring enough that bots skip it for an easier target.
Work through the list in order. The first item is diagnostic, so you can see whether a past fill was actually sandwiched before you change anything. The rest are the settings and venues that close the gap for future swaps.
Here are the first actions worth taking today:
For genuinely large positions, mempool exposure is a good reason to consider venues that do not broadcast raw swaps at all. Moving size into crypto derivatives or OTC-style desks keeps your intent off the public chain entirely. A single six-figure market swap on a public DEX is exactly the kind of order bots wait for. So the venue you choose can matter more than the setting you pick.
Do all of this once and it mostly runs on autopilot. The private RPC stays in your wallet. The tight tolerance becomes a habit. And you only think about sandwiches again when a fill looks off. Match the venue to the size, keep your defaults sane, and most slippage sandwich risk stops being your problem.
A slippage sandwich is a bot buying a token right before your DEX swap and selling right after. You fill at a worse price, and the bot keeps the difference. Your trade is the filling squeezed between the bot’s two trades.
Open your swap on a block explorer and look at the same block. If one address bought your token right before your transaction and sold it right after, in a matching round-trip, that is a slippage sandwich. A bad fill with no such pattern is usually just normal slippage.
Yes, in most cases. A private RPC like Flashbots Protect or MEV Blocker routes your swap through a protected channel instead of the public mempool. Because bots cannot see the trade before it settles, there is nothing to build a slippage sandwich around.
Generally no, in most places today. A slippage sandwich uses public on-chain data and valid transactions, so it is not treated as hacking or fraud, even though it feels predatory. This is not legal advice, and regulators and protocols are increasingly pushing back on the practice.
Yes. A slippage sandwich can happen on Solana through bundle infrastructure like Jito, and on Layer 2s such as Arbitrum and Base through their sequencers. Speed and different plumbing reduce the risk in places but do not make any of these chains immune.
Tight slippage of around 0.3-0.5% on liquid majors gives a bot almost no margin to run a slippage sandwich. The trade-off is that too-tight a setting on thin or volatile pairs can cause your swap to fail. So pair a tight tolerance with a private RPC for the strongest protection.