Maximal Extractable Value (MEV)

From CryptoWiki

Revision as of 08:56, 23 January 2022 by 5imp5on (talk | contribs) (1 revision imported)

Basics

"In a nutshell, the Ethereum blockchain is written by consensus, but the content of each block is chosen by just one miner. Miners can profit from users by front-running, back-running, sandwiching and generally exploiting transactions in their block however they choose. The Flash Boys 2.0 paper, written by researchers at Cornell Tech, coined the term MEV to describe such exploits."

  • From CoinDesk (5-3-2021):

"A new revenue replacement is quickly becoming available for mining networks. Called miner extracted value (MEV), miners can take advantage of their place as arbiters in how blocks are packaged to “front-run” profitable trades. MEV is currently popular among decentralized finance (DeFi) traders who bid up gas prices to secure their place in the block. Many Ethereum mining pools are currently implementing MEV software to gather this untapped source of revenue."

"MEV stands for Miner Extractable Value. It is completely derived from the logical combination of what you get when you combine Miners and Frontrunners together.

Frontrunners scan the Mempool in order find transactions attempting to score arbitrage on Ethereum. Then, they pay miners a little bit more for the same transaction to pocket the arbitrage themselves.

But what happens when two or many frontrunners discover a transaction that has arbitrage value? In these cases, frontrunners keep bidding higher and higher gas fees in order to claim the transaction for themselves. A rational frontrunner will bid a gas fee amount that is up to the value of the arbitrage itself, because any rational frontrunner will pay $9,999 in gas for $10,000 in rewards, pocketing themselves a risk-free $1.

When many Front-runners try and claim a transaction, ultimately the miners win. They’re the ones that get to pocket the value of the arbitrage.

This is what we call Miner Extractable Value.

This value comes out of the power that the ordering of Mempool transactions enables. Whoever orders transactions get to direct the value of all arbitrage opportunities in the Ethereum mempool. Naturally, those with the privilege of transaction sequencing are incentivized to direct this value to themselves.

Also, there’s nothing stopping miners from also being frontrunners. In fact, it’s rational to assume that miners, as the party with the power to order Ethereum transactions, also start acting as frontrunners. Miners who don’t start frontrunning transactions will ultimately lose profitability against the miners that do front-run them.

The part of the Ethereum community paying attention to MEV generally assumes that all miners will eventually begin to operate as frontrunners in the future (Watch the Dan Robinson State of the Nation video for more info)."

History

"Pmcgoohan (a pseudonym) discovered the MEV issue in Ethereum pre-genesis in 2014."

Misleading title

"The name MEV (miner extractable value) is misleading in that sense since it implies miners need to actively do something. But the answer is that no further action is necessary. The financial arbitrage opportunities that result from Defi and tokens on top of Ethereum lead to priority gas auctions in the public mempool and the fees from these gas auctions accrue to all miners equally.

To give you a concrete example, here is a recent block that paid 112 ETH in rewards. 2 ETH from the subsidy, the rest from fees. On further inspection, we can see that over 70 ETH of that actually comes from only seven transactions, at index 1, 2, 5, 6, 7, 10, and 12 respectively. These transactions are primarily Compound liquidations."

Optimism & MEVA

"Importantly, the Optimism system enables the capture and repurposing of MEV. In the Optimism L2 system, the roles that miners have (to order transactions and validate blocks) is divided into two separate actors: Sequencers order transactions and Validators add them to the Optimism L2 blockchain.

The right to become a sequencer is then auctioned off to the free market. This is called MEVA, or MEV Auctions, where the right to be able to capture MEV is repeatedly auctioned off for baskets of time.

Note: The specific designs around how a MEV Auction works in practice is still under construction, but the general idea is that there are different ways to extract and focus MEV with a free-market auction mechanism. As Optimism gets rolled out to more and more DeFi apps, the data will come in about how to best construct a MEVA.

Just as frontrunners attempted to outbid each other’s transactions to capture MEV, those who wish to capture MEVA are forced to bid for the right to sequence transactions, and ultimately hands this value off to the auctioneer. That auctioneer is Optimism, and the Optimism team intends to enable the redirecting of this captured value to parties that were never going to be able to access it in the first place, but arguably should have: The developers who built the contracts in the first place!

If there’s a group of average retail market participants who are using a Public Good like Uniswap, then there is therefore MEV. If there is MEV, there are bids to sequence the transaction. If there are bids to sequence the transactions, then there are MEVAs where the value is converged.

But this entire chain of economic activity is a result of some developer that built the contracts being transacted on in the first place… and nowhere in this economic chain is the developer being compensated or rewarded for their work. Optimism and MEVA fixes this, offering a potential business model for smart-contract developers."

Flashbots

  • Flashbots is a research and development organization focused on mitigating the negative externalities of current MEV extraction techniques and avoiding the existential risks MEV could cause to state-rich blockchains like Ethereum.
  • From Our Network (21-3-2021):

"Flashbots is an R&D organization working on mitigating the negative externalities of Ethereum MEV. Today 5 mining pools are running its MEV-geth software, which in total account for >12% of the Ethereum hashrate. Miners running MEV-geth have seen an average increase in income of 0.13 ETH per block so far in March, which is also a ~3x increase MoM. In total, miners collected 174 ETH in Flashbots fees in February, up by more than 6x the amount collected in January."

"Like dangling food in front of starving people, Stephane posits that the relatively low gas prices may be because arb bots that normally compete in Priority Gas Auctions (PGA) and clog the network for all Ethereum users are instead directing their arb transactions directly to miners, or the 60% using Flashbots Geth. By sending the transaction directly to the miner, the arb bot does not need to set a high gas fee with hopes of getting selected in the mempool. Of course, arb bots are still paying the miners for prioritizing their transactions, but this happening off-chain, so it doesn’t raise prices for everyone else using Ethereum."

  • From Our Network (1-5-2021):

"Since launching in January of this year, Flashbots’ MEV-geth client has seen rapid adoption. Today mining pools totaling more than 80% of Ethereum’s hashrate are running MEV-geth. To date, miners have earned $24m in ETH by including transactions sent via Flashbots. Over $22m of this income occurred in April alone. This is additional income (taking into account opportunity costs), with miners earning an additional 5% on average in revenue per block with Flashbots transactions."

"Before Flashbots, if searchers identified an on-chain opportunity, setting a high gas price was the only way to ensure the arbitrage transaction would go through. This led to high gas prices for everyone on the network.

Then came Flashbots, which inserted itself between searchers and miners. Miners run MEV-GETH, which is a fork of the common GETH client with a separate communication and payment network that connects miners to searchers. Instead of sending an MEV opportunity to the public mempool with a high gas price, searchers will send the transaction to Flashbots, which connects it to miners running MEV-GETH. For each MEV opportunity, searchers will attach a proportion of the MEV proceeds to be distributed to the miner and to the searcher.

The Flashbots design bypasses the public mempool, which is how most users’ transactions end up in Ethereum blocks. This relieved network congestion (and lowered gas prices) because the transactions with the highest gas fees were being rerouted through Flashbots. Miners and searchers both profit and the rest of Ethereum pays less gas. In short, a positive sum."

Mining Pools going for MEV

"By default, we’d expect most of the MEV to go to miners via arbitrageurs competitively bidding away all the profit. Nevertheless, several mining pools kickstarted attempts to speed up this transition, and capture even greater MEV profits. Ethermine (tied for largest Ethereum pool with Sparkpool) runs its own in-house frontrunning bots. ArcherDAO partnered with several smaller pools (2miners, Ezil, etc) to build and run in-house bots for them, splitting the profits 50/50. These MEV battles, while fascinating to watch, lead to wasted resources and potential consensus instability: consider Salmonella, a clever attack that stole ~120 ETH from Ethermine’s in-house front-running bot, or Ethermine’s revenge, that selectively used transactions from an orphaned block to exploit a Flashbots user."

Usage

"A recent study that aimed to quantify the so-called miner-extractable value (MEV) in Ethereum in the last 6 months shed some light on the scale of bot activity in Ethereum. The study found (figure 1) that bots extracted 0.34 ETH of MEV per block through arbitrage and liquidations. Moreover, the study found that 18.7% of MEV extracted by bots is paid to miners through gas fees which makes up 3.7% of all transaction fees. Undoubtedly, this implies that the scale of bot activity on Ethereum is becoming mainstream. To provide comprehensive front-running protection, bloXroute introduced a private transactions service, in collaboration with a group of mining pools."

"Total extracted MEV has grown significantly. In January 2021 a total extracted MEV of $57M (47.6k ETH) was recorded, a year over year increase of 316x in absolute dollar amounts (43x in ETH)."

Benign and malicious MEV

  1. "Malicious MEV is one that causes chain instability, censors users or key infrastructure (e.g. preventing oracle updates), or even directly steals user assets (e.g. censoring a rollup fraud-proof).
  2. Benign MEV is pretty much everything else, ranging from financial arbitrage between exchanges, liquidations, frontrunning, etc.

One important insight is that benign MEV can be extracted from non-mining parties, and this is happening today on a large scale. Only miners can extract malicious forms of MEV, and this is generally not happening today, and shouldn’t happen in the future. However, if miners started to extract the benign MEV that is currently extracted by non-miners, that would be largely positive for Ethereum. There are three arguments for that:

First, non-mining arbitrageurs are generally a tax on the system – they pull money out, without giving anything back. If miners stood to receive the same arbitrage profits, they would compete for them with higher hashpower, thereby making Ethereum more secure. So the MEV would directly pay for security, which it does only to a lesser degree today via the priority gas auctions. For users, it doesn’t make a difference: Someone will extract the benign MEV from them anyway. So naturally, they would prefer if the money goes to miners, where it also secures the system.

In response to this, one could argue that normalizing MEV extraction by miners instead of non-miners creates a slippery slope where miners don’t just extract benign MEV, but ultimately also malicious MEV. This would greatly hurt Ethereum, and we continue to need strong social norms against it.

The second argument why Ethereum benefits from miners extracting benign MEV is that MEV extraction by non-miners creates unnecessary waste on the Ethereum blockchain, which could be used for non-MEV use cases. Flashbots has found that at least 4-5% of all Ethereum blockspace is currently used by MEV transactions, including many failed transactions. As usual, Flashbots only establishes a lower bound – the real number is probably a fair bit higher.

The third argument is that the most sophisticated miners are already extracting MEV directly, either by including their own arbitrage transactions or by selling blockspace privately (not publicly) in return for private order flow.

This is not good for Ethereum because it turns Proof-of-work into Proof-of-MEVextraction – a much more complex game where some miners can have large benefits over others. The miners better at extracting MEV will grow at the expense of the miners who are worse at it, which presents a serious centralization vector in mining (and staking later on, so this problem doesn’t go away with the move to PoS either.)

The solution to this is indeed education and transparency into MEV, and to normalize the extraction of benign MEV by miners to level the playing field. EIP-1559 does accelerate that, but it’s a trend that needed to happen anyway."

(:

Knowledge empowers all and will help us get closer to the decentralized world we all want to live in!

Making these free wiki pages is fun but takes a lot of effort and time.

If you have enjoyed reading, tips are appreciated :) This will help us to keep expanding this archive of information.

ETH tip address: 0x83460bE5F218b1520B69D702cE60A1DE37dD8E31

Also check out CoinTr.ee for more content.