Maximal Extractable Value; The Bittersweet Attribute of Stateful Blockchains

“Flashbots is a research and development organization formed to mitigate the negative externalities posed by Maximal Extractable Value (MEV) to stateful blockchains, starting with Ethereum.”

Why flashbots? one would wonder. Why does an entire research facility exist to minimize (not eliminate, because that would be impossible) the “harmful” effects of MEV manipulations posed by external actors on the Ethereum blockchain? Before we answer that, let us understand what MEV itself entails. 

What is MEV?

Maximal Extractable Value (MEV) is a term predominantly used by blockchain researchers – on Ethereum, especially – to describe the maximum amount of gas fees validators collect per block produced. It broadly involves all the activities that raise the value accrued to validators. Since externally-owned addresses on a blockchain consistently outbid themselves when submitting transactions to the network, validators are incentivized to prioritize the approval of higher-paying transactions, creating room for numerous opportunities on the network. Most blockchains are “state chains,” meaning that though they repeatedly change when more and more transactions are added, they arrange and remember these transactions in the order in which they are added. Therefore, in theory, MEV opportunities exist across all of them to exploit the sequence of these arrangements. In practice, however, only Ethereum has enough network activity to make such endeavors profitable.

Maximal extractable value was first applied in the context of proof-of-work and initially referred to as “miner extractable value.” That is because miners control transaction inclusion, exclusion, and order in proof-of-work. However, validators have been responsible for these roles since the transition to proof-of-stake via The Merge, and mining is no longer part of the Ethereum protocol. The value extraction methods still exist, though, so the term rebrands. 

In theory, MEV accrues entirely to validators because they are the only party that can guarantee the execution of a profitable MEV opportunity. In practice, however, a large portion of MEV is extracted by independent network participants referred to as “searchers” or MEV opportunists. These searchers run complex automated algorithms on mempool data to detect profitable MEVs and have bots submit those profitable transactions to the network automatically. A mempool is an organized queue where transactions are stored and sorted before being added to a newly created block. The memory pool holds “fresh” or unconfirmed transactions (stored as individual transactions). Searchers find exploitable opportunities within these pending transactions, then “bribe” validators to rearrange transactions in a way that favors them.

MEV Examples

MEV emerges on the blockchain in a few ways.

DEX Arbitrage

Decentralized exchange (DEX) arbitrage is the most straightforward and well-known MEV opportunity. As a result, it is also the most competitive and is usually operated by infinitely flexible bots that can aggregate price data from multiple DEXs and find imbalances between them.

It works this way: if two DEXs offer a token at two different prices, someone can make “free money” by buying the token on the lower-priced DEX and selling it on the higher-priced DEX in a single, bundled transaction. Thanks to blockchain mechanics, this is true, riskless arbitrage.

Liquidations

Lending protocols like Maker and Aave require users to deposit some collateral (e.g., ETH) in order to take loans. This deposited collateral is then used to then lend out to other users.

Users can then borrow assets and tokens from others depending on what they need (e.g., you might borrow MKR if you want to vote in a MakerDAO governance proposal) up to a certain percentage of their deposited collateral. For example, if the possible borrowing amount is capped at a maximum of 70% (usually described as a 70% loan-to-value ratio), a user who deposits 100 USDT into the protocol can borrow up to 70 USDT worth of another asset at the time of deposit.

As the value of a borrower’s collateral fluctuates, so does their borrowing power. If due to market fluctuations, the value of borrowed assets exceeds, say, 70% of the value of their collateral in this case, the protocol typically allows anyone to liquidate the collateral, instantly paying off the lenders (this is similar to how margin calls work in traditional finance). If liquidated, the borrower usually has to pay a hefty liquidation fee, some of which goes to the liquidator — that is where the MEV opportunity comes in.

MEV searchers compete to parse blockchain data as fast as possible to determine which borrowers can be liquidated and be the first to submit a liquidation transaction and collect the liquidation fee for themselves.

Sandwich Trading

Sandwich trading is another common method of MEV extraction and is widely considered one of the most exploitative. The strategy is simple. Find a significant transaction on the mempool, buy before they buy (or sell before they sell), and then execute the reverse transaction immediately after.

To sandwich, a searcher will watch the mempool for large DEX trades. For instance, suppose someone wants to buy 10,000 UNI with DAI on Uniswap. Given how Uniswap, an automated market maker, works, a trade of this magnitude will have a meaningful effect on the UNI/DAI pair, potentially significantly raising the price of UNI relative to DAI. 

A searcher can calculate the approximate price effect of this large trade on the UNI/DAI pair and execute an optimal buy order immediately before the large trade, buying UNI cheaply. He then executes a sell order immediately after the large trade, selling it for the higher price caused by the large order.

Sandwiching, however, is riskier as it isn’t atomic (unlike DEX arbitrage) and is prone to a salmonella attack. 

NFT MEV

MEV in the NFT space is an emergent phenomenon and isn’t necessarily profitable.

However, since NFT transactions happen on the identical blockchain shared by all other Ethereum transactions, searchers can also use similar techniques as those used in traditional MEV opportunities in the NFT market.

For example, if there’s a popular NFT drop and a searcher wants a certain NFT or set of NFTs, they can program a transaction such that they are the first in line to buy the NFT, or they can buy the entire set of NFTs in a single transaction. Or if an NFT is mistakenly listed at a low price, a searcher can front-run other purchasers and snap it up cheaply.

One prominent example of NFT MEV occurred when a searcher spent $7 million to buy every single Cryptopunk at the price floor. A blockchain researcher explained on Twitter how the buyer worked with an MEV provider to keep their purchase secret.

Why Flashbots?

Flashbots is an independent project which extends execution clients with a service that allows searchers to submit MEV transactions to validators without revealing them to the public mempool. That prevents transactions from being front-run by generalized frontrunners. But it does not end here. Given that validators (block producers) can collude with trading firms to consistently front-run other network participants, the risks of MEV extraction returns being super linear can result in significant economies of scale in block construction. That also creates incentives for centralization. Therefore, Flashbots also have to innovate to negate the possibility of this occurring. However, MEV does not entirely have negative effects, so let’s look at both sides.

Effects of MEV

The Good

Many DeFi projects rely on economically rational actors to ensure the usefulness and stability of their protocols. For instance, DEX arbitrage ensures that users get the best, most correct token prices. Lending protocols rely on speedy liquidations when borrowers fall below collateralization ratios to ensure lenders get paid back.

Without rational searchers seeking and fixing economic inefficiencies and taking advantage of protocols’ economic incentives, DeFi protocols, and dApps may not be as robust as they are today.

The Bad

At the application layer, some forms of MEV, like sandwich trading, result in an unequivocally worse experience for users. Users who are sandwiched face increased slippage and worse execution on their trades.

At the network layer, generalized frontrunners and the gas-price auctions they often engage in (when two or more frontrunners compete for their transaction to be included in the next block by progressively raising their own transactions’ gas price) result in network congestion and high gas prices for everyone else trying to run regular transactions.

Beyond what’s happening within blocks, MEV can have deleterious effects between blocks. If the MEV available in a block significantly exceeds the standard block reward, validators may be incentivized to reorg blocks and capture the MEV for themselves, causing blockchain re-organization and consensus instability.

This possibility of blockchain re-organization has been previously explored on the Bitcoin blockchain. As Bitcoin’s block reward halves and transaction fees make up a more significant portion of the block reward, situations arise where it becomes economically rational for miners to give up the next block’s reward and instead re-mine past blocks with higher fees. With the growth of MEV, the same sort of situation could occur in Ethereum, threatening the integrity of the blockchain.

Going Forward

Decentralized exchanges, rather interestingly, leak value to validators through three kinds of MEV; gas costs, slippage/sandwiching, and loss vs. rebalancing, which negatively impact their users. These exchanges can work hand in hand with flashbots by investing in proper research and development endeavors to mitigate any or all of these leaks, therefore preserving more value for swappers and liquidity providers.

Interested in marketing your blockchain/Web3 project? Please contact Off-Chain Communications for a free consultation and quote.

If you enjoyed this article, you may also enjoy…

Blockchain Tech Revolutionizing Africa

Another Day, Another Stablecoin Saga

PawnFi, The Poster Child for NFT Financialization

Check out the home page of Exploring Digital Assets for additional insights, reports and news!

2 thoughts on “Maximal Extractable Value; The Bittersweet Attribute of Stateful Blockchains

Leave a Reply