MEV and sandwich attack
MEV (maximal extractable value) is profit made by reordering transactions in a block. A sandwich attack is a common form: a bot buys right before your trade and sells right after it.
How it works
Before landing in a block, transactions wait in the mempool, a public queue anyone can see. Bots called searchers scan it for profitable trades and pay validators or block builders to place their own transactions at exactly the right spot.
A sandwich goes like this: a bot spots your large DEX buy with high slippage tolerance. It buys the same token just before you, pushing the price up, your trade fills at the worse price, and the bot sells right after for a profit. Your loss is its gain.
Not all MEV is harmful: arbitrage aligns prices across DEXs and liquidations keep lending protocols solvent. Sandwiches, though, are a hidden tax on regular users. Defences: low slippage tolerance, splitting big trades and private transaction sending, which some wallets and RPCs offer.
You buy $10,000 of a token with 3% tolerance. A bot buys $20,000 ahead of you, lifting the price 2.5%. Your buy fills higher and you get roughly $250 less in tokens. The bot sells immediately and keeps about $200 after gas and fees.
A common mistake is thinking only whales get sandwiched. Bots also hit trades of a few hundred dollars when tolerance is wide and the pool is small. Use the minimum slippage you need and check whether your wallet offers MEV protection.
Questions and answers
What is MEV in simple terms?
It is profit earned by whoever chooses the order of transactions in a block. They can slip in before or after you and profit from the price change.
How do I know if I got sandwiched?
Open your transaction in a block explorer and look at its neighbours. If the same address bought just before you and sold just after, that was a sandwich.
How can I protect myself from sandwich attacks?
Use low slippage tolerance, split large trades and send transactions privately when that option is available.
Related terms
Read next
A decentralized exchange has no support desk and no undo button. Here is what to check before a swap so your tokens do not end…
Read →MVRVMVRV is an on-chain indicator equal to a coin's market cap divided by its realized cap. It shows how far holders are…
Updated: 2026-10-19