You set a slippage limit on a swap, and a bot used it: it bought just before your trade and sold just after, skimming value from the slippage you allowed. That is a sandwich attack. Below we cover why retail traders get caught and how to cut the risk on your next swap.

What a sandwich attack is and why it hits retail traders

A sandwich attack is a form of Miner/Maximal Extractable Value (MEV) that targets your decentralized exchange (DEX) swap. A bot spots your pending trade in the mempool, buys the token first to push the price up, lets your swap execute at the worst price you allow, then sells right after. You get worse execution. The bot takes the spread.

It tends to hit trades in tokens with thin liquidity, swaps with wide slippage, orders broadcast over public RPC endpoints and orders that are large relative to the pool.

What a sandwich looks like on-chain

On-chain, a sandwich shows up as two quick transactions from the same bot or cluster on either side of your swap. A small buy nudges the price up, your higher-slippage swap lands, then a sell pulls the price back toward where it started. Price impact and gas bidding are common markers, and the bot's trades often use the same router path as yours. Even if the bot uses private relay infrastructure, its transfers in and out of the pool are visible on-chain after inclusion.

Sandwiching is different from private-key theft or a rug pull. It worsens your execution price, but on its own it does not drain your wallet or seize your approvals. Those losses come from other threats, such as phishing, malicious approvals or compromised keys.

How to cut your sandwich risk and answer “is wallet safe” for your setup

MEV cannot be switched off, but you can make your trades unattractive to sandwich bots and lock down your setup. We suggest these defaults:

  • Use MEV-protected order flow. Route swaps through providers that support private or shielded relays (e.g., wallets or RPCs that advertise MEV protection) so mempool bots can’t see your intent before inclusion.
  • Prefer batch auctions or intents-based routers. Aggregators that batch orders or match peer-to-peer (e.g., intents/auction models) reduce exploitable slippage windows compared with naive AMM swaps.
  • Tighten slippage and use limit orders when available. A 0.3–0.5% slippage band on liquid pairs cuts surface area. For illiquid tokens, use limits or skip the trade.
  • Avoid thin-liquidity pools. Check pool depth and expected price impact before submitting. If price impact exceeds a few percent on your size, reconsider or split the order.
  • Split large orders and randomize timing. Smaller clips leave less spread to capture and make gas sniping less profitable.
  • Simulate before you send. Use reputable simulators to preview execution price and gas. If the expected price impact is large, revise the plan.
  • Audit approvals. When a dApp asks for an allowance (permission to move a token out of your wallet), approve only the amount for this trade, or use an “exact-in” approval, which covers exactly the amount you are swapping in. Revoke stale allowances after use to contain damage if a dApp is compromised.
  • Check counterparties and URLs. Run addresses and sites through TrustSniffer’s wallet-risk checker and confirm entities against the sanctions directory. For a macro view of risk trends, watch the live Risk Index.

If you suspect a sandwich, open the block that holds your swap. Look for a small buy just before it and a quick sell just after, both from the same cluster and both paying high gas, with your swap filled at the edge of your slippage band. If you see that pattern repeatedly on a pair, change venues or routing.

Sandwich attack
A DEX trade-manipulation tactic in which a bot places a buy before a pending swap and a sell after it, extracting value through price movement.

What this means for retail risk management

Bots look for large, high-slippage market orders sent into thin pools over a public RPC. Route privately, keep slippage tight and choose deeper liquidity or batch-auction venues, and your order becomes a poorer target than the others in the mempool. For the rest of your setup, check URLs before you sign, keep approvals minimal and isolate your keys on a hardware wallet. Before a large trade, run your wallet and the counterparty through the checker: that scan is your answer to “is wallet safe”. Then send a small test trade and compare its fill with the quoted price, which shows whether this route is being sandwiched. If the scan is unclear, keep the trade small or skip it until you have checked the counterparty.

Related reading: a sandwich costs you part of one trade, while a wallet drainer uses a signed approval to take the tokens themselves, and a rug pull is the token's own team taking the liquidity.


Sources

Reviewed by TrustSniffer Intelligence on 2026-07-24. This is automated, attribution-based analysis of public on-chain and web data for informational purposes only. It is not financial, legal, or investment advice. Third-party labels reflect their sources. Verify independently before acting.

Frequently asked questions

Is a sandwich attack a scam?

It is market manipulation by a trading bot, and it needs nothing from you except a pending swap with room in its slippage. Nobody tricks you into sending money. You get a worse price than the one you were quoted, and the bot keeps the gap.

Can a sandwich attack steal my wallet?

No. The bot only trades against the same pool you are trading in. It cannot use your keys or your approvals, so your remaining balance is not at risk from the sandwich itself. Theft of the wallet comes from phishing, malicious approvals or a leaked seed phrase.

How do I know my swap was sandwiched?

Open the block your swap landed in on the explorer. A buy of the same token right before your transaction and a sell right after, from one address or cluster, with your swap filled near your slippage limit, is the signature. Keep the transaction hash and your quoted price for comparison.