Detailed Explanation of MEV: How Does It Work? How Dark Is It?

DaolecticResearch
2022-06-08 17:40:25
Collection
Since January 1, 2020, profits generated by MEV are estimated to be $635 million.

Author: Daolectic Research

Original Title: 《MEV: how dark is the forest?

Compiled by: Linqi, Chain Catcher

Abstract:

  • Maximum Extractable Value (MEV) is the profit miners gain by ordering transactions within a block.
  • The smart contract system of DeFi leverages inefficiencies to provide multiple sources of income.
  • Arbitrage is the most common way to profit on-chain.
  • For miners, Flashbots reduce negative externalities while generating more revenue.

MEV

MEV stands for Miner or Maximum Extractable Value.

Miners (or validators, sequencers) can earn a certain profit by arbitrarily packaging, excluding, or reordering transactions in the blocks they produce, and MEV is a measure of that profit. Miners must be able to prioritize transactions to prevent unauthorized blockchains from being subjected to spam and DoS attacks.

The mempool is fundamental to understanding miner activity.

Mempool

The mempool is an electronic file that includes unconfirmed transactions. The number of unconfirmed transactions contained in each block is limited. Miners have complete autonomy in choosing which unconfirmed transactions will be packaged into blocks. Once a transaction is selected for packaging, it is stored in a new block and broadcasted.

image

Miners typically prioritize packaging transactions with higher fees to maximize profits.

This drives them to seek other avenues that can yield more profit.

However, miners are not the only ones doing this: bots scan the mempool, placing packaged transactions before or after user transactions to extract value.

Imagine someone buying a token before you, and then selling the same token to you at a higher price!

To mitigate the impact of processing transactions on the main chain, an MEV research group created Flashbots.

Flashbots

Typically, miners bid for MEV through the Ethereum public mempool.

Through Flashbots, the research team created an open communication channel that allows auctions and MEV bidding to occur in a private mempool.

image

Searchers are key participants in this process: they can exploit information asymmetries in the DeFi market. Due to fierce competition among searchers, miners may only choose transaction bundles that pay the highest fees. Searchers pay miners high transaction fees to execute bundles.

At this point, searchers:

  1. Bid directly to miners analyzing offers to purchase block space.
  2. Minimize gas fees to maximize MEV returns.
  3. Bid higher for block space without reducing MEV outcomes.

For miners, the diversification of incentives like MEV is crucial. If a single miner has a recurring advantage in obtaining rewards, they may become the primary block producer, creating disadvantages.

If MEV is not democratized, it may lead to the continuous centralization of benefit distribution and accumulation.

Flashbots Auction democratizes MEV by providing profit-taking features for searchers and miners. Some miners attempt to execute their transactions after tracking searcher activities, and a code of conduct has been established to protect searchers from miner influence.

On-Chain Opportunities

PwC detailed the adoption of on-chain trading methods like arbitrage in its report on crypto hedge funds (Crypto Hedge Funding).

image

Moreover, retail investors are becoming more aware of on-chain profit opportunities.

image

Arbitrage and liquidation are techniques that can be linked to MEV through on-chain inefficiencies and discrepancies.

Arbitrage

Investors use the arbitrage method:

  • Buy a currency on one exchange
  • Quickly sell it at a higher price on another platform

Cross-platform arbitrage techniques may use synchronous or delayed trading. When using synchronous trading, users must have balances on all exchanges to trade. This method minimizes price risk while maintaining risk exposure.

How to find arbitrage opportunities in DEX?

  • Look for large orders with volatile prices in the mempool.
  • Determine the scale of arbitrage that can generate the highest profit and get ahead of competitors.

In the following example, a user exchanged USDC for HEX on UniSwap v2, then exchanged HEX back to USDC on UniSwap v3. Ultimately, the user profited nearly $8,000 from the price difference.

image

Liquidation

Liquidation occurs when traders cannot meet the leverage position requirements and lack sufficient funds to maintain the trade.

Most lending protocols involve over-collateralization. The user's collateral must be worth more than the value of their loan. When the value of the collateral falls below a certain level, users may repay their debt and redeem the depreciated collateral.

Exchanges will close leveraged positions due to partial or total losses incurred by users. Oracles play a crucial role as they provide the latest prices to exchanges.

Here is a typical liquidation case: a bot repaid 135k USDC to AAVE v2 in exchange for 11k LINK. The bot then sold these LINK for 159 ETH, ultimately gaining 12 ETH.

image

MEV Profit Situation

The DeFi market on Ethereum is plagued by arbitrage, liquidation, and high-frequency trading. As DeFi trading volume increases, the value extracted from such trades becomes larger.

Flashbots estimates that since January 1, 2020, profits generated by MEV have reached approximately $635 million.

image

Liquidation opportunities arise during price drops or short squeezes. From their insights, arbitrage is the primary method being utilized. Arbitrage opportunities are always present, while liquidation opportunities generally occur during price declines or squeezes.

image

On the other hand, MEV profits are divided between searchers and miners, with the former accounting for 64% ($405 million) and the latter 36% ($230 million).

image

What impact does Ethereum's merge have on MEV?

Ethereum will transition to Proof of Stake (PoS), eliminating the need for miners.

At that time, validators, searchers, and bots will capture MEV. To reduce the likelihood of future block reorganization, the PoS update includes proposer boosting functionality.

Layer 2 rollups are an evolving network scalability method: they batch transactions and only send proof results to the Ethereum public mempool.

This reduces transaction weight, allowing more transactions to be included in a single block, and may obscure opportunities for searchers and miners to obtain MEV.

On-Chain Malicious Activities

Examples of malicious activities targeting users include front-running and sandwich attacks.

image

When using DEX, users are unaware of the timing and pricing of transaction executions. The total order amount is already determined before its price impact.

This time lag allows bots/traders to place buy and sell orders before and after the pre-announced buy order.

As a result, the malicious trader's sell order is executed at a price higher than their buy order, generating profit.

Some large validators prefer to use front-running as they can leverage the next block and better handle their transactions.

Once a user initiates a transaction in the public mempool, bots scan it for potential attack methods.

If the user transaction is attractive:

  • The bot will replicate the same execution logic.
  • If the transaction is profitable, the bot will place its transaction ahead for processing and transfer funds to its address.

One of the co-founders of Flashbots, Scott Bigelow, created an interpretive video on front-running that can help with better understanding.

In a sandwich attack, the bot:

  • Executes a transaction in the primary swap direction.
  • Waits for it to complete.
  • Executes a reverse transaction.

In this case, the user faces significant slippage, especially if the underlying parameters are misconfigured.

Conclusion

All the major data shared comes from the vast database created by the Flashbots team. If you want to learn more about MEV-explorer, it is recommended to check Robert Miller’s tweets.

The debate over the pros and cons of MEV has been widely discussed: sandwich attacks generate profits at the high cost of traders, while arbitrage enhances market efficiency and liquidity. However, miners' rights to organize transactions help prevent spam.

The Flashbots team developed the first tool to optimize MEV. This can help users prevent transaction spam while reducing fees. It is capable of off-chain bidding for most searchers to alleviate congestion in the Ethereum mempool and has established a centralized MEV gatekeeper.

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators