⚠️ Read this first: on-chain protection starts with an account. Register on Binance through the registration link or enter invite code BINANBO to get new-user rewards (20% fee rebate plus up to $19,800 in welcome rewards). Note: registering directly in the app usually gives you none of these; you must use the link or enter the code. Registration is free, and the referral only affects your future trading fees.
Key takeaways (TL;DR):
- A sandwich attack is not theft; it is transaction-ordering arbitrage. The attacker inserts a buy before you and a sell after you; your trade still succeeds, just at a worse price.
- Your slippage tolerance is the attacker's profit budget. In a simplified model, potential loss is roughly trade size × slippage: a 200,000 USDC buy loses about $2,020 at 1% and $10,090 at 5%.
- Three conditions must hold: public mempool visibility, insufficient pair depth, and a slippage limit worth exploiting.
- On 3 December 2026, MEV Blocker's homepage said MEV bots had extracted over $1.43 billion from ordinary users, while protecting $219 billion of volume across 62 million transactions.
- The best defence is a combination: MEV-protected RPC + tighter slippage + splitting or limit orders. No single measure is enough.
A sandwich attack is a form of MEV: an attacker inserts one trade before your DEX transaction and one after it, buying first and selling later, turning your slippage into profit. It does not steal a private key, exploit a contract, or leave an "unauthorised transfer" on-chain. Your transaction succeeds and your wallet stays quiet, but you receive noticeably fewer tokens. This guide, checked against official sources on 3 December 2026 and a reproducible AMM model, explains the steps, the loss maths and six defences.
What is a sandwich attack? Three transactions
A standard sandwich has three transactions: the attacker buys, your trade sits in the middle, and the attacker sells, usually all in one block. The Ethereum Foundation's documentation describes it this way: searchers watch the mempool for large DEX trades, estimate the price impact, buy immediately before the trade and sell immediately after it1.
| Order | Who trades | What happens | Price effect |
|---|---|---|---|
| 1 | Attacker (front-run) | Buys the same token first | Pushes the price up |
| 2 | You (victim) | Buys as planned | Fills at the inflated price |
| 3 | Attacker (back-run) | Sells the tokens bought in step 1 | pockets the difference |
The key is not "someone cut in line" but "the person cutting in line can see your trade". In the public mempool your transaction is visible to every searcher before it is packed into a block. The searcher calculates how much your order will move the price, then uses a higher gas price or builder bid to place its buy ahead of yours1. Your slippage tolerance tells it exactly how far the price can move before you would cancel.
There is more than one template. EigenPhi recorded a transaction in October 2025 described as a "94-layer sandwich", nesting multiple buy/sell layers inside one trade2. You do not need to understand every layer; just remember that as long as your slippage budget is large enough, the sandwich has profit.
Why was your trade picked? Three conditions
Being sandwiched is not bad luck; three conditions line up: public visibility, insufficient depth and an exploitable slippage limit. Remove one and the profit falls, so the bot may skip the trade.
| Condition | Why it matters | How to reduce it |
|---|---|---|
| Public mempool visibility | Searchers see your trade before it is packed | Use a MEV-protected RPC / private transaction |
| Insufficient pair depth | A shallow pool moves more on the same order | Choose deeper pools; check price impact |
| Loose slippage limit | The attacker can push the price to your worst acceptable fill | Tighten slippage for the pair's volatility |
| Order large relative to the pool | The order itself moves the price | Split, TWAP or use limit orders |
| Low-liquidity new token | A pool of a few tens of thousands amplifies any buy | Do not chase tokens in shallow pools |
AMM pricing means a large order must move the price. In Uniswap v2's constant-product model, the product of the two reserves stays constant: buying one asset makes it scarcer and more expensive. v2 charges 0.30% per swap, while v3 uses 0.05%, 0.30% and 1% tiers3. This is by design, not a bug; a sandwich simply turns that price impact into someone else's arbitrage.
A CEX order book is a different attack surface. Exchange matching happens off-chain, so ordinary users do not face "mempool front-running" in the same way. CEXs have their own MEV-like issues, but the mechanics, participants and defences differ. This article is about DEX/AMM sandwiches.
A 200,000 USDC buy: how slippage becomes the attacker's profit
A simplified model shows the point: slippage is not "fill speed", it is "how much the attacker can take". Assume an ETH/USDC pool with 10,000 ETH and 20,000,000 USDC, an initial price of 2,000 USDC/ETH, and your buy of 200,000 USDC. Ignore fees for easy reproduction.
With no attack, your trade moves the pool to 20,200,000 USDC / 9,900.99 ETH, so you receive about 99.0099 ETH at an average price of about 2,020 USDC.
An attacker who sees your slippage limit buys ahead, sells after, and sizes the front-run so your transaction just barely succeeds:
| Your slippage limit | Attacker's front-run | ETH you actually receive | ETH less than no attack | Loss at post-attack price | Attacker's gross profit |
|---|---|---|---|---|---|
| 0.5% | 50,438 USDC | 98.5149 | 0.4950 ETH | about $1,010 | about $1,010 |
| 1% | 101,258 USDC | 98.0198 | 0.9901 ETH | about $2,020 | about $2,020 |
| 3% | 308,450 USDC | 96.0396 | 2.9703 ETH | about $6,056 | about $6,058 |
| 5% | 522,152 USDC | 94.0594 | 4.9505 ETH | about $10,090 | about $10,095 |
| 10% | 1,087,234 USDC | 89.1089 | 9.9010 ETH | about $20,160 | about $20,180 |
The most important conclusion is one sentence: loss is roughly "trade size × slippage limit". 200,000 × 0.5% = 1,000; × 1% = 2,000; × 5% = 10,000; × 10% = 20,000. The attacker's gross profit in the model nearly equals your loss, because a sandwich is priced to consume your slippage budget.
Three boundaries you must keep in mind:
- This is a simplified model, not a prediction. It ignores the 0.30% fee, gas, builder bids, competing bots and actual pool depth; real losses are usually smaller because the attacker must cover costs and cannot always take the full budget.
- Too little slippage fails. In fast markets, 0.1% may revert a normal trade, and a failed transaction still costs gas on a regular RPC.
- The attacker does the maths too. Front-run size, gas and competition decide whether the sandwich is worth doing; small orders in deep pools with tight slippage are usually unprofitable.
🎯 In one line: setting 5% slippage is not "allowing a 5% price difference"; it is "telling the sandwich bot it may take up to 5%".
A sandwich is not a hack: why there is no refund
A sandwich transaction is valid, and you never signed an unauthorised action, so it is not theft and there is no refunding party. That is also why it is harder to fight than approval phishing: the on-chain record looks completely normal.
| Dimension | Sandwich attack | Approval phishing | Private key / seed leak |
|---|---|---|---|
| What happens | Ordering is exploited; fill price worsens | You sign a malicious approval; tokens leave | Attacker gets the key and moves assets |
| Does your transaction succeed? | Yes | Yes | The attacker's transaction succeeds |
| Any abnormal transfer on-chain? | No, only your own trade | Approval and transfer records | Outgoing transfer records |
| Who can refund | Nobody | Rarely negotiable, usually no | Essentially no |
| Main defence | MEV RPC, slippage, splitting | Pre-signature checks, revoke approvals | Offline backup, hardware wallet |
So do not wait until you are sandwiched to contact support. The project, DEX, wallet and exchange cannot roll back a confirmed transaction. Your options are set before signing: slippage and routing. After a sandwich, keep the transaction hash and block details for review, not for recovery.
How can you tell you were sandwiched?
The clearest evidence is in a block explorer: in the same block and pair, a buy sits before your trade and a sell after it. If all three come from the same address or bot cluster, it is almost certainly a sandwich.
| Check | What to look for | Note |
|---|---|---|
| Block | Are all three in one block? | Sandwiches usually complete in one block |
| Pair | Same pool/pair? | Cross-pool trades are not a standard sandwich |
| Order | Buy before you, sell after you | Buy-then-sell is the signature |
| Address | Same address or bot cluster before/after | Bots often reuse addresses |
| Result | Your trade succeeded but received less | A failed trade is not a sandwich |
Tools save time. EigenPhi labels transactions as sandwich, frontrun or backrun; MEV-Inspect scans by block; Flashbots Explorer shows builder and bundle ordering2. In your wallet, the simpler signal is: the quote said 100 tokens, you received 95, and the transaction status is success.
Keep "price impact" and "slippage" separate. Price impact is how much your own order moves the pool; slippage tolerance is the maximum deviation you accept. The attacker exploits the latter: it cannot exceed your limit, or your transaction reverts and it wastes gas.
Six defences, ranked by effectiveness
Defence is not one switch; it tightens three variables at once: visibility, slippage and order size. The list below is ordered by practical effect.
| # | Measure | Effect | Cost/limit |
|---|---|---|---|
| 1 | MEV-protected RPC | Keeps the transaction out of the public mempool | New RPC trust assumption; not all chains |
| 2 | Tighten slippage | Directly shrinks the attacker's profit ceiling | Too tight fails; volatile tokens need room |
| 3 | Split / TWAP | Reduces per-order price impact | More transactions and gas |
| 4 | Check pool depth and impact | Avoids shallow pools and large impact | Requires pre-trade data |
| 5 | Limit / intent-based orders | Refuses worse prices; solvers compete | Slower fills; limited pairs |
| 6 | Avoid illiquid new tokens | Removes the easiest sandwich setups | Misses some opportunities |
How to set slippage matters more than the exact number. Stablecoin pairs (USDC/USDT) barely move and can use very low slippage; major pairs can use around 0.5%; new or illiquid tokens move a lot, and high slippage there is a gift to the sandwich bot. The safer order is: check price impact first, then set slippage, not the reverse.
A MEV-protected RPC is the highest-leverage single step. It requires no change to your trading logic, only a different RPC endpoint in your wallet; the cost is trusting the RPC operator instead of the public mempool.
Flashbots Protect vs MEV Blocker
Both send transactions to a private mempool and avoid public front-running; they differ in refunds, revert protection and privacy settings. Flashbots Protect's official description says transactions go to a private Flashbots mempool hidden from front-running and sandwich bots, are included only if they will not revert, and failed transactions pay no miner fee; users can also receive gas and MEV refunds4.
| Item | Flashbots Protect | MEV Blocker |
|---|---|---|
| RPC endpoint | rpc.flashbots.net/fast | rpc.mevblocker.io |
| Core mechanism | Private mempool, bundle submission | RPC endpoints with configurable protection/refunds |
| Front-run/sandwich | Hides the transaction | Default endpoint protects front-running |
| Failed transactions | Not included; no failed gas | Default /fast does not protect reverts; /noreverts does |
| Refunds | Gas and MEV refunds | Back-run refunds; /fullprivacy has none |
| Privacy | Does not log IP or user info | /fullprivacy offers maximum privacy |
| Best for | Refunds and revert protection | Multiple profiles and refunds |
MEV Blocker's homepage provides useful scale data: over $219 billion of volume protected, more than 62 million transactions, over 5,500 ETH rebated to users, a median rebate of about $26, and a claim that MEV bots have extracted more than $1.43 billion from ordinary users5. These figures are disclosed by the project and should be read on its own terms, but they show that sandwiches are not a rare edge case.
Which endpoint:
- /fast (default): protects front-running, refunds back-running, does not protect reverts; fine for most everyday trades.
- /noreverts: adds revert protection; suits tight slippage where failure is a concern.
- /fullprivacy: maximum privacy and protection, no refunds; suits large trades or when you do not want to reveal intent.
Do not put all your security in an RPC. It does not protect against private-key leaks, approval phishing, honeypot tokens or contract exploits. Those are separate lines of defence, linked at the end.
Five common misconceptions
- "Higher slippage just fills faster" — wrong. Slippage is the sandwich bot's profit budget; 10% tells it it may take up to 10%.
- "Small orders are never sandwiched" — it depends on pool size. In a pool of a few tens of thousands, even a few hundred dollars can be profitable; bots measure ratios, not absolute size.
- "CEX trades get sandwiched too" — different mechanics. This article covers DEX/AMM on-chain ordering; a CEX order book has no equivalent public-mempool front-run.
- "The project or exchange will refund a sandwich" — there is no refunding party. The transaction is valid and signed; nothing rolls back.
- "MEV protection makes me 100% safe" — it protects transaction ordering, not accounts, approvals or contracts. The RPC itself is a trust assumption.
🎯 In one line: a sandwich defence protects against "your trade being seen and exploited", not "your assets being stolen"; those need two different playbooks.
FAQ
What is a sandwich attack?
A sandwich attack is a form of MEV arbitrage. An attacker sees your publicly submitted DEX buy, buys the same token ahead of you to push the price up, lets your trade fill at a worse price, then sells after you. Your slippage tolerance is the attacker's profit margin. The three transactions usually land in the same block, and your trade succeeds, so your wallet shows no "theft" alert1.
Why was my trade sandwiched?
Three conditions must hold at once: your transaction is visible in the public mempool, the pair is too shallow to absorb your order, and your slippage tolerance is exploitable. Large buys, low-liquidity tokens and high slippage are the usual combination. A MEV-protected RPC, tighter slippage or splitting the order can make the attack unprofitable.
Does higher slippage really make me easier to sandwich?
Yes. The attacker calculates the maximum price move you will accept and sizes the front-run so your transaction just barely succeeds. In a simplified model, potential loss is roughly trade size × slippage tolerance: on a 200,000 USDC buy, 0.5% costs about $1,010, 1% about $2,020 and 5% about $10,090. Slippage is not a speed setting; it is the attacker's budget.
How is a sandwich attack different from a wallet hack?
A sandwich is not theft or a contract exploit. Your transaction executes under the conditions you signed, just at a worse price; the attacker never obtains your private key or an approval. There is no unauthorised transfer on-chain, so the project, exchange and wallet cannot refund it. Prevention is the only real option; recovery is close to zero.
How can I tell if I was sandwiched?
Open the transaction in a block explorer and check whether the same block and pair contain a buy before yours and a sell after yours, often from the same address or bot cluster. In your wallet it looks like a successful trade that received noticeably less than quoted. EigenPhi, MEV-Inspect and Flashbots Explorer can label sandwich transactions directly2.
Flashbots Protect or MEV Blocker?
Both are RPCs that send transactions to a private mempool instead of the public one. Flashbots Protect offers MEV refunds and does not charge gas for failed transactions, via rpc.flashbots.net/fast4. MEV Blocker offers /fast, /noreverts and /fullprivacy endpoints; its default protects front-running and refunds back-running opportunities but does not protect against reverts5. Choose by whether you value refunds, privacy or revert protection most.
Does MEV protection stop sandwich attacks completely?
No. A MEV-protected RPC greatly reduces the chance of being front-run from the public mempool, but it introduces a new trust assumption: the RPC operator can see your transaction, and coverage depends on the endpoint and chain. It does not protect against private-key leaks, approval phishing, honeypot tokens or contract exploits. It reduces transaction-level losses, not account-level risk.
How should I split a large trade?
Check the pair's depth and price impact first, keep each order small enough not to move the price noticeably, then execute across time or price ranges. Splitting adds transactions and gas but shrinks the profit available on each leg. For very illiquid tokens, splitting may not help because the pool itself is too shallow; use a deeper pool or a limit/OTC route instead.
💰 Binance referral: invite code BINANBO
Before trading on-chain, most people's first funds still come from an exchange. Register on Binance through this article's link to get a 20% trading-fee rebate, on spot and futures. This article contains a referral link; we may receive a reward if you register through it, but it does not cost you anything extra.
- Invite code: BINANBO
- Registration: 👉 Register on Binance with code BINANBO
- Welcome rewards: up to $19,800, unlocked through Reward Hub tasks, not cash on registration
- Key reminder: registering directly in the app gives no new-user rewards; use the link or enter the code
Further reading
- Wallet signature types: personal_sign, Permit, Permit2 and EIP-7702
- Personal Web3 security checklist: 3 minutes a day, 15 minutes a week
- How to spot honeypot tokens you can buy but not sell
- How to use Etherscan: transactions, approvals and contracts
- What is Layer 2? How Rollups cut gas costs
- What is liquidity mining? APR, APY and real yield
Disclaimer: this article is for educational reference only and is not investment advice. Sandwich losses vary with pool depth, trade size, slippage settings, fees and competition; the model here is a simplified example, not a prediction of any specific trade. MEV-protected RPCs are operated by third parties and carry trust and availability risks; verify endpoints, supported networks and privacy terms before use. Crypto trading carries high risk; confirm the laws of your region before participating.
Footnotes
-
Source: ethereum.org, "Maximal extractable value (MEV)", page updated 2026-12-01, read 2026-12-03; covers the MEV definition, searchers watching the mempool, the 10,000 UNI/DAI sandwich example, sandwiching being non-atomic, the salmonella attack, and gas auctions between searchers and validators. ↩ ↩2 ↩3
-
Source: EigenPhi articles "MEV Inside the Rug: The 94-Layer Triple-Evil Sandwich" (2025-10-30) and "Why Your Size Doesn't Matter to Jared 2.0, the Ethereum Sandwich MEV Bot Kingpin" (2025-10-09), read 2026-12-03; the first describes a 94-layer sandwich, the second a six-transaction sandwich strategy. ↩ ↩2 ↩3
-
Source: Uniswap Docs, "Fees", read 2026-12-03; covers Uniswap v2's 0.30% fee per swap, v3's standard 0.05%/0.30%/1% tiers, and fees increasing the constant-product invariant k. ↩
-
Source: Flashbots Docs, "MEV Protection Overview", last updated 2026-05-05, read 2026-12-03; covers the private Flashbots mempool, hiding transactions from front-running and sandwich bots, inclusion only when the transaction will not revert, no miner fees on failed transactions, gas and MEV refunds, the rpc.flashbots.net/fast endpoint, and no IP logging. ↩ ↩2
-
Source: MEV Blocker homepage, read 2026-12-03; displays over $219 billion of volume protected, more than 62 million transactions, over 5,500 ETH rebated, a median rebate of about $26, and a claim that MEV bots have extracted more than $1.43 billion from ordinary users; the /fast, /noreverts, /fullprivacy, /maxbackruns and /nochecks endpoints differ in protection and refunds as shown on the page. ↩ ↩2