Maximal Extractable Value (MEV) is the potential profit that miners or validators can scoop up adding blocks to a blockchain. They can maximize the money they make from block creation by reordering transactions within blocks and even insert new ones. As someone has to pay for their profit, one can view MEV as a tax on users. The Ethereum community is working hard on a new and more fair system of MEV.
MEV is the basis of a small industry. Currently, around 100,000 dollars per day are squeezed from blockchain transactions by MEV bots. (see MEV-Explore). To date, over $650 million dollars of MEV has been captured. MEV is associated with Ethereum, as the MEV industry is the biggest on that blockchain.
The Dark Forest Called the Ethereum Mempool
Do terms like ‘tax’ and ‘re-ordering transactions’ sound a bit boring? Make no mistake. Read the blog post Ethereum is a dark forest, the ‘horror story’ of a crypto enthusiast trying to rescue funds from a smart contract, hoping to escape ‘monsters of the mempool’. The story of 2020 helped popularize some key concepts of MEV.
After reading the story, you will appreciate how unforgiving the Ethereum mempool (transaction queue) is: ‘it’s like ‘a dark forest, an environment in which detection means certain death at the hands of advanced predators.’
These dark forest predators are pieces of software constructed by traders. They try to front-run profitable transactions or outright snatch funds that are lying around undetected on dexes like Uniswap. The author relates how he stumbled upon some orphaned tokens, worth 12,000 dollars at the time of writing.
Retrieving the tokens appeared simple at first glance: calling a so-called burn function and ordering the tokens to be sent to his address. The only problem: mempool predators called ‘generalized frontrunners’ are constantly on the lookout for any transaction that they could profitably front-run by replacing the addresses with their own, and have it included before the original transaction. That’s how ‘detection means certain death’. Read the blog post to find out if the writer succeeded in out-smarting the predators.
The Origins of MEV
The most basic and innocuous form of MEV has always been standard practice in the Bitcoin network (it was called Miner Extractable Value then). Miners can choose which transactions from the mempool (queue of transactions) they include in a block. Some transactions come with higher transaction fees than others, so the choice of which ones to include is fairly obvious.
Then came Ethereum. As it is a smart contract platform, it offers more opportunities for MEV: it processes a lot of trading orders. In other words, a lot of conditional trading orders that can be frontrun. As DeFi started maturing in 2020, MEV started becoming an industry.
How does MEV work?
How does the principle of MEV work? How do Ethereum validators benefit from the fact that they can determine the order of transactions? Well, it is a form of insider trading. This would be illegal in traditional finance. Let’s say you’re a stockbroker and a client wants you to buy a hundred thousand shares of a company on his behalf. Knowing that this large volume will drive up the price, you sneak in an order for yourself before placing your client’s order. After the subsequent price jump, you sell again. That’s not legal, of course!
The MEV version of this trade IS legal because of the way the mempool works. It is called a sandwich attack: a so-called searcher (a bot) detects a large pending trade on a dex and places its own trade right before and after. The above-mentioned generalized frontrunner looks in the mempool for any transaction that they could profitably front-run by copying it and replacing addresses with their own. They use higher gas fees than the original transaction, thereby ensuring their transaction is included first.
Another example of MEV trades come with liquidation opportunities. Whenever users on dexes are getting close to being liquidated, other users are allowed to compete to liquidate (sell) the collateral and earn a fee. Searcher bots will hunt and compete for those opportunities too.
What are the Disadvantages of MEV?
To be fair, in some cases, MEV creates fair markets and thus helps all participants. For example, there are bots arbitraging price differences across dexes. This creates a level playing field that saves normal users time looking up prices between different exchanges.
But with the advent of MEV as an industry, the disadvantages became apparent:
- From the perspective of normal users, MEV happens behind-the-scenes. It’s a dark forest, remember? Normal users don’t have the in-depth knowledge to understand that adversarial games are played. They pay the (gas) price.
- The (Ethereum) blockchain gets clogged with MEV transactions that are in some cases parasitical.
- A very fundamental point is that there are centralizing threats to the future of Ethereum because of MEV: a few companies specialize in MEV (see below) and call the shots. Also, censorship looms large and off-chain deals between traders and block producers are possible.
What is MEV-Boost and is it a Solution?
From various angles, developers have tried to tackle the problems with MEV. Proposer builder separation (PBS) is in the works. It will require a fundamental design change of the Ethereum consensus mechanism. It isolates the building of blocks from transaction validation. Why? For one, the building of blocks is prone to centralization, whereas validating should be as decentralized as possible. Otherwise, what’s the point of having a blockchain? In the PBS architecture, the proposer (validator) can’t see the transactions in a candidate block (more on that below).
What is MEV-Boost? It is like a proof-of-concept of the proposer builder separation. Because we might have to wait a few years for the implementation of PBS. Until that time the Ethereum community has come up with its own solution.
An Iteration of Flashbots
To understand what MEV-Boost is, it’s important to know that it’s an iteration of Flashbots. Flashbots is a company that wants to democratize MEV opportunities, in their own words to create a ‘fair ecosystem for efficient MEV extraction’. Flashbots let (then) miners outsource the work of building the most profitable block to parties called searchers (traders/trading bots) and relayers.
Instead of passing through the public mempool, searcher transactions go to a relayer, where they are not visible to anyone. The relayer validates the transaction bundles and sends them to the validator, who can pick a block. The validator can’t see the transactions; it only sees how profitable different blocks are.
This supposedly is all good for transaction privacy. DeFi users no longer find themselves in a dark forest where others can see but they can’t.
Also, MEV-Boost democratizes access to MEV opportunities. Now, any validator, including solo stakers, has access to MEV opportunities. This is a force against a power grab of big staking pools enriching themselves and growing fatter from more and more MEV income.
Still, there are some problems…
Censorship Issues with MEV-Boost
The architecture of MEV-Boost depends for a critical part on the relayers. In terms of centralization, it’s an achilles heel. Currently (October 2022) there are only seven relayers. A majority of relayers have chosen to comply with OFAC sanctions by the American government (see figure below). Meaning they won’t propose blocks that contain transactions that go against sanctioned addresses.
It’s up to the validators to choose a relayer. Why do they in majority choose the relayers who won’t include ‘naughty’ transactions? After all, the non-compliant transactions are potentially (but not necessarily) more profitable. Maybe it’s because many big validators are large exchanges. They probably want to stay on the safe side.
This all doesn’t mean that non-compliant transactions won’t get through – after all, there are still proposers that want to include them. These transactions might have to wait a bit longer in the mempool, though.
Percentage of OFAC Compliant Ethereum block, October 2022 (source: MEVwatch.info)
The world of MEV is morphing from a dark forest into a potentially ‘clean’ space, sanitized by regulators. The Ethereum community has their work cut out for them to find a workable middle ground…
Erik started as a freelance writer around the time Satoshi was brewing on the whitepaper.
As a crypto investor, he is class of 2020. More of a holder than a trader, but never shy to experiment with new protocols.