Frontrunning — What it is and How to Avoid it

Front-Running in stock markets

Front-running is the act of slipping ahead of a transaction order that is queued to be executed and book small profits through it.

The expression stems from the days when trading on stock exchanges took place on paper. The front-running party would wait until the last moment before the execution to make a trade themselves and to book profits.

The reason this poses a threat in today’s decentralized crypto-trading is because everyone on the network knows in advance if there is a major trade in the queue.

Through keeping a close eye on the mempool on the decentralized exchange (DEX) where all valid transactions are visible, bots can scan the network for opportunities to front-run trades at a profit.

Factors such as mempool size are indicative of longer confirmation times, higher priority fees and greater network congestion.

Front-runners basically push their transaction to the front by bidding a higher gas price so that the automated market makers (AMMs) prioritize their order.

With the rise of decentralized exchanges and the increase in volumes, miners have started to insert their own front-running transactions, enabling them to extract additional value from traders while only paying a minimal gas fee since front-running fees can be kept by pool operators.

Front-running transactions on a blockchain

What is slippage?

Slippage is the leeway that traders are willing to accept in terms of price movement between order placement and execution.

It is a recurring phenomenon on all markets but much more prevalent on the crypto markets because of high levels of price volatility. Slippage is of particular concern for altcoins that trade with less liquidity.

Slippage can go two ways. If the actual executed price is lower than expected for the buyer, this is called positive slippage since the buyer receives a better price than anticipated. If the price is higher than expected, this is called negative slippage.

The reverse applies for selling orders.

Slippage

Setting the optimal slippage to avoid being front-run

To minimize the risk of being front-run and to reduce slippage, Decentralized Exchanges (DEX) have implemented an option to manually set the slippage percentage.

Too much slippage can cost frequent trades a considerable amount of money; setting slippage too low can lead to a transaction never being executed, carrying the risk of missing out on trading gains during price movements.

For smaller trading pools, where volume and liquidity is comparatively small, it is advisable to set the percentage of slippage as low as possible (i.e. to 0.1%) to avoid being front-run.

Visit us on social media:
Twitter
LinkedIn
Other

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store