HomeKnowledge BaseHow to Avoid MEV Bots

How to Avoid MEV Bots

9 min read

Maximal extractable value, or MEV, is a pernicious form of price exploitation that is responsible for over $1.3 billion in losses for everyday traders. Most MEV takes place on the Ethereum ecosystem and adversely affects transactions across decentralized exchanges, liquidity pools, NFT marketplaces, and more.

MEV is captured by MEV bots programmed to seek out and exploit price differences. Since blockchain markets are built to be always-on, there are always arbitrage opportunities on networks like Ethereum. MEV bots exploit beginners and seasoned traders alike, so it’s important to understand how they work and how to avoid them.

What is MEV?

Before diving into the specifics of how to avoid MEV bots, let’s first make sure we understand MEV conceptually.

Maximal Extractable Value is, as the name suggests, a measure of the maximum amount of value that can be extracted from the contents of a given Ethereum block. Ethereum transactions are not all equally valuable, and validators (the parties responsible for creating the blocks) can pick and choose how to order transactions in blocks to maximize their profits.

This means that transactions are not necessarily executed in the order they are received; instead, they are arranged in a way that maximizes the compensation for validators.

1-how-to-avoid-mev-bots.webp

How MEV occurs in an Ethereum block

Upon order submission, Ethereum transactions get sent to a “mempool” where they wait to be added to a block. In this mempool, MEV bots (also known as “searchers”) can view pending transactions and bribe validators to reorder them, exploiting the little guy and profiting in the process.

What is an MEV Bot?

An MEV bot is a program designed to monitor decentralized exchanges, NFT marketplaces, lending platforms, and other on-chain venues to spot profit opportunities. There are several distinct types of MEV bots, each targeting different kinds of transactions.

Trading MEV bots: The most common type of MEV bots exploit decentralized exchanges that users rely on to swap cryptocurrencies. They specifically take advantage of the mechanisms used by automated market makers (AMMs).

When users trade on decentralized exchanges, they set a slippage tolerance to manage the price difference between the time an order is submitted and when it actually executes. Normally, slippage tolerances range from around 0.1% for stable assets like stablecoins, to 1–2% for blue-chip cryptos like Ethereum, and sometimes upwards of 10% for highly volatile cryptocurrencies like memecoins.

2-how-to-avoid-mev-bots.webp

How a sandwich attack occurs

DEX MEV bots exploit the slippage tolerance set by users to manipulate trades through a technique called a “sandwich attack.” In a sandwich attack, MEV bots identify a target trade and execute a frontrunning trade just before it, driving up the asset’s price to the slippage tolerance limit. Once the victim’s transaction goes through and raises the price further, the bots dump the token, keeping the profits for themselves.

LP MEV bots: Liquidity providers (LPs) on decentralized exchanges can also fall prey to MEV bots. MEV for LPs is known as “loss versus rebalancing” or LVR. This value extraction arises from the arbitrage between a given LP pool and a reference rebalancing pool that has more up-to-date pricing.

LVR is a problem on decentralized exchanges because price discovery for assets typically occurs off-chain. Centralized exchanges like Binance generally have more liquidity for tokens so they serve as the most accurate source of truth for up-to-the-minute prices.

MEV bots exploit this arbitrage opportunity by continuously trading against DEX pools, capturing upside for themselves at the expense of the LPs.

NFT MEV bots: MEV bots can also hijack NFT mints through a process called “frontrunning.” If an MEV bot detects a transaction in the mempool from a user attempting to purchase a valuable NFT, it can submit an order to buy the NFT for itself that executes before the user’s transaction. This is similar to frontrunning swaps on DEXs but applied to NFT mints instead.

How to Avoid MEV Bots

While MEV is a pervasive problem across all of Ethereum, there are multiple ways to keep yourself safe.

Use tight slippage when trading

The simplest way to defend against MEV is by setting a low slippage tolerance.

Since MEV exploits slippage for price manipulation, transactions with a lower slippage tolerance provide searchers with less opportunity to exploit trades.

For users not using any other MEV protection tools, setting a lower slippage tolerance can serve as an initial line of defense. However, it’s not a complete solution. Setting the slippage tolerance too low can often result in failed transactions. Even with optimal slippage, MEV bots may still manage to extract value from your trades.

Trade on pools with large liquidity

Fundamentally, MEV relies on arbitrage opportunities. One way to reduce exposure to such arbitrage is to restrict your trading only to pools with large liquidity. On these pools, individual trades won’t have much price impact, so it will be more difficult for MEV bots to extract value.

This strategy limits much of DeFi, of course, as there are constantly new coins launched, and even popular coins may suffer from low liquidity on certain exchanges or during certain times.

Install an MEV protection RPC

An increasingly popular type of MEV protection that provides a comprehensive solution to the problem is the use of an MEV blocking RPC like MEV Blocker.

An RPC (Remote procedure call) is a piece of software that sits between a user wallet and the blockchain, transmitting transactions. Normally, RPCs are a boring piece of blockchain infrastructure. Recently, however, specialized RPCs have begun incorporating extra security guarantees for transactions before they reach the blockchain.

The most popular specialized RPC endpoint is MEV Blocker. As its name suggests, MEV Blocker provides protection against MEV across the entire Ethereum network. This RPC manages a permissionless network of searchers and conceals transactions from the public mempool. These searchers cannot frontrun or sandwich user transactions; instead, they capture value through backrunning. Whenever a searcher backruns a user’s transaction, they keep up to 10% of the value and return the remaining 90% to the user as a rebate. This means that even when a transaction leaves money on the table, MEV Blocker ensures users get most of that value back.

MEV Blocker protects all types of Ethereum transactions, not just swaps, and is compatible with all Ethereum wallets. You can install the MEV Blocker RPC endpoint by following the instructions here.

Use intent-based trading solutions

While RPC endpoints provide protection against MEV across many different types of trades, the most comprehensive solutions take place at the application level.

In recent years, there has been a surge in the popularity of intent-based trading solutions like CoW Swap, with leading exchanges like 1inch and Uniswap launching their own intent-based solutions in 1inch Fusion and Uniswap X. Unlike traditional decentralized exchanges, intent-based trading solutions rely on professional execution parties known as “solvers’’ to execute trades on behalf of users.

Delegating execution to professional third parties helps users get the best prices for their trades, as solvers can determine the optimal liquidity sources to tap into. It also means that the risk of MEV gets taken on by the solver themselves, and users are protected from direct price exploitation.

3-how-to-avoid-mev-bots.webp

The flow of a transaction on CoW Swap

(For LPs) Use an MEV-capturing AMM

Until recently, there wasn’t a great solution to MEV in the form of loss-versus-rebalancing (LVR). LPs basically had to accept that providing liquidity for tokens comes with a tax paid to the MEV bots that constantly rebalance the pools (at the expense of the liquidity providers themselves).

This all changed, however, with the launch of CoW AMM — a first-of-its-kind MEV-capturing AMM that redirects profits from pool rebalancing to liquidity providers. CoW AMM works sort of like MEV Blocker in that it makes the MEV bots work FOR users rather than against them. To trade against the liquidity in CoW AMM pools, solvers must bid to provide the most surplus to the pool, thereby giving the majority of LVR profits to the LPs.

Why MEV bots are bad for Ethereum

As a permissionless, public platform, Ethereum serves as a battleground of opinions on whether MEV is good, bad, or should even be allowed in the first place.

Those sympathetic to the practice argue that MEV is a natural market mechanism that enhances market efficiency and encourages price discovery. While litigating the specifics of the issue is beyond the scope of this article, there are important arguments to be made for why MEV bots are harmful to individual users.

4-how-to-avoid-mev-bots.webp

A snapshot of total MEV value extraction

Reduce fairness

At its core, value extraction prioritizes sophisticated traders who have the means and know-how to exploit transactions and profit off minute arbitrage opportunities.

Users who may simply be making trades on exchanges or minting NFTs have no way to compete with these value extractors unless they themselves are capable of writing better bots to protect their transactions.

Disproportionately target beginners

Those new to DeFi are particularly vulnerable to being exploited. The world of decentralized trading is complex for beginners, who may not even understand settings like slippage tolerance, making them easy prey for bots waiting to take advantage of inexperienced traders.

This creates a negative equilibrium for decentralized trading that may drive newcomers away, hurting the ecosystem as a whole.

Engage in market manipulation

While there are arguments to be made for MEV encouraging market efficiency and price discovery, this is not the case with every type of MEV.

For example, trading MEV bots rely on exploiting slippage tolerances by raising prices up to a threshold and then selling immediately after in a sandwich attack. In this scenario, the AMM does not benefit from price discovery, but instead experiences an artificial pump-and-dump at the expense of a single trader. In traditional markets, such a move could be considered market manipulation as it adds nothing to the market and is designed solely to profit off a market participant.

CoW DAO: Protecting Ethereum Users from Negative Outcomes

Ultimately, the goal of Ethereum is to serve as a public platform that enables innovation. MEV as a problem emerges from a largely unrestricted marketplace. This benefits innovation by encouraging novel market mechanisms, but it also poses risks to uninformed traders. For this reason, it’s important for users to be aware of the solutions available for protecting themselves.

Regardless of what side of the MEV debate you stand on, most of us agree that we don’t want our trades exploited. To this end, CoW DAO has your back with products that protect you from Ethereum’s dangers and work to ensure positive outcomes.

Install MEV Blocker here: www.mevblocker.io

LP on CoW AMM: https://cow.fi/cow-amm

Swap on CoW Swap: www.swap.cow.fi