3 Minute Tips: Avoiding Front Runners on Decentralized Exchanges
Crypto Basics

3 Minute Tips: Avoiding Front Runners on Decentralized Exchanges

5mo ago

If you've placed a trade on a DEX and noticed that you received less than expected when it was finalized, chances are you've been front runned. What is front running – and how can you avoid it?

3 Minute Tips: Avoiding Front Runners on Decentralized Exchanges

Table of Contents

If you’re a frequent user of decentralized exchanges (DEXs) that runs on the automated market maker (AMM) model, then you may have noticed that if you place a large order on a low liquidity pool (and even some high liquidity ones) you will often receive less than you expected once your trade is finalized. 

Though this is sometimes down to simple bad luck, more often than not it’s caused by a so-called front runner – i.e. a person that exploits the way transactions are ordered within a block to extract profit from another trader (hereon described as ‘the target’). 

Briefly, it involves placing a large buy order and then a large sell order before ordering these in the next block through a so-called priority gas auction (PGA). The front runner’s buy order is ordered before the target’s buy order, and the front runner’s sell order is ordered after it – thereby siphoning some value from the target. 

Want to learn more about front running? Check out our glossary entry — here!

The goal here is to buy a large number of tokens at a low price, before selling them to the target at a slightly higher price while simultaneously exiting the position. When done right, this can lead to almost risk-free profits for the front runner. 

​​Now, before you think you might be able to do it manually, think again. Front runners bots typically operate on a millisecond-scale timeframe. They can read a transaction from the mempool, calculate the optimum transaction size, configure the transactions and then execute them within a fraction of a second. It’s simply not possible to compete while operating manually.

Unfortunately, front running is an incredibly common practice on Ethereum-based DEXs like Uniswap and Balancer, and is also beginning to crop up on cross-chain AMMs too. Getting hit by a front runner isn’t fun, so here’s how to avoid it.

Strategy 1: Avoid Low Liquidity Pools

Low liquidity pools are a front runner’s dream. After all, there’s less chance of competition among other front runners, and less chance that their transaction could be disrupted by a large order that suddenly changes the pool weighting before they enter. 

If at all possible, you should avoid low liquidity pools to minimize the odds of being targeted by a front runner.

Strategy 2: Set Low Slippage

Most DEXs allow you to set a maximum slippage tolerance. This is the maximum deviation from the expected return that you will allow – such as 0.5%. 

If, for example, you expected a return of 1,000 USDT for your order, then you might receive as low as 995 USDT if your slippage is set to 0.5%. But this deviation can be far greater if you set a higher slippage tolerance.

To avoid front runners, keep your maximum slippage low – somewhere around 0.5% - 2%. The larger your order, the lower you will want to keep your slippage. Front runners love high slippage and large orders!

Strategy 3: Overpay on Gas

Slow transactions give the front runners more time to formulate an order to successfully siphon value from your trade. By underpaying on gas, odds are your transaction will be queued for longer, giving front runners more time to work. 

To help minimize your odds of being targeted, consider overpaying on gas to improve the priority of your transaction. This might come in the form of using the ‘fast’ gas option on your wallet of choice or simply setting the gas price to higher than average. 

This step is doubly important if you intend to place a large value order – since there is a strong chance you will be targeted. 

Strategy 4: Place a Smaller Order

Front runners generally need to risk a lot to win a little. But beyond this, there are also minimum thresholds they need to respect in order to turn a profit – since they must take into consideration the gas fees on both entering and exiting the market, as well as the amount lost as the trading fee.

Since the average transaction fee is currently around $25 a pop for major Ethereum-based AMMs like Balancer, SushiSwap and Uniswap, and two transactions are required to front-run, you can be fairly sure you won’t be targeted if your trade would result in less than $50 profit for the front runner.

The best way to accomplish this is by placing a low value order. Odds are, if you’re trading with sums under $1,000, then odds are you’re safe – that is, unless gas prices decrease considerably and reduce their profitability threshold.

Will Front Running Still Exist on Ethereum 2.0?

In short, yes. As the Ethereum network merge and proof-of-work is phased out, the beacon chain introduces staking and validators in a proof-of-stake consensus mechanism. Validators, or block proposers, are given their positions ahead of time to process transactions in an epoch. Front runners may have a longer time finding profitable trades in a crowded space, but the possibilities of being front run are still there, especially by those technically inclined.

Keep these in mind the next time you trade on a DEX to avoid front runners!

This article contains links to third-party websites or other content for information purposes only (“Third-Party Sites”). The Third-Party Sites are not under the control of CoinMarketCap, and CoinMarketCap is not responsible for the content of any Third-Party Site, including without limitation any link contained in a Third-Party Site, or any changes or updates to a Third-Party Site. CoinMarketCap is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement, approval or recommendation by CoinMarketCap of the site or any association with its operators. This article is intended to be used and must be used for informational purposes only. It is important to do your own research and analysis before making any material decisions related to any of the products or services described. This article is not intended as, and shall not be construed as, financial advice. The views and opinions expressed in this article are the author’s [company’s] own and do not necessarily reflect those of CoinMarketCap.