MEV and sandwich attacks
How a sandwich bot buys before you and sells after you, a worked example with real pool math, and how to protect yourself.
MEV stands for maximal extractable value: profit someone makes by choosing the order of transactions in a block. Some MEV is harmless, like bots that keep a coin at the same price in two pools. One kind takes money straight out of your trade. It is called the sandwich.
How a sandwich works
- A bot sees your buy before it lands, along with your slippage limit.
- It buys the same coin first and pushes the price up.
- Your buy fills at the higher price. You get fewer tokens, but it is still inside your limit, so it goes through.
- The bot sells straight after you, into the price your buy pushed up, and keeps the difference.
Jumping in just ahead of a trade you know is coming is called front-running. A sandwich is front-running with a quick sell stuck on the end. Your trade is the filling, and you pay for both slices of bread.
A sandwich with real numbers
A small pool holds 50 SOL and 500 million tokens. You buy 1 SOL worth with slippage set to 20%. To keep it simple, this ignores fees.
- Step 1: With nobody in the way, your 1 SOL would get about 9.8 million tokens.
- Step 2: A bot buys 5 SOL first. Now your 1 SOL gets about 8.1 million tokens, 17% fewer. That is inside your 20% limit, so your trade goes through.
- Step 3: The bot sells its tokens right after you and gets back about 5.17 SOL. Its profit is about 0.17 SOL, and all of it came from you.
- Step 4: If you sold straight away, your tokens would fetch about 0.83 SOL. You lost 17% in under a second, and the coin did nothing.
- Step 5: With slippage at 10%, this exact attack would have failed. A bot could still squeeze you, but only by up to 10%.
That last step is the key idea. Your slippage setting is roughly the most a sandwich can take from you on that trade.
Does this happen on Solana?
Yes. Solana has no public waiting room for transactions like the mempool on Ethereum. Jito ran one and shut it in March 2024, after sandwich attacks on Solana users had piled up. Private ones appeared instead. In June 2024 the Solana Foundation removed some validators from its delegation program, which lends them stake, for taking part.
Researchers speaking at a Solana conference in May 2025 estimated that sandwich bots made between $370 million and $500 million over about 16 months. The attacks bunch up around token launches. Memecoin traders make easy targets, because they often trade thin coins with high slippage.
How to protect yourself
- Use the lowest slippage that still fills. Do not leave it at 50% because a video said so.
- Turn on your app's MEV protection if it has one. These modes send your trade through routes that try to keep sandwich bots out. Axiom's docs say its version can make trades slightly slower.
- Keep your size small compared with the pool. A big buy with high slippage in a thin pool is the juiciest target there is.
- Check your fills. On a block explorer such as Solscan, a buy right before yours and a sell right after it, from the same wallet, is the classic sign of a sandwich. Bots often split the two sides across wallets, so it is not always that tidy.
Check what you learned
0 of 4 answered
Finished reading? Tick it off and your progress is kept in this browser.
This guide is for learning. It is not financial advice. Most memecoins go to zero and most people who trade them lose money. Only ever trade what you can afford to lose.