Key Takeaways

  • MEV (Maximal Extractable Value) is profit that validators and bots squeeze out by reordering, inserting, or front-running transactions before a block is finalized.
  • The most common attack on retail traders is the sandwich attack, where a bot buys right before your trade and sells right after, pushing your price worse.
  • Your slippage tolerance is the single setting that most directly controls how much a bot can steal from a single swap.
  • Low slippage protects your price but risks failed transactions; high slippage almost guarantees a swap fills but leaves the door wide open for bots.
  • Private transaction routing (MEV-protected RPCs) lets you keep slippage usable while hiding your trade from the public mempool.

If you swap tokens on a decentralized exchange, there is a good chance a bot has already taken a small cut of your trade without you noticing. The mechanism is called MEV, and the good news is that the main defense against it is a setting you already have access to: slippage tolerance. This article explains what MEV is, why your everyday swaps are a target, and exactly how to configure your wallet so bots get as little as possible.

What MEV actually is

MEV stands for Maximal Extractable Value (originally "Miner Extractable Value"). It is the extra profit a block producer can capture by choosing the order in which transactions go into a block, and by inserting or excluding transactions of their own. On most public blockchains, when you submit a transaction it sits in a waiting room called the mempool before it gets confirmed. Anyone can watch that waiting room. Bots scan it constantly, looking for trades they can profit from.

MEV is not inherently malicious. Some of it, like keeping lending markets solvent through liquidations or aligning prices across exchanges through arbitrage, is useful and keeps DeFi working. The problem for regular traders is a specific, predatory form of it that targets ordinary swaps.

The sandwich attack, step by step

The attack that costs retail traders the most is the sandwich attack. It works like this. A bot sees your buy order sitting in the mempool. It quickly places its own buy just before yours, which nudges the token price up. Your trade then executes at that worse, higher price. The moment your trade lands, the bot sells what it just bought, pocketing the difference. Your order is the filling between the bot's two slices of bread.

The reason this works is slippage. When you set a slippage tolerance, you are telling the exchange: "I accept a final price up to this much worse than quoted." A bot can only move the price against you up to that limit before your transaction would fail. So your slippage setting is, quite literally, the maximum amount a sandwich bot is allowed to take from a single trade. Set it too generously and you are handing the bot a bigger knife.

Why slippage exists in the first place

It would be tempting to just set slippage to zero, but that breaks normal trading. Prices on a decentralized exchange move between the moment you click swap and the moment the transaction confirms, because other people are trading the same pool. Slippage tolerance is the cushion that lets your trade still go through despite that natural movement. If the price moves more than your tolerance, the swap reverts and you only lose the network gas fee, not your funds.

So you are balancing two real risks. Too tight, and legitimate price movement makes your swap fail repeatedly, wasting gas. Too loose, and you invite bots and absorb bad fills. The right number depends on the token.

How to set slippage for daily swaps

There is no single magic number, but there is a sound method. Match your slippage to how liquid and how volatile the token is. The deeper the liquidity pool, the smaller a tolerance you can use without failures.

Token type Typical situation Sensible slippage approach
Major / blue-chip Large, deep liquidity pools, low price impact Keep it tight. A small tolerance usually fills fine and gives bots almost nothing.
Mid-cap Moderate liquidity, some volatility Slightly higher tolerance, but raise it gradually only if a swap fails.
Low-cap / new tokens Thin liquidity, large price impact, sometimes transfer taxes May genuinely need higher slippage to fill, which is exactly when bots are most dangerous. Use private routing.
Stablecoin pairs Prices hug each other closely Very tight tolerance is appropriate; large slippage here is almost never justified.

The practical rule: start low and increase only as much as you need to get a fill. Never accept a sky-high default just because the wallet auto-suggested it to make the transaction "go through." When a low-liquidity token forces you toward a wide tolerance, that is your signal to change tactics rather than just crank the number up.

Watch the price impact warning, not just slippage

Most DEX interfaces show a separate price impact figure: how much your own trade size moves the pool. This is different from slippage tolerance. A high price impact means your trade is large relative to the pool, which both worsens your fill and makes you a juicier target. If you see a high price impact, consider splitting the trade into smaller parts or using a router that spreads it across multiple pools.

Beyond slippage: protecting the transaction itself

Slippage limits the damage, but the cleaner fix is to stop bots from seeing your trade at all. Several approaches now exist, and most are free to use.

Private RPC endpoints

An RPC (Remote Procedure Call) endpoint is the connection your wallet uses to talk to the blockchain. By default many wallets broadcast your transaction straight to the public mempool, where bots are watching. An MEV-protected RPC instead routes your transaction privately to block builders, so it never appears in the public waiting room. You usually add one by swapping the network URL in your wallet's settings. With your trade hidden, a sandwich attack becomes far harder to execute, and you can keep slippage at a usable level without feeding bots.

DEX aggregators and protected order flow

Aggregators route your swap across several pools to find a better effective price and reduce impact. Some also offer built-in MEV protection or batch trades together so individual orders are harder to single out. Intent-based and auction-style exchanges go further by having professional solvers compete to fill your order, which can return some of the value that would otherwise leak to bots.

Timing and gas behavior

Trading during calmer network periods can reduce competition for block space and lower the chance of a bot outbidding you. Avoid manually overpaying on gas in a way that flags a large, urgent trade, and be cautious with very large swaps in thin pools, which are the textbook target.

Pros
  • Tight slippage caps how much any single sandwich attack can extract.
  • Private RPC routing can hide trades from the public mempool entirely, often for free.
  • Aggregators reduce price impact and may include MEV protection by default.
  • Splitting large trades lowers both price impact and your visibility to bots.
Cons
  • Slippage set too tight causes failed swaps and wasted gas fees.
  • Low-liquidity tokens may force wider slippage, raising risk just when it matters most.
  • Private RPCs add a setup step and require trusting the route provider.
  • No method removes MEV completely; the goal is to minimize, not eliminate, leakage.

A simple checklist before you swap

  1. Check the displayed price impact, not just the slippage box.
  2. Start with a low slippage tolerance and raise it only if the swap fails.
  3. If a token demands very high slippage to fill, use private routing instead of just raising the number.
  4. Add an MEV-protected RPC to your wallet for routine trading.
  5. Split large orders or use an aggregator when trading into thin liquidity.

No, but it strictly limits how much a sandwich attack can take from each trade, because the bot cannot move your price beyond your tolerance. It is your single most effective everyday control.

The token's price is moving more than your cushion allows before the transaction confirms, usually because the pool is volatile or thin. Raise the tolerance slightly, trade a smaller size, or use a more liquid route.

Reputable MEV-protected endpoints simply route your transaction to block builders without exposing it publicly. As with any service, use well-known providers and understand that you are trusting that route to relay your transaction honestly.

Tiny trades are often not worth a bot's gas cost to attack, but it still pays to keep slippage tight by habit. Consistent settings protect you on the larger or thin-liquidity trades that bots do target.