Maximal extractable value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding, and changing the order of transactions in a block on the Ethereum network. – Ethereum.org
MEV In Simple Terms
The Ethereum network is used to send and receive digital money, called Ether. When people want to send or receive Ether, they create transactions that need to be processed by the network. In order to process these transactions, someone needs to build a block that contains all of the transactions. This is called "block production."
MEV is the maximum amount of value that can be extracted from block production in excess of the standard block reward and gas fees. This means that, in addition to the money that the person building the block gets for their work, they can also potentially make more money by including, excluding, or rearranging the transactions in the block in a certain way.
For example, let's say that there are two transactions that both want to be included in the same block. One of the transactions is for a small amount of Ether, and the other is for a larger amount. The person building the block could choose to include the smaller transaction first, and then the larger one. This would allow them to potentially make more money, because they would get paid more for including the larger transaction in the block. This concept is important in understanding the ways that miners can manipulate transactions in order to maximize profits.
MEV In More Technical Terms
The ordering of transactions in an Ethereum block is not bound by definite rules, but can be freely modified according to miners' preferences. In the source code of the Geth client, there are three examples provided for sorting transactions: by nonce only, by gas fee and nonce (the default option), and by owner, then by gas fee and nonce. However, this sorting is not set in stone and miners are free to adjust it in order to capture bigger profits, which is the main focus of MEV.
Before August 2020, Compound's oracle feed was updated by a special oracle transaction. Miners would monitor the Mempool, looking for accounts that could be liquidated and arbitraged through flash loans and other strategies. Since the arbitrage could only be successful if the arbitrage transaction was executed right after the price update transaction, most miners at the time would randomly order the arbitrage transaction with the same gas fee. This led to a situation where arbitragers would compete with each other for a random probability by sending trades with the same gas fee as the oracle price update transaction.
However, on August 11, 2020, Geth released a new version which changed the rules of the game. Now, the first transaction to reach the network after the oracle price update transaction would be successfully arbitrated, meaning that the speed at which a transaction was obtained became a factor in the competition. This change did not last long, and on August 17, 2020, Compound switched to a more decentralized oracle service. The MEV race then became a pure gas war, with miners trying to outbid each other for gas until the clearing operation could no longer capture any profit, or until one miner won.
MEV bots are an important player in the dark forest of the blockchain, constantly searching for profitable opportunities and trying to capture MEV by sending transactions or deliberately sequencing them. They operate at the whim of their owners, packaging transactions and sending them to unsuspecting miners for block production. While they play a role in ensuring market stability and DApp activity, they can also exploit the "average user" unequally due to their inherent advantage of monitoring the entire Mempool.
Data from Uniswap and dex.guru show that a significant portion of AMM trading volume on Ethereum is contributed by MEV bots, which dominate the blockchain. The term MEV has two official interpretations: Miner Extractable Value and Maximum Extractable Value. When these two definitions are combined, MEV can be understood as the value that can be extracted by miners through the manipulation of transactions in a block.
According to Dan Robinson, a decentralized exchange researcher at Paradigm, there are three types of MEV that leak value: gas costs, slippage/sandwiching, and loss-vs-rebalancing. These value leaks can be optimized to reduce costs for users and liquidity providers. It is likely that future decentralized exchanges will try to mitigate these value leaks.