MEV bots generate profits through advanced trading strategies such as frontrunning or sandwich attacks on crypto exchanges. How do these bots work and why are they useful even though they steal millions of dollars?
The popularity of smart contract applications opens up loopholes to generate additional revenue by relying on market inefficiencies and certain features of the architecture of Ethereum and other blockchain systems.
One such gap is Miner Extractable Value (MEV). Thanks to this technology, miners can earn this profit by including, excluding or reordering transactions in the blocks they create as they see fit.
But over time, attackers increasingly began to use this technology to attack various protocols and steal cryptocurrency. How do they do it?
What are MEV bots and how do they work?
MEV is a strategy where validators on the Ethereum blockchain increase their profits by influencing the order of transactions when creating a block, causing losses to other users.
In the blockchain world, transaction priority and gas fees are important factors that affect the efficiency of the network. The two leading blockchain platforms, Ethereum and Solana, use validator pools to confirm transactions, and users can speed up their transactions by paying higher fees.
Source: Chainlink
However, this approach has led to the rise of MEV bots that seek to extract maximum profit from user transactions. These bots have become particularly important in the gas fee debate on Ethereum and Solana.
The persistent threat of MEV bots and the difficulty of mitigating them has become a topic of discussion in the Ethereum and Solana communities. Ethereum developers are working on solutions at the protocol level, but they still need to solve this problem completely.
How do MEV bots make profits?
MEVs operate as blockchain scanners that deal with arbitrage, pre-running, and transaction fee manipulation.
In the case of arbitrage, MEV bots can simultaneously execute trades on different exchanges while taking advantage of differences in the prices of an asset. Arbitration is one of the most common methods for issuing MEVs.
During pre-execution, MEV bots can monitor the memory pool to determine which transactions will soon be included in the block. They then activate their trades by placing them before or after designated trades to give themselves an advantage over other traders. Sometimes these processes are combined and this is called a sandwich attack.
Source: Milkroad
For a better understanding, imagine a situation where a MEV bot notices that a transaction to purchase a large number of tokens is about to be made. The bot immediately initiates the process of selling these tokens before the upcoming purchase, which allows it to profit from the subsequent increase in the price of the tokens.
Speaking of liquidations, MEV bots are monitoring borrowing and lending platforms like Aave for potential liquidations. By detecting underfunded loans in advance, these bots place bids to profit from subsequent price movements.
Bots also manipulate transaction fees to gain a higher position, potentially to the detriment of other traders. As a result, they earned over $313.7 million in 2021-2023, according to Dune data.
Source: Dune MEV bots and blockchain protocols suffer
In September 2022, an arbitrage bot attack led to a loss of 1,100 ETH. The money stolen in the attack on the bot named 0xbad belonged to many users of the bot.
In October 2023, a MEV bot on BNB Chain made $1.575 million in profits via a Flash Lending attack on the BH/USDT trading pair on PancakeSwap. The cost of the arbitration, which resulted in the most significant profit from such operations in the history of BNB Chain, was only $4.16.
According to EigenPhi, on October 11, MEV Bot on BNB Chain: 0x21…480C made a $1.575 million profit via a flash credit attack on the Pancakeswap BH/USDT trading pair for just $4.16, the largest single arbitrage profit in history. happened. From BNB Chain. According to this…
— Wu Blockchain (@WuBlockchain) 12 October 2023
In November 2023, an arbitration bot was hacked and approximately $2 million was lost in one of the pools on the Curve Finance platform.
According to Beosin, the attacker took advantage of the unauthorized existence of the 0xf6ebebbb() function to force swapping between pools. The hacker made an instant loan of 27,255 WETH (more than $51 million at the time), changed the price balance in the WETH/WBTC pool, and executed an arbitrage transaction via a bot.
In April, the MEV bot group lost more than $25.38 million in an attack on the Ethereum blockchain. The hacker compromised several bots and replaced their transactions with malicious ones.
The hacker set up “decoy” processes to lure MEV bots. He then replaced the original transactions with new, malicious transactions that allowed him to steal money. The attacker loaded 32 ETH into the account to carry out the attack.
How to deal with MEV bots
Various approaches can help users reduce the potential impact of MEV bots on their transactions. One is to check fees before submitting the request and use defi platforms that have built-in MEV protection or special protection tools.
Platforms such as UniSwapX, 1inch and PancakeSwap use mechanisms to reduce the impact of bots. These platforms allow you to set drift tolerance, for example by defining the minimum number of acceptable tokens received when the price changes.
Why are MEV boats still worth considering?
Unlike traditional finance, MEV trading occurs primarily in an unregulated environment. Front-running and other MEV strategies, while unethical, are not as illegal as on traditional exchanges because information about pending orders on the blockchain is publicly available.
MEV bots can be highly profitable for operators but can also be used for market manipulation. This situation raises concerns about the security and fairness of the defi ecosystem.