# Sandwich attack: why your Solana swap got less

[Attacks](https://traceme.dev/attacks) › Sandwich attack

A bot bought just before your swap and sold just after, so you got close to your minimum. How to tell, and what tight slippage and MEV protection can do.

If this just happened to you: [What to do now](https://traceme.dev/attacks/mev-sandwich#what-to-do)

## At a glance

- **Where it usually starts** A swap
- **What you can lose** Part of what your swap was worth
- **Can traceme flag it?** Not yet. It shows on the chain, but traceme doesn’t flag it yet. So no badge marks it: an address without one may still have been hit.

## How it happens

An illustration of the usual pattern, not a real case: times and amounts vary.

1. You swap 10 SOL for a memecoin, with your slippage set to 5% so the trade goes through.
2. A bot sees your swap coming and buys the same token just before it, pushing the price up.
3. Your swap fills at that higher price, close to the worst you allowed.
4. Right after, the bot sells at the price your buy pushed up.
5. You get close to 5% fewer tokens than you were quoted, and the bot’s sale turns part of that gap into its profit.

### Why it works

Your slippage setting is the worst price you will accept. A bot that sees a swap before it lands can buy first, so you pay more, then sell straight after, profiting from the move your own buy makes. Your limit caps what you can lose this way, so a looser slippage leaves room for a bigger loss. What you lose isn’t all the bot’s profit: fees, tips and the price impact of the trades take their share.

## What the chain shows

The chain shows the sandwich: in the same pool, a buy just before your swap and a sell just after, in the same block or the next, while your swap fills near its slippage limit. The same address on both sides is a strong clue, though not a test: a bot can use two, and ordinary trading around a large swap can look similar.

traceme doesn’t flag sandwiches yet. A transaction’s page shows what your swap paid and what it received.

## Signs it happened to you

- You received close to your minimum.
- Trades in the same pool just before and just after yours, often from the same address.
- Your slippage was set high.

## Check your wallet

Think this happened to you? Paste your address or a transaction.

- A wallet address: `https://traceme.dev/wallet/<address>`
- A transaction signature: `https://traceme.dev/tx/<signature>`
- A token’s mint address: `https://traceme.dev/token/<mint>`
- Anything else: a .sol name, a ticker, a token’s name or a block explorer link: `https://traceme.dev/search?q=<text>`

## What to do now

Not sure this is what happened? Start from what you see: [Wallet drained or hacked? What to do now](https://traceme.dev/wallet-drained).

1. Know that nothing reverses it: every trade in the sandwich was valid.
2. Lower your slippage for the next swaps, and use MEV protection where your swap app or wallet offers it.
3. Your wallet is safe: nothing about it was compromised.

## How to protect yourself

- Set slippage as tight as the trade allows: [one swap app’s own guide](https://docs.jup.ag/user-docs/trade/spot/risks-and-limitations?utm_source=traceme.dev&utm_medium=referral) warns that a setting too high exposes you to worse prices.
- Use a swap route or wallet that offers MEV protection, knowing what it is: a way to send your swap that [reduces the risk but doesn’t eliminate it](https://docs.jup.ag/user-docs/trade/spot/risks-and-limitations?utm_source=traceme.dev&utm_medium=referral), by its makers’ own account.
- Take most care with new, thinly traded tokens, where one swap moves the price a lot.

## Common questions

### What is a sandwich attack in crypto?

A bot buys just before your swap and sells just after it, so your swap fills at a worse price and the bot profits from the move your buy makes.

### How do I protect my swaps from MEV on Solana?

Keep slippage tight, and use a swap app or wallet that offers MEV protection. Neither makes a sandwich impossible: MEV protection lowers the risk; it doesn’t remove it.

### Why did my swap give me less than expected?

The price moved between your quote and the fill, from ordinary trading, from your own swap’s price impact, or because a bot sandwiched your swap. Look at the trades just before and after yours in the same pool.

### Can I get the difference back?

No. Every trade in the sandwich was valid, so nothing can be reversed.

## Related attacks

- [Pump and dump](https://traceme.dev/attacks/pump-and-dump): The token was promoted while insiders sold into the buyers.

Source: traceme.dev, https://traceme.dev/attacks/mev-sandwich. Last reviewed Oct 27, 2026.
