The fact that users have front run is a burning problem in Crypto and has no solution, the main reason for this is that the front running bots make the value that the user receives in return is not equal to the real value that the user receives. they should accept.
The following article is intended to explain about What is Front Running Bot?related impacts and solutions for both users and projects for Front Running Bot.
What are bots?
Before diving deeper into front-running bots, let’s learn the basics of bots.
Simply put, bots are just pre-programmed programs to automate trading. Instead of having to monitor all fluctuations in the market, watch for a good time to buy and sell, the bot will automatically synthesize and evaluate the information available in the market and make asset purchases for users. use.
Most current bots have the following basic characteristics:
- Analyze data from the market: Synthesize and evaluate information from multiple sources and decide whether to buy or sell a particular asset class. (Simplified example if SUSHI price reaches $5 execute a buy order).
- Risk prediction: Calculate the risks in the market and decide how much to buy/sell.
- Ability to buy and sell properties: Use APIs to buy and sell strategically (sometimes buying many small orders, sometimes all in market price).
Bots are an effective tool because they are fully automated, have the ability to process a lot of information at once, are not influenced by emotions, and rely entirely on data to operate. But of course they are not perfect, completely depending on the parameters that reveal the disadvantages of bots in an unknown market, at this time human experience will have the advantage to help preserve capital or help create make better profits.
There are many types of bots with different uses in the market such as: trading bot used to test different trading strategies, arbitrage bot used to buy and sell arbitrage, and the type of bot that we will learn about, front- running bots.
What is a front-running bot?
Front-running is taking advantage of KNOWING that a future transaction will affect the price and placing an order right before that transaction to make a profit for yourself.
For example, in traditional finance, if a trader or a fund knew that someone else’s TLSA shares of Telsa was about to be bought by someone in volume up to $10 million, they could place a buy order just in advance and when the order to buy 10 million dollars is done causing the price to expand, they will immediately place a sell order and enjoy the profit.
Front-running example in traditional finance
Front-running Bot in Crypto
The ability to foresee an impending transaction is a very important part of front-running. So why in Crypto, front-run cases happen so often and so much?
This is in the design of Ethereum or the blockchain Similar in design to Ethereum, all submitted transactions must stop in a mempool (roughly the place where transactions are waiting to be processed). Now miners or bots can scan the mempool. Bot scanning the mempool will find suitable transactions to front-run (X).
A second feature of Ethereum’s design is that miners have the power to choose the order in which transactions are processed, and of course they will prioritize transactions that pay higher fees (this is what causes the problem). MEV). So when the bot finishes scanning and finds X, they just need to:
- Place buy order with gas fee slightly higher than X’s gas.
- Then place a sell order with gas slightly lower than X.
- And profit from the front-run.
Placing a two-headed order as above is one of the most popular front-run forms today, also known as “sandwich attack”.
Example of sandwich attack
Example of front-running bot
Example of a front-running bot. Txs hash: transaction 1, transaction 2, transaction 3
As an example of the USDC-SAK3 pair, we can see that right in the middle of a buy order of 1 SAK3 there are 2 orders to buy and sell at the same time 0.4x SAK3 from the same address, this is typical of users being front-run in crypto .
Looking at the txs hash details above, in just 2 trades, this bot pocketed more than $1,500 when he bought 0.4x SAK3 at $7,473 and sold it for $9,013.
- Front-running bots see a potentially front-run trade (the slippage is large enough, the price impact is high enough to be profitable).
- Insert a buy order with a reasonable size (because the buy order will also affect the price) before the user’s order
- Discharge immediately after the user command is executed. The profit of bots lies in the user-generated slippage, which facilitates buying at low prices and selling at high prices.
Ethereum is the ideal environment for front-run
It can be said that the design of Ethereum has created the ideal environment and provides all the necessary tools for front-run:
- Bot knows the transaction in advance and has the ability to affect the order of transactions (higher gas fees), miners can also take advantage of their rights and put their transactions first to front-run the original transaction.
- Transaction volume on Ethereum is growing, both in terms of transaction frequency and value per transaction.
Daily transaction frequency on the Ethereum network.
Value per transaction on the Ethereum network
- Thin liquidity leads to large price fluctuations.
- Anyone can create or buy and use bots to front-run.
The use of bots and high transaction fees, creating lucrative revenue for miners
⇒ Front run development is inevitable.
Value extracted by MEV (USD) shows increasing revenue earned by bots
Common types of front-runs and their effects
A few common types of front-runs:
- Basic front-run: Place orders on potentially profitable opportunities.
- Displacement attack: Miner replaces the original transaction with his or her own transaction, the replaced transaction can still be performed but the effect will not be as originally planned.
- Insertion attack (sandwich attack): Place trades on either end of the original trade and enjoy profits without holding the assets, trades that are sandwiched in attack will often suffer higher slippage.
- Suppression attack: Delay the original transaction, a potential transaction where the slippage is low, the miner can completely delay the transaction, if the transaction wants to be executed, the slip must be adjusted higher.
Solution to prevent bot front-run in crypto
From the user’s perspective
From the user’s perspective, a few basic ways that we can apply to limit the front-run include:
- Split transaction: Instead of doing many large transactions at the same time, users can split them into many smaller transactions, which will reduce the attractiveness of transactions with front-running bots because of the value they can be mined. it will go.
- Adjust slippage low: The bot itself when placing trades will also affect the price, so the adjustment slippage low will prevent unnecessary loss of users. However, a low slippage adjustment can make the trade more difficult to execute.
Front-running is part of MEV (miner-extractable value) or the profits that miners make by exploiting their authority. Currently, there is no solution to remove MEV, below are a few outstanding ideas and measures to minimize the damage that MEV brings to users.
From the angle Developers
Developers can divide measures to reduce the impact of MEVs into three main branches:
- Changing infrastructure: Blockchain eliminates the ability of miners to re-order transactions and takes measures to increase the efficiency of transaction ordering.
- There are measures to make transactions more private: Causing bots not to have enough information to make transactions
- Develop straight from the top and give Dapps the ability to minimize the impact of front-runs
A few examples of DApps (decentralized applications) that make transactions more private or have front-run restrictions:
- KeeperDAO: Use a hidden Mempool called Hiding Book. Transactions, loan orders will be sent through, where Keeper bot will take profits through MEV through arbitrage trading or asset liquidation. MEV profits are deposited into ROOK treasury, users receive part of profits in the form of ROOK tokens. These transactions will be free of charge, avoiding front-run slippage.
- SecretSwap: As an AMM on Secret Network. Secret Swap uses secret contracts (SNIP-20) to protect users from front-run MEV bots. SNIP-20s contracts are encrypted while they are in the mempool, preventing the extraction of the MEV.
- TaiChi Network: Is a Private transaction service operated by SparkPool. User transactions are only visible to Sparkpool and not to other Ethereum nodes, preventing the MEV bot from being able to find transactions on Mempool.
- Archer DAO: Archer DAO’s Archer Swap uses Archer Relay to bypass the Mempool and send user transactions directly to miners and Flashbots The project’s own MEV-Geth. ArcherSwap prevents front-runs, slippage and no transaction fees for failed trades.
- Alchemist: mistX.io is Alchemist’s AMM, operating on the Flashbots network, allowing users to send transactions similar to Flashbots’ Transaction bundle. In addition to free transactions, users also do not need to pay fees when canceling orders.
- 1Inch: Virtual rates of 1 inch set a conversion rate that, if bought and sold immediately, will receive the exact same rate. That is, if bots or users swap tokens for X price but swap back immediately after, they will receive X price, but not benefit from the “sandwich attack” anymore. 1Inch will set a waiting period called “decay period” to which the above rate is applied, ranging from 1 to 5 minutes.
Front-running in particular and MEV in general is inevitable and will grow with the growth of the Ethereum network.
The types of front-running attacks can be much more diverse and complex, taking their impact to the next level.
Sandwich Attack 2 floors
MEV has not been fully exploited yet because at the moment most miners have not yet realized the profit potential from taking advantage of their authority and mining MEV. There is a high probability that in the future, MEV miners will go mainstream and have unimaginable effects on Ethereum.
Thus, through the article, you must have understood what Front Running Bot is, as well as related impacts and solutions for both users and projects for Front Running Bot.
If you have any other questions or comments on this topic, you can comment below to discuss and exchange!