What is MEV and how to maximize transaction benefits?
Tokenview
2022-12-10 06:11
本文约4002字,阅读全文需要约16分钟
This article mainly focuses on the concept of MEV, its form of existence, and its impact on Ethereum to understand what MEV is.

Original compilation: Tokenview

Maximal extractable value (MEV) is the maximum value a validator can extract in block production that exceeds standard block rewards and gas fees by adding, removing, and changing the order of transactions in a block. Since MEV involves a wide range of knowledge and content, we will create a series of MEV articles to introduce MEV at different levels. This article mainly focuses on the concept of MEV, its form of existence, and its impact on Ethereum to understand what is the maximum extractable value.

Miners can extract value

Before understanding the maximum extractable value, it is necessary for us to understand the concept of miner extractable value. The concept of Miner Extractable Value (MEV: Miner Extractable Value) was first introduced by Phil Daian in "Flash Boys 2.0", and it has become a basic concept of cryptoeconomics. Miner-extractable value was first applied in the context of Proof-of-Work as a measure of the profit a miner can make by arbitrarily adding, excluding, or reordering transactions within the blocks it produces. MEV is not limited to miners in proof-of-work (PoW) based blockchains, but also applies to validators in proof-of-stake (PoS) networks. After Ethereum transitioned to proof-of-stake through mergers, the role of miners was taken over by validators. In order to continue using the expression [MEV], in the context of proof-of-stake, the term "Maximum extractable value" (MEV: Maximal extractable value) is used instead.

MEV extraction

In theory, MEV is earned entirely by validators, since they are the only party guaranteed the chance to execute profitable MEV. In reality, however, the majority of MEV is extracted by independent network actors known as "searchers". Searchers run complex algorithms on blockchain data to discover profitable MEV opportunities and have bots automatically submit these profitable transactions to the network.

Validators do earn a portion of the full MEV because searchers are willing to pay high gas fees (to validators) in exchange for a greater probability of including their profitable transactions in a block. Assuming the searcher is economically sound, the gas fee the searcher is willing to pay will be an amount equal to 100% of the searcher's MEV (since the searcher will lose money if the gas fee is higher).

In this case, for some highly competitive MEV opportunities, such as DEX arbitrage, the searcher may have to pay gas fees of 90% or more of the total MEV revenue to validators, because many people want to conduct the same arbitrage transaction. This is because, the only way to ensure that an arbitrage transaction works is to submit the transaction with the highest gas fee.

Generalized frontrunners

Instead of writing complex algorithms to detect profitable MEV opportunities, some searchers have taken the approach of generalized frontrunners. generalized frontrunners are bots that monitor the mempool to detect profitable trades. The frontrunners will copy the code of potentially profitable trades, replacing the addresses with the frontrunners' addresses. The transaction is then executed locally, double-checking that the modified transaction brings a profit to the frontrunners address. If the transaction does turn out to be profitable, the frontrunners will submit a modified transaction with an alternate address and a higher gas price, "leading" the original transaction and earning the original searcher's MEV.

Flashbots

Flashbots is an independent project that extends the execution client with a service that allows searchers to submit MEV transactions to validators without revealing them to the public mempool. This prevents transactions from being led by generalized frontrunners. As of this writing, a significant portion of MEV transactions are via Flashbots, which means that generalized frontrunners are not as effective as they used to be.

Several forms of MEV

MEV usually appears on the blockchain in the following ways.

DEX arbitrage

Decentralized exchange (DEX) arbitrage is the simplest and most well-known MEV opportunity. Therefore, it is also the most competitive. It works like this: if two DEXs offer a token at two different prices, someone can buy the token on the lower priced DEX and then sell it on the higher priced DEX in a trade. Thanks to the mechanism of the blockchain, this is truly risk-free arbitrage. What follows is an example of a profitable arbitrage trade in which a searcher turns 1,000 ETH into 1,045 ETH, taking advantage of the different prices of the ETH/DAI pair on Uniswap and Sushiswap.

to liquidate

Liquidations of lending agreements present another well-known MEV opportunity.

Lending protocols like Maker and Aave require users to deposit some collateral (e.g. ETH). These deposited collaterals are then used to lend out to other users. Users can then borrow different assets and tokens from others as they wish (for example, if they want to vote on the MakerDAO governance scheme, they can borrow MKR, if they want to earn a portion of transaction fees on Sushis Swap, they can Borrow SUSHI), up to a certain percentage of its deposited collateral (the agreement determines the precise borrowing power percentage). For example, if the borrow amount is capped at 30%, then a user who deposits 100 DAI in the protocol can borrow another asset up to a value of 30 DAI.

As the value of a borrower's collateral fluctuates, so does their ability to borrow. If due to market fluctuations, the value of the borrowed asset exceeds 30% of the collateral value (again, the exact percentage is determined by the protocol), the protocol usually allows anyone to liquidate the collateral and immediately repay the lender (this is different from traditional finance. in a similar manner). In the event of liquidation, the borrower typically has to pay a large liquidation fee, some of which goes to the liquidator - and this is where the MEV opportunity arises.

Searchers race to parse the blockchain data the fastest to determine which borrowers can be liquidated, and to be the first to submit a liquidation transaction and collect their own liquidation fees.

sandwich deal

Sandwich trading is another common method of MEV extraction.

To implement sandwich transactions, the searcher monitors the mempool of large DEX transactions. For example, someone wants to buy 10,000 UNI using DAI on Uniswap. Such large transactions can have a significant impact on the UNI/DAI pair, potentially significantly increasing the price of UNI relative to DAI.

The searcher can calculate the approximate price impact of the large-value transaction on the UNI/DAI pair, and execute the optimal buy order immediately before the large-value transaction, buy UNI at a low price, and then execute the sell order immediately after the large-value transaction, resulting in a large-value transaction sell at a higher price. However, sandwich trading is risky as it is not atomic (unlike DEX arbitrage as described above) and is vulnerable to salmonella attacks.

NFT MEV

MEV in the NFT space is an emerging phenomenon and not necessarily profitable.

However, since NFT transactions occur on the same blockchain that all other Ethereum transactions share, searchers can also use similar techniques to traditional MEV opportunities in the NFT marketplace. For example, if there is a popular NFT drop and a searcher wants a certain NFT or group of NFTs, they can program a transaction to be the first in line to buy the NFT, or they can buy it in one transaction The entire NFT portfolio. Or, if an NFT is mistakenly listed at a low price, searchers can snap it up before other buyers.

A notable example of NFT MEV happened when a searcher bought every Cryptopunk at floor price for $7 million. A blockchain researcher explained on Twitter how buyers are working with MEV suppliers to keep their purchases a secret.

What is the impact of MEV

MEV is not all bad, Ethereum's MEV has both positive and negative effects.

advantage

shortcoming

shortcoming

On the application side, some forms of MEV, such as sandwich transactions, lead to a significantly worse user experience. At the network layer, frontrunners and the gas auctions they often participate in (when two or more frontrunners incrementally increase the gas fee for their transactions so that their transactions get included in the next block), lead to network congestion and attempts to High gas prices for others running normal transactions.

In addition to what happens within a block, MEV may also have detrimental effects between blocks. If the MEV available in a block greatly exceeds the standard block reward, validators may be incentivized to reorganize blocks and capture MEV for themselves, leading to blockchain reorganization and consensus instability.

This possibility of blockchain reorganization has been explored on previous Bitcoin blockchains. As Bitcoin's block reward is halved, transaction fees account for an increasing proportion of the block reward, and a situation arises where miners forego the reward for the next block and re-mine past blocks with higher fees. block, which is economically sound. As MEV develops, the same could happen with Ethereum, threatening the integrity of the blockchain.

MEV status

In early 2021, MEV mining surged, leading to extremely high gas prices in the first few months of the year. The emergence of Flashbots' MEV relay reduces the efficiency of generalized frontrunners and takes the gas fee price auction out of the chain, reducing the gas fee for ordinary users.

While many searchers are still earning good profits from MEV, as opportunities become more famous and more searchers compete for the same opportunities, validators will capture more and more of the total MEV revenue (because of the above The kind of gas auction originally described also happens in Flashbots, albeit privately, and the resulting gas fees are captured by validators). MEV is not unique to Ethereum either, as opportunities on Ethereum become more competitive, searchers are moving to other blockchains such as BSC, where similar MEV opportunities exist as on Ethereum, but competitive less.

On the other hand, the shift from proof-of-work to proof-of-stake, and the ongoing effort to scale Ethereum using rollups and sharding, has changed the MEV landscape in ways that remain unclear. Compared to the probabilistic model in Proof-of-Work, knowing slightly in advance how guaranteed block proposers change the dynamics of MEV extraction, or when single secret leader election and distributed validator techniques are implemented, this will How it was destroyed is unclear. Likewise, it remains to be seen whether MEV opportunities exist as most user activity migrates from Ethereum to Layer 2 rollups and sharding.

Tokenview
作者文库