DeFi 1inch Network

How 1inch protects users from front-running

1inch Network-photo

by 1inch Network

• 2 min read

A unique feature, ‘virtual rates’, protects users making swaps on 1inch from front-running attacks.

Many users swapping tokens on automated market maker (AMM) exchanges have knowingly or unknowingly been impacted by front-running attacks. The 1inch Liquidity Protocol has a unique feature that helps protect users from these kinds of attacks, ensuring users get the most out of every trade.

A front-running attack occurs when a malicious user observes a swap transaction after it is broadcast but before it is finalized and reorders transactions to benefit themselves. Commonly, a miner or bot will place their own transaction immediately in front of the pending transaction. Front-running is a form of blockchain extractable value, which has resulted in an estimated $28.8 mln profit for those front-runners in the last two years alone.

On AMMs, swap rates depend on the amounts of tokens in swap pools. For instance, a user wants to swap token A for token B. As a result of the trade, the amount of token A in the pool increases, and the amount of token B decreases. Consequently, the exchange rate also changes, and token B becomes more expensive against token A.

A front-runner puts their swap trade of token A against B in front of the user’s. As a result, the swap rate changes by the time the user’s transaction is finalized, becoming worse than what was originally displayed or failing completely. Thanks to these two trades, token B becomes more expensive against token A, and the front-runner gets in another transaction, selling back token B for token A and making a profit on the change in the swap rate.

To discourage front-runners from attacks of this kind, the 1inch Liquidity Protocol has ‘virtual rates’. Following each swap deal, the swap rate changes only for further swaps in the same direction — say, for swaps of token A for token B. However, for swaps in the opposite direction — token B for token A — a virtual rate is introduced, which corresponds to the rate before the swap deal was made.

As a result, if a front-runner wanted to swap token B back for token A, they wouldn’t be able to do that at a profitable rate, which makes the entire front-running operation unprofitable for them.

Virtual rates are automatic features of swapping on the 1inch Liquidity Protocol. A virtual rate is effective for a certain period of time following the trade, which we refer to as a ‘decay period’. 1inch governance participants can set the duration of a decay period between 1 minute and 5 minutes.

As the Ethereum network grows in participation and DeFi activity, protecting against arbitrage opportunities like front-running becomes more critical to providing users with a consistent user experience. The 1inch Network is able to offer large and small DeFi users alike the assurance of trading without being front-run, creating a more stable and equal financial marketplace.

Come and join the ride!

1inch Network-photo

1inch Network

Share the article

Copy done!
Copy done!