HomeKnowledge BaseWhat is Backrunning? — MEV Attacks Explained

What is Backrunning? — MEV Attacks Explained

8 min read

Overview

  • Backrunning is one of the three main types of MEV, but it’s the least harmful as it only involves capturing arbitrage left over after a large trade
  • When a trader places a large trade that artificially inflates the price of an asset on an AMM, an MEV bot can backrun the trade and profit from the arbitrage
  • CoW Swap eliminates backrunning opportunities through its delegated trading mechanism, while MEV Blocker pays out rebates for any backrunning opportunities user trades create when transacting anywhere on Ethereum

what-is-backrunning-mev-attacks-explained-cover-photo.webp

Backrunning is a specific type of MEV (Maximal Extractable Value) which causes some traders to miss out on potential profit opportunities from their trades.

In practice, backrunning involves strategically executing a transaction immediately after another, high-value transaction. By doing this, the backrunning transaction capitalizes on the arbitrage opportunity left over from the price impact of the initial transaction.

Backrunning involves the tactical use of the information contained within the Ethereum mempool — a holding area for all pending transactions — to place transactions immediately after high-value trades in order to profit.

Out of the three types of MEV (frontrunning, sandwich attacks, and backrunning) backrunning is considered the least harmful. In fact, if performed by itself, this method simply captures the arbitrage opportunity left over by a large trade without affecting the initial trade itself. Backrunning is only harmful to the user when combined with a frontrunning attack, which results in the worst kind of MEV — the sandwich attack.

For advanced traders who are capable of capturing the leftover arbitrage from their trades, backrunning may be considered a missed opportunity since it’s technically money left on the table.

Thankfully, not everyone has to be an experienced trader to capture the backrunning profits from their trades. Retail traders can automatically benefit from backrunning opportunities through specialized RPC endpoints such as MEV Blocker.

How backrunning works

The most common perpetrators of backrunning are MEV bots programmed to monitor pending Ethereum transactions. These bots place strategic trades directly after existing trades in order to capture the arbitrage left over from their price impact.

The process takes advantage of the mechanisms of automated market makers (AMMs). Whenever a large trade goes through, it imbalances the liquidity pools of the AMM, causing the price of the asset being sold to go down, and the price of the asset being bought to go up. This price imbalance leaves an arbitrage that MEV bots correct by placing a follow-up trade, earning a profit in the process.

Backrunning example

To better understand the concept of backrunning, let’s consider an example scenario. In this example, a user named Alex initiates a substantial trade, selling $10,000 of ETH to buy COW on Uniswap. Due to the nature of AMMs, this swap leads to a jump in the value of COW and a drop in the value of ETH on this particular exchange (Uniswap).

At the same time, an MEV bot notices Alex’s large transaction and springs into action. The MEV bot acquires Alex’s sell token (ETH) at this lower price and immediately turns around and sells it for a higher price on a different exchange where this price arbitrage has not yet been reflected. The bot profits from the price difference between the assets on these two exchanges.

From a technical perspective, Alex’s transaction doesn’t result in any realized loss for him, since he still got the price he was quoted for his trade. However, his trade created an arbitrage opportunity that he didn’t capture, leaving money on the table.

The actions of the MEV bot have broader implications for the DeFi ecosystem. Bots monopolize arbitrage opportunities between exchanges and deny regular users the chance to benefit from the price impact their trades create.

Related MEV tactics

Frontrunning: In a frontrunning attack, an MEV bot spots a profitable transaction, duplicates it, and offers a higher gas fee so that validators execute the duplicate transaction before the original one. In effect, the MEV bot hijacks the profits of the original transaction and keeps them for itself.

Sandwich Attacks: This tactic combines frontrunning and backrunning. An attacker first executes a frontrunning transaction before a valuable trade, pushing the price of the asset up to the slippage tolerance set by the victim trade. This increases the price of the purchased asset. The victim trade then goes through at this new higher price and its price impact raises the price of the asset even more. Finally, the attacker performs a backrunning attack which captures the newly-created arbitrage, generating a profit in the process.

How harmful is backrunning?

Backrunning is not as harmful as the other types of MEV attacks since it doesn’t result in traders receiving a worse price for their trades. Rather, it simply means that traders leave money on the table by not capturing the arbitrage opportunities from their large trades.

This opportunity cost primarily affects advanced traders who would otherwise be able to capture this arbitrage for themselves. Everyday traders are usually not sophisticated enough to backrun their own trades, so backrunning does not really result in measurably worse outcomes for them.

However, MEV Blocker can help anyone trading on Ethereum automatically capture any backrunning opportunities that their trades create.

How CoW Swap protects against backrunning

CoW Swap has developed an innovative set of mechanisms for mitigating harm from all types of MEV, including backrunning. The system relies on Order Flow Auctions that gather and consolidate user orders into a batch before execution. Specialized parties known as “solvers’’ compete to find the most optimal execution path and provide the best settlement solution.

The design of CoW Swap helps protect against MEV attacks in several ways:

  1. Delegated trade execution: When users submit orders on CoW Swap, they are not directly initiating a blockchain transaction, like they would on Uniswap for example. Instead, users submit orders as signed “intent to trade” messages which include the details of the intended trade, but don’t actually get submitted to the blockchain. The solvers then find the best execution path for the specified trade and execute the trade on-chain on behalf of the user.
  2. Uniform clearing prices: The batch auction system ensures that each asset in the batch only executes for a single price, even if there are multiple trades using that asset. This negates the price variations inherent to AMMs that result in different prices for trades within the same block due to sequential transaction processing. Uniform clearing prices nullify the strategy of transaction re-ordering, thereby mitigating the impact of MEV.
  3. Liquidity: CoW Swap’s unique solver design executes trades optimally without leaving room for arbitrage opportunities. Thanks to Uniform Clearing Prices, all token pairs traded in the same batch will clear at the same price, leaving liquidity pools balanced with no opportunity for arbitrage.

In addition, CoW Swap leverages off-chain interactions known as “Coincidences of Wants” (CoWs) to swap user assets peer-to-peer, leaving zero room for MEV. Furthermore, the protocol’s Order Flow Auction mechanism ensures that user trades are maximally protected from all types of MEV.

Backrunning is prevalent in the DeFi space, leaving everyday traders with suboptimal outcomes at the expense of searchers & MEV bots. However, innovative solutions like CoW Swap are combating the issue of backrunning and MEV as a whole through innovative Order Flow Auction design.

MEV Blocker — Profit from backrunning

On CoW Swap, your orders are protected from all types of MEV, including backrunning, sandwich attacks, and frontrunning.

CoW DAO has taken MEV protection a step further, however, with MEV Blocker. MEV Blocker is a custom RPC endpoint that you add to your crypto wallet which routes all of your transactions through a trusted network of searchers that scan for backrunning opportunities, but cannot frontrun or sandwich your trades. The best part? The RPC passes the profits from backrunning opportunities back to you in the form of rebates. This means you can make money from any backrunning opportunity you create just by routing your transactions through MEV Blocker.

MEV Blocker works on all types of transactions across all of DeFi. Just add the RPC endpoint to your wallet and start trading.

While MEV Blocker should be part of every Ethereum user’s arsenal, it’s still optimal to use CoW Swap when doing swaps. CoW Swap is specifically engineered to give traders the best prices and protect against all types of MEV without leaving backrunning opportunities.

Remember: if you’re swapping, use CoW Swap. For everything else, rely on MEV Blocker.