Need Help?

Join The Community

20 Days
Antminer S19Pro 20Days
BTC-Activity
Service Fee
The service fee refers to the operation and maintenance expenses incurred by 1024Mining to ensure the stable operation of the mining machine.
$0.0439/TH/Days
Hashrate fee
Cloud computing power fees refer to the fees paid when purchasing computing power through cloud services.
$0.0298/TH/Days
Sold 30%
$14.74
$17.36
Buy Now

MEV and arbitrage

1.MEV Principle

The full name of MEV is Miner Extractable Value, which refers to the maximum amount of profits that miners (including verifiers) can extract from blockchain production beyond standard block rewards and fuel costs by using the ability to reorder, insert, ignore, or review transactions in the process of packaging blocks, MEV is generated by complex financial transactions on the blockchain, such as arbitrage, clearing, and sandwich transactions, which are very sensitive to the order of transactions.

The value generated by MEV mainly includes the fuel costs generated by transactions and the profitable orders present in the transaction list. Arbitrage trading operators are often willing to pay extremely high fuel costs to miners in order to arrange their orders in the unknown where profits can be obtained. This allows miners to package blocks in the desired order, thus making profits. Miners also receive higher fuel costs due to these profitable orders.

2.Generation of MEV

The generation of MEV comes from the delay between when a user submits a transaction on the blockchain, the transaction information is transmitted to the network, and the actual block is mined. Before the Ethereum transaction is included in a block, the transaction is located in the transaction pool to be processed for public access called mempool, and everyone can see the content. Arbitrageurs and miners can listen to this memory pool and find opportunities to maximize their profits, such as through early trading. Miners can also rearrange the order of transactions. During this period, users basically cannot control when and in what order this transaction will be executed. Overall, the process of mining blocks by miners is fair, but miners have significant control over the transactions that can be included in the blocks. MEV is an intangible tax levied by miners and arbitrageurs on ordinary users.

3.Transaction Memory Pool

A memory pool is an open trading pool that includes unconfirmed transactions, all arranged in an orderly manner within the memory pool. The number of unconfirmed transactions contained in each block is limited. Miners have full autonomy in selecting which unconfirmed transactions will be packaged into blocks. When a transaction is selected for packaging, it will be stored in a new block and broadcasted. Once confirmed, the transactions within it will be permanently stored.

Miners usually prefer transactions with high packaging costs to achieve Profit maximization. This prompts them to seek other ways to bring them more profits. However, miners are not the only ones doing this: robots scan memory pools and place packaged transactions before or after user transactions to extract value.

4. Arbitrage

The acquisition of all arbitrage opportunities relies on the acquisition of memory pools, obtaining unpackaged transactions, and then finding profitable orders from them, making decisions based on arbitrage strategies. At present, the daily scale of the arbitrage market has reached billions of dollars in profits.

1> Triangle arbitrage

Refers to the existence of some price differences between different DEX currencies for the same currency. When there is a significant decline or increase in one pool, and the other pool has not yet changed, there is arbitrage space. Arbitrage robots use flash loans to smooth out the price difference and achieve arbitrage. As shown in the HOBBES token in the picture, the robot purchased the token from UNISWAP V2 and then sold it to UNISWAP V3, generating revenue through the price difference between the two pools.

2> Liquidation

Money markets like Aave, Compound, and Maker allow users to deposit some assets as collateral and borrow other assets. As the value of mortgaged assets fluctuates, users’ borrowing ability also fluctuates.

If the borrower exceeds the budget limit, these agreements will rely on market participants to clear the borrower, but will require payment. In order to incentivize liquidation, the agreement charges a liquidation fee to the borrower and hands over a portion of the fee to the liquidator.

This is the opportunity for MEV. Searchers compete to monitor the positions of all borrowers and attempt to become the first person to clear their positions, thereby charging themselves liquidation fees.

Similar to arbitrage, liquidation events are highly competitive. During the sharp downturn in the market, competition for clearing borrowers resulted in huge gas fees. Similarly, searchers who can optimize their code are more competitive and can participate in bidding and clearing.

3> Sandwich attack

Transactions on the blockchain do not occur immediately. When users send a Swap transaction, they define an acceptable percentage change in price (sliding point), which is the price difference of the acceptable loss. If the loss is not lower than the sliding point, the transaction can be completed, otherwise it will fail.

If users set too high a sliding point for their transactions, a ‘sandwich attack’ will occur. Arbitrators discovered these transactions through memory pooling, first advancing the user’s transactions to the highest acceptable sliding point, causing the transactions to occur at unfavorable prices. Then execute the user’s transaction, further driving up prices. To achieve this step, a higher GAS fee is used to buy a certain amount of tokens based on the slip point of the target order before the target order is placed. A GAS fee lower than the target order is used as the selling order, which is ranked after the target order. This way, the sandwich attack is successfully implemented, and profits are obtained through selling the order after the block is smoothly generated.

As shown in the figure, the attacker successfully implemented a sandwich attack within the same block, using 3.6748 BNBs to buy and 3.71077 BNBs to sell, resulting in a profit of 0.03597 BNBs, approximately 8.7 USDTs.

4>Front-Running

It refers to the attack behavior of the preemptive robot, which continuously scans transactions in the Mempool while waiting for packaging in a normal transaction. The preemptive robot discovers that the order has profits and completes the attack transaction by setting higher gas fees to gain user benefits. It can also be to predict the rise and fall of a certain token through a memory pool, and then increase the GAG fee before these orders are sold before profits or losses occur.

5>Back-Running

It refers to the act of inserting a transaction after a transaction that causes significant price fluctuations, which may be arbitrage, liquidation, etc. For example, a large Tx transaction occurred on the chain, causing price fluctuations in a certain trading pair. Inserting a subsequent transaction can flatten the price of DEX, while arbitrageurs also gain profits; Or the act of inserting a clearing order after a mortgage loan triggers the clearing line on the chain. It can also be obtained through the transaction list of the memory pool that a token has experienced a sharp decline, which is caused by an order. The information of the order can be obtained through the memory pool, and then followed by the order for bottom reading.

5. MEV based protocols and applications

1.Flashbots

This application mainly exists in Ethereum. Due to the existence of MEV and arbitrage, the transaction fees of Ethereum frequently soared, blockchain congestion occurred, and the transaction confirmation speed slowed down. The emergence of Flashbots is to alleviate this phenomenon, optimize the Ethereum network, and reduce the negative impact and risk brought by MEV.

Principle:

In the Flashbots Alpha solution, participants are mainly divided into “arbitrage traders (searchers)” and “miners”, and both must use the MEV Geth client (a forked version of the Geth client that has been modified by Flashbots to accept Flashbots trading packages and compare Flashbots blocks with regular blocks).

The former is not only the arbitrageur who initiates the transaction, but also responsible for the search work of “searching for the highest transaction fee on the current chain and packaging it into a transaction package”. These searchers will compete with each other to find out the transaction sequence with Profit maximization, and package it into a “transaction package” to compete with each other, so as to let the miners pack their own transaction package into the next block. The miners will select the transaction package under the sealed bid auction mechanism, and generate a “block template” with transaction information. If the miners compare with the searchers’ “block template” commission income is greater than their packaged blocks, They will abandon their own packaged blocks and select block templates for chain up and mining verification.

Under this mechanism, it is equivalent to establishing a dedicated communication channel between miners and arbitrage traders (searchers), and outsourcing the trading salvage work that originally belonged to miners to searchers. The benefits arising from this are:

1. Avoiding Trading Strategy Leakage: Searchers themselves are arbitrage traders. For them, as long as they package their arbitrage trades into the trading package, they can bypass the trading pool and avoid trading leakage to other participants on the chain.

2. Price War Disappearance: Due to the fact that arbitrage traders’ trades are not leaked before confirmation, PGA robots cannot detect arbitrage trades, and naturally there will be no gas price bidding issues. Generally, users can also effectively reduce the gas price when sending transactions.

3 Seekers (Arbitrage Traders) can save money: Arbitrage traders can avoid the dilemma of failing trades and having to pay miners’ fees. Miners can earn additional benefits: After selecting a transaction package and successfully linking it to the chain, miners can receive additional tips from searchers

Simply put, both miners and arbitrageurs use the services of Flashbots. Arbitrageurs select one trading package for miners, which can be several transactions, and then insert their own transactions into it. After the miners receive this package, they directly use the order inside the package to arrange them, thus avoiding competition for arbitrage.

2.MEV - Geth

MEV Geth is a modified go ethereum client that addresses the high gas fees generated during the MEV extraction process. Not only can it listen to memory pool information like other nodes, but it can also connect to the relay server operated by Flashbots. MEV Geth isolates MEV transactions offline, providing miners and transaction searchers with an exclusive channel for bidding, allowing them to exchange transaction order preferences, preventing transactions from being discovered by other nodes in the network, and alleviating high gas fees and network congestion on the chain.

MEV Geth introduced the concept of “transaction searcher”. Its work is to monitor the status of Ethereum and the opportunities to extract MEV in the transaction pool, find the most valuable sort, and submit it to miners using the standardized template auction of transaction bundling. Transaction searchers can configure the list of miners they want to submit transactions to. Miners who want to participate in the Flashbots core project must be screened before they can enter the MEV Geth whitelist.

MEV-Geth selects the most valuable bundled transactions among all bundled transactions. Compare the block containing this bundled transaction with a regular block without any bundled transactions. MEV Geth will be executed, and if this bundled transaction is included, it will be more valuable. Otherwise, this bundled transaction will automatically return to a regular Geth block.

To put it simply, on the basis of Ethereum client code, according to the design concept of flash bots, a client version compatible with Ethereum main network has been implemented.

3.MEV - Relay

MEV Relay is a Bundle relay server that can directly connect miners to arbitrage robots who wish to be included in the transaction. MEV Relay can simulate every bundled transaction and filter out invalid or bundled transactions that are lower than the market gas fee in payment. The transaction searcher bundles the sorted transactions that they want to package and chain through MEV Relay and submits them to the miners on the MEV Geth whitelist. Miners evaluate bundled transactions through closed auctions, generate block templates with transaction sequence information for chaining, and include their transactions in the blocks.

A bundled transaction contains information such as:

Bundled transactions to be executed (consisting of a set of sorted unfinished Ethereum transactions, block height, minimum timeout, and maximum timeout);

The tips transferred to miners in the form of ETH do not require payment of Gas fees for these transactions, nor do they require payment of costs for failed transactions. Only when the bundled transaction of the transaction searcher is included in a block, the tip in the bundled transaction will be paid to the miner, otherwise.

The operational process of MEV Geth and MEV Relay:

1. Users can use transaction bundling in MEV-Geth, which includes one or more pending transactions in the memory pool of transaction searchers and/or other users. The transaction searcher calls the tip function paid to the miner through a smart contract. And the Flashbots bundle will always be located at the top of the block.

2. MEV-Relay receives bundled transactions and sends them to all whitelisted MEV-Geth miners.

3. Miners receive Flashbots bundles from MEV-Relay and process them in MEV-Geth.

4. MEV-Geth selects the most profitable bundled transaction from all sent bundled transactions and places it on the top of a new block.

Then, MEV-Geth compares the blocks containing this bundle with those without any bundles.

6. The tips related to the transaction searcher’s bundle will only be paid when their bundle is included in a block.

7. If the block does not contain bundled transactions and the transaction is not linked, the transaction searcher and/or other users will not spend any money, that is, if the transaction fails or is cancelled, there is no need to pay a Gas fee.

6. Summary

Arbitrage mainly relies on the transaction memory pool, obtaining a list of transaction orders in the waiting queue, analyzing profit orders, implementing arbitrage according to one’s own strategy, and bribing miners to achieve the desired order by increasing GAS transaction fees. At present, the arbitrage on Ethereum has been standardized. First, the interests of the miners are the first priority. At present, 90% of the miners on Ethereum support the scheme of flash bots, which is equivalent to establishing a channel between the arbitrageurs and the miners, reducing the arbitrage competition on Ethereum. Of course, only flash bots can be used to implement arbitrage on Ethereum. Currently, there are other chains such as BSC and POLYGON, which do not have such standardized methods. Arbitrage can be achieved through rolling GAS fees.

en_USEnglish
Scroll to Top