What is Slippage, MEV Bots, Sandwich Attacks and Front-running?

Author logo
Patrick Dike-Ndulue
Post image

AI summary

You open your wallet, select the currency pairs, tap swap, and expect to get exactly what the screen shows. A few seconds later, you get slightly less. Sometimes a lot less. That's called slippage, and if you're unlucky, a bot helped make it worse on purpose.

This guide breaks down what slippage means, how swaps work under the hood, what MEV bots are, and what you can do about all of it.

What is slippage?

In crypto, slippage measures the difference between the price you see when you initiate a swap and the price you actually get when it executes.
 

This gap exists because prices can move between the moment you click swap and the moment the network confirms the transaction on the blockchain. Slippage can work in your favor (you get more than expected) or against you (you get less). In most cases, it works against you.

How do swaps work?

When you swap one crypto for another (example, ETH for USDC), you're interacting with code on a blockchain. That code is usually an Automated Market Maker, or AMM for short.
 

An AMM is basically a giant pool of two tokens. People deposit tokens into these pools and earn a small fee from traders who use them. When you swap, you're pulling tokens from one side of the pool and putting them into the other.

Here's a simple example:

Pool State

ETH in Pool

USDC in Pool

Before your swap

1000 ETH

2,000,000 USDC

You swap 10 ETH for USDC

Adds 10 ETH

Takes out ~19800 USDC

After your swap

1010 ETH

~1,980,200 USDC


The math that powers AMMs is the constant product formula: x * y = k. The pool must always stay balanced by that formula. As you withdraw more USDC, each additional unit becomes more expensive to obtain, which is where price impact and slippage come into play. 

After your swap, the pool holds 1,010 ETH; so to keep k constant, it can only hold 1,980,198 USDC. You receive roughly 19,800 USDC, implying a price of ~$1,980 per ETH. But the pool's starting price was $2,000. That $20 difference is your price impact: the market moved against you because of your own trade.

Now scale that up. Swap 100 ETH instead of 10, and the pool holds 1,100 ETH. k demands it hold ~1,818,182 USDC. You receive ~$181,818 for 100 ETH; an average of $1,818 per ETH, against a starting price of $2,000. A $182-per-coin gap. 

The bigger the trade relative to the pool's depth, the worse the rate.

Slippage is the broader term that captures this and everything around it. Price impact is the portion you caused. But slippage also includes the movement that happens between when you submit a transaction and when it actually executes. On a congested network, that gap can be seconds or minutes. Other traders, arbitrageurs, or even bots can move the pool before your transaction lands, meaning you get a different rate than you expected; sometimes significantly worse.

This is why DEX interfaces ask you to set a slippage tolerance. You're telling the protocol: execute my swap only if the final rate stays within X% of my expected output.

If it's too tight, your transaction keeps reverting; if it's too loose, you're vulnerable to MEV bots that sandwich your trades, raising the price before you buy and dumping right after. The larger the pool, the less each trade influences k, and the better the execution. 

Liquidity depth differentiates a pool where moving $10,000 has little effect from one where a $500 swap costs you 3%.

What causes slippage?

Slippage doesn't happen for one single reason. Usually, it's a combination of factors:

  1. Market Volatility: Crypto prices can move fast. In the time it takes your transaction to be confirmed (a few seconds to a few minutes), the market might move significantly. The more volatile the asset, the more slippage you'll likely see.

     

  2. Low Liquidity: If there's not much of a token in a pool, even a relatively small trade can move the price significantly. Think of a small bucket of water vs. a swimming pool. Dropping a stone into the small bucket makes big waves. The same stone dropped into a swimming pool barely makes a ripple. That’s why swapping a major token like ETH usually involves low slippage, while trading an obscure new meme coin can result in significant slippage. There's just not enough liquidity to absorb your trade.

     

  3. Large Trade Size: Even in liquid markets, a large trade relative to the pool size will push the price against you. It's similar to slippage but specifically refers to the price movement caused by your own trade.

What is Slippage tolerance?

Most swap interfaces let you set a slippage tolerance, which is the maximum amount of price movement you're willing to accept. If you set your slippage tolerance at 1%, you're saying: "I'm fine with getting up to 1% less than the quoted price. But if the price moves more than that, cancel my transaction." Here's how different slippage tolerance levels play out in practice:

 

Slippage Tolerance

What Happens

Risk Level

0.1% - 0.5%

Transaction likely to fail in volatile markets

Low risk, low success rate

0.5% - 1%

Good balance for liquid tokens

Recommended for most swaps

1% - 3%

Higher success rate, small cost

Fine for volatile assets

3% - 10%

The transaction almost always goes through

You're a target for bots

10%+

You will almost certainly get exploited

Very risky


Setting a high slippage tolerance is one of the most common ways people lose money on DEXes without realizing what happened.

What Are MEV Bots?

MEV stands for Maximal Extractable Value. It refers to the extra profit validators or miners can extract from a blockchain by reordering transactions within a block or by deciding which to include or exclude.

In simple terms, certain bots watch every transaction that hasn't been confirmed yet (sitting in the "mempool," which is essentially a waiting room for transactions). These bots look for opportunities to profit at your expense by rearranging the order in which transactions get processed. Miners and validators who actually add transactions to the blockchain can be paid to prioritize certain transactions. MEV bots take advantage of this by paying higher gas fees to "cut in line."
 

Think of it like this: you're at a concert, standing in line to buy the last few tickets at face value. A scalper spots you, runs to the front of the line by bribing the doorman, buys all the remaining tickets first, and then offers to sell them back to you at a markup. That's what an MEV bot does.

MEV protection has become a hot topic precisely because this kind of value extraction is a constant, ongoing cost for anyone swapping on DEXes.
 

The two main types of MEV attacks on swaps are front-running and sandwich attacks 

What is a sandwich attack?

The sandwich attack is the most common and costly MEV exploit for regular traders. Let's say you want to swap $2,000 worth of ETH for the HARAMBE token. You set your slippage tolerance at 5% because HARAMBE is a volatile token, and you really want this trade to go through.

  1. Your transaction enters the mempool. Your wallet broadcasts your swap request publicly. Anyone watching, including bots, can see it.

  2. The bot sees your trade and makes its move. A MEV bot detects that you're about to buy a large amount of HARAMBE with 5% slippage tolerance. It knows that your trade will push the price of HARAMBE up. So it immediately submits its own buy order for HARAMBE with a higher gas fee, ensuring its transaction gets processed just before yours.

  3. The bot's buy order executes first. The bot buys HARAMBE, pushing the price up.

  4.  Your transaction executes at the new (higher) price. You get less HARAMBE for your $2,000 than you would have if the bot hadn't acted. The price moved against you, but it's still within your 5% tolerance, so the transaction goes through.

  5. The bot immediately sells. The bot sells its HARAMBE right after your trade, at the inflated price you helped create. Risk-free profit for the bot and a loss for you.

You've been "sandwiched." Your trade was the filling between the bot's buy and sell. This is where the name comes from.

A real-world example of how profitable this is: a trader on Uniswap using the wallet address "jaredfromsubway.eth" reportedly earned over $4 million in a single day executing sandwich attacks, spending over $1 million in gas fees to do it. The math still worked out for the bot operator. 

Front-running

Front-running is simpler than the sandwich attack but equally frustrating. A bot watches the mempool and sees that you're about to buy a large amount of "Token X”. It knows that your purchase will push the price up. So it buys Token X before you, with a higher gas fee to jump ahead. When your transaction finally processes, the price is higher than when you initiated the trade. You pay more than you expected.
 

Front-running is particularly common during:

  • Token launches, when everyone is trying to buy at the same time
  • Major announcements that cause sudden buying pressure
  • Liquidity events on new DeFi protocols

Difference between frontrunning and sandwiching.

Frontrunning is a single move. The bot sees your transaction, copies or anticipates it, and jumps ahead of you in the queue. It gets the better price. You get whatever's left after the market moves. The bot's involvement ends before your transaction executes.
 

Sandwiching is a two-move operation that requires your transaction in the middle. The bot buys before you to inflate the price, lets your transaction execute at the worst rate, then immediately sells into the liquidity your trade created. Your transaction is used as the mechanism that generates the bot's exit profit.

The key difference: in frontrunning, you're an obstacle that the bot moves around. In a sandwich, you're the instrument the bot plays.
 

Things to watch out for to avoid high slippage

Here's a practical checklist of things to check before every swap:

Check the token's liquidity

Before swapping into a new token, check the pool's liquidity. Most DEX interfaces show this. If the pool has less than $100,000 in it, even a $1,000 trade could cause massive slippage. A pool with $10 million in it is much safer for typical trade sizes.

Keep slippage tolerance low

For any established token like ETH, BTC, or major stablecoins, there is almost no reason to set slippage above 1%. For smaller, more volatile tokens, 1–3% is usually sufficient. Above 5% and you're actively inviting bots to exploit you.

Break large trades into smaller ones

If you're trying to swap a very large amount of a thinly traded token, don't do it all at once. Split it into multiple smaller transactions. Yes, you'll pay more in gas fees, but you'll lose far less to slippage and avoid looking like a juicy target to MEV bots.

Avoid swapping during high network congestion

Gas fees go up when the network is busy. But more importantly, your transaction spends more time in the mempool waiting to be confirmed. More time in the mempool means more time for bots to spot you and act. Tools like Etherscan's gas tracker can show you when network activity is lower.

Use DEX aggregators

DEX aggregators like 1inch route your swap across multiple liquidity pools simultaneously to get you the best rate with the lowest price impact. Instead of sending your entire trade into a single pool and pushing the price against yourself, the system splits the order intelligently across multiple pools, making it one of the most effective ways to reduce slippage on larger trades.

Compare Rates Before Swapping

The first rate you see isn't always the best one. Different swap providers will quote you different rates depending on their routing and liquidity sources. Always spend 30 seconds comparing options before confirming. 

Here's a quick reference for avoiding common slippage mistakes:

Situation

What to Do

Swapping a meme coin or low-cap token

Keep slippage at 1–3%, check pool liquidity first

Swapping a major token (ETH, BTC, SOL)

0.5% slippage is usually fine

Large trade (>$10,000)

Break it into smaller amounts

The network is congested

Wait for a quieter time or pay for faster confirmation

The app is showing unusually high slippage

Don't proceed; investigate first

Token requires 10%+ slippage to swap

Likely a scam; walk away

How Tangem Wallet protects you

Tangem's integration with providers like OKX DEX includes a feature most wallets don't have. It keeps your transactions private to avoid MEV extraction. Instead of letting your swap sit in the public mempool where bots can see and exploit it, the system routes it privately to avoid sandwich attacks and front-running.
 

Providers like OKX DEX also split your orders across multiple liquidity pools (this is called "order splitting") to reduce price impact and slippage.

Slippage visibility

Tangem shows you the slippage percentage for each swap provider before you confirm. You can tap the info icon on the "You receive" section to see exactly what slippage you're accepting. Most wallets bury this information or don't show it at all.

Frequently Asked Questions

What's a normal amount of slippage to expect on a swap?

For liquid trading pairs like ETH/USDC or BTC/USDT, slippage of 0.1% to 0.5% is normal. For smaller or more volatile tokens, 1–3% is typical. If you're seeing more than 5% on any established token, something is off. Either the pool has very low liquidity, you're trading a very large amount, or the market is in extreme volatility.

If I set my slippage tolerance low, will my transaction definitely fail?

Not necessarily. Setting it low means your transaction will fail if the price moves more than your tolerance before the swap is confirmed. This is actually the wallet protecting you, not a bug. A failed transaction on a DEX still costs you the gas fee, but you don't lose your tokens. That's a much better outcome than getting sandwiched.

Is MEV illegal?

No. It operates in a legal grey area. The blockchain is public by design, meaning anyone can see pending transactions. MEV bots are just using publicly available information quickly. It's not illegal, but it's not exactly fair either. The blockchain community is actively working on technical solutions to reduce its impact.

How do I know if I got sandwiched?

After a swap, you can check your transaction on a block explorer like Etherscan. If the token you received is significantly less than the quoted amount, and you see two other transactions from the same address that sandwiched yours in the same block, you were likely attacked. The key clue is seeing a buy and a sell from the same bot address directly before and after your transaction.

Does using a hardware wallet like Tangem prevent MEV bots?

Hardware wallets protect your private keys from being stolen. They don't stop MEV bots, because MEV happens at the network level. However, Tangem's built-in swap providers (particularly OKX DEX with Flash Bot and 1inch with RabbitHole) do provide MEV protection by routing transactions through private channels.

What's the difference between slippage and price impact?

Price impact is the effect your specific trade has on the price, caused by the size of your order relative to the pool's liquidity. Slippage is the difference between the expected and actual execution price, including price impact and market movement during the time your transaction is processing. Both work against you when you're swapping, but they have slightly different causes.

Should I always use the lowest possible slippage setting?

Yes, but with some nuance. For liquid pairs (major tokens), 0.5–1% is the sweet spot. For volatile small-cap tokens, you might need 1–3% just to get the transaction through. The goal is to use the minimum slippage that gives your transaction a reasonable chance of succeeding. You can try a lower setting first and increase it slightly if the transaction fails.

Does Tangem charge fees for swaps?

Tangem itself doesn't charge swap fees. You'll pay the blockchain network fee (gas) and whatever the third-party swap provider charges. Tangem compares rates across multiple providers so you can choose the most cost-effective option. The app shows you all estimated fees before you confirm, so there are no surprises.

What happens if my swap fails in Tangem?

If a swap fails, Tangem keeps the failed transaction status visible until you manually dismiss it so you don't miss what happened. You can check the status of any swap through the transaction history on the token page, or track it directly on the swap provider's page. Your original tokens are returned to your wallet if the swap fails.

Is Tangem suitable for beginners?

Yes, and that's genuinely one of its strongest points. We designed the app so that you don't need to understand AMMs, liquidity pools, or MEV to use it safely. The best practices (rate comparison, slippage visibility, MEV-resistant routing) are built into the defaults. For beginners, especially, having hardware-level security without needing to understand the technical details is a huge advantage.

Conclusion

Slippage is a normal part of crypto trading, but large losses often stem from how and where you trade. MEV bots actively monitor transactions and can exploit poorly protected swaps, but you don’t need deep technical knowledge to avoid this, just the right tools.

Limited-Time Offer

20% OFF + up to $20 in BTC 🛍️ Selected Wallets Ends March 16

Get the Deal
Author logo
AuthorPatrick Dike-Ndulue

Patrick is the Tangem Blog's Editor

Author logo
Reviewed byRukkayah Jigam