MEV: Capturing the “Necessary” Evil?
Eden Network recently got seed investment from major crypto VCs, bringing the MEV topic to the front stage again. MEV was first noticed in 2019, better researched in 2020, and sees more solutions in 2021. We would like to revisit the concept of MEV in the context of new blockchains and L2 solutions, and conduct a brief comparative analysis of different MEV solutions.
The origin of MEV
Blockchain architecture
We all know that blockchain is a distributed ledger, where each (full) node keeps a local copy of the ledger, bundles transactions into blocks, and broadcasts the new block to other nodes. After other nodes validate the new block, they update their local copy of the ledger according to the transactions included in the new block. This architecture ensures that all transactions are valid, and new blocks of transactions are continually produced.
A key component that’s missing is objectivity. Usually this is provided together with authority by a centralized entity. When you trade on a centralized exchange, the exchange’s server knows that your transaction comes earlier than mine, and it’s going to execute your transaction before mine. On a blockchain, however, there is no objective entity that records the order of transactions (since blockchain is trustless). Therefore, a node can arbitrarily order transactions within a block, and there isn’t actually a guarantee that transactions will be ordered in the exact manner they were submitted to the blockchain.
Ordering is everything
Miner Extractable Value (MEV) is a measure of the profit a miner (or validator, sequencer, etc.) can make through their ability to arbitrarily include, exclude, or re-order transactions within the blocks they produce.
MEV is a neutral word. In theory, it represents the total definitive profit generated by a blockchain system in a given time period. By “definitive”, we are talking about profits from price arbitrage and liquidation that aren’t subject to future asset price — a successful arbitrage between two exchanges can give you guaranteed profit regardless of the price fluctuations afterwards. The value is “miner-extractable” because theoretically miners can find a profitable unexecuted transaction — i.e., a rare arbitrage opportunity — that’s broadcasted to his node, choose to ignore this transaction, and do the arbitrage by himself.
In reality, there are countless MEV bots wandering in the Ethereum mempool (where nodes store unexecuted transactions) and try to extract the value, by paying a higher gas fee to the miner so that their transactions can be executed before the original ones.
A classical kind of “MEV exploit” is “sandwich attack”. Below is a perfect example where the victim is the famous “Alameda”:
First, one of the MEV bots found a huge AMM swap transaction (swap 34 ETH for UNN) submitted by Alameda. It knew that this would increase the price of UNN.
Then, the MEV bot submitted a similar swap transaction and managed to get it executed before Alameda’s, even though it’s submitted later. This is the first piece of bread in a sandwich.
Alameda’s transaction was then executed. Since the previous MEV transaction pushed UNN price higher, Alameda experienced a higher slippage, and got fewer UNN than expected. Alameda’s transaction is the tuna for the sandwich.
Finally, the MEV bot swapped the UNN back for ETH. Since UNN price was pushed even higher by Alameda’s transaction, the MEV bot got more ETH back. This is the second piece of bread in the sandwich. The MEV exploiter secured a 4.67 ETH net gain from this attack.
MEV bots normally pay higher gas fees in order to get their transactions executed. It’s worth noticing that in our example, the first transaction cost nearly zero gas fee, while the last transaction paid 4.6 ETH to the miner, which indicates that this sandwich attack was likely done by the miner himself.
MEV problems
MEV is a neutral concept, as arbitrage and liquidation are an organic and crucial part of the ecosystem. It’s only when MEV is extracted in a way which undermines the user experience and total surplus of the system that we consider it as a problem. For example, the sandwich attack which caused Alameda a higher slippage, or an MEV searcher front-running oracle price update to get unfair advantage over all other users.
Gas war and slippage
MEV searchers compete with each other with higher gas fees in order to get their transactions executed by the miner. This “gas war” results in soaring gas fees for ordinary users.
Higher slippage caused by front-running and sandwich attack, as we see in Alameda’s case.
Bad bots drive out the good
There are “good bots” living on Ethereum who arbitrage between exchanges so that prices reach equilibrium and liquidate default positions so that debt risk is resolved. Building those bots requires considerable effort. On the other hand, MEV bots can simply front-run the good bots and extract the profit. This may disturb the normal ecosystem and discourage good bots.
Chain re-organization
If the MEV available in a block significantly exceeds the standard block reward, miners may be incentivized to re-mine blocks and capture the MEV for themselves, causing blockchain re-organization and consensus instability.
MEV in different blockchains
Ethereum
Ethereum is most heavily plagued by MEV problems because of two things: its complexity, and mempool-block waiting time. The Ethereum ecosystem is by far the most complex among all blockchains, especially on DeFi and NFT, which means way more MEV opportunities than other simpler chains, for example, Bitcoin. The 15 seconds block time and the fact that transactions are gossiped among nodes (thus entering the public mempool) before getting included in a block make it easier to monitor all Ethereum pending transactions. MEV bots have plenty of time to identify potentially profitable transactions, replay them locally to validate the profitability, and submit their own transactions to the network — all done before a new block is produced.
Rollups
Optimistic rollups
In optimistic rollup solutions like Arbitrum and Optimism, validators only get to choose what transactions to include/exclude. The ordering of transactions, instead, is done by a sequencer node. The sequencer then uploads a fraud proof of the ordered transaction bundle to Ethereum mainnet, and all transaction execution is done on layer 2. The separation of the authority of sequencing from the authority of including has essentially stripped MEV access from nodes, and concentrated it to the sequencer. Therefore, “who controls the sequencer” becomes an inevitable question. The answer from Optimism is “MEV Auction”: transaction ordering power of a given block will be sold to the highest bidder, who can then maximize the MEV he or she gets from this block. Arbitrum takes a different approach, by which transactions will be ordered according to a “fair ordering” algorithm that sequences transactions by certain criteria. In fact, it is possible for optimistic rollups to completely abandon transaction ordering, at the cost of latency on L1, to eliminate MEV completely.
Currently, both Arbitrum and Optimism teams are running their sequencers, therefore not fully decentralized.
Zero-knowledge rollups
Currently in ZK-rollup solutions like StarkWare and zkSync, validators compute zero-knowledge proof for transactions and send them to Ethereum mainnet. There are no explicit rules for transaction ordering, so MEV still exists; nonetheless, it’s possible for ZK-rollups to embed a universal ordering algorithm into the proof-generating process so as to eliminate MEV. It is a similar logic with Arbitrum’s fair ordering which re-introduces objectivity to blockchains.
Novel public blockchains
Near
Remember that MEV depends on blocktime and transaction visibility to both the public and the nodes. On NEAR blockchain, the average block time is about 1 second, which means the time left for MEV searchers to identify, test, and submit lucrative transactions is little. Moreover, as the only natively-sharded blockchain, NEAR’s architecture makes MEV exploitation extremely difficult because an MEV searcher would have to be able to track all shards of NEAR in order to make sure that his/her transactions would be successful. Therefore, MEV exploitation is only theoretically present in NEAR, but minimized in reality.
Solana
Solana introduces a novel component into its consensus mechanism, which is “Proof of History (PoH)”. Every transaction will have a proof or timestamp generated by a Verified Delay Function (VDF) which proves that a certain period of time has elapsed since the creation/submission of the transaction. The PoH is used for nodes to universally agree on the sequence of events on Solana, therefore the classical MEV doesn’t seem to exist on Solana.
How Eden approaches the problem
Eden Network, formerly known as ArcherDAO, is a protocol aiming at regulating MEV extraction in a decentralized manner, and reducing MEV negative externalities. The core feature of Eden Network is its Eden token system. Essentially, Eden network wants to incentivize miners to order transactions according to the amount of Eden tokens each user is willing to stake/pay, and reward miners with Eden token release. In it’s vision, all MEV will be captured by EDEN tokens, which is then distributed fairly to miners. Eden Network has its own Ethereum client, eden-geth, which is a fork of MEV-geth by Flashbots, that enables miners to order transactions according to Eden’s rules, and produce “Eden blocks”.
Capturing all MEV with Eden token
Slots auction
Slot is a new class of transactions that get priority above all other transactions in Eden Network block producers’ blocks. There are 3 slots in every Eden block, each with a maxim gas limit of 1.5M. Users (called “slot tenants”) reserve these slots via a continuous auction mechanism known as a Harberger tax, which tax slot tenants on a linear basis tax rate of 3.3% everyday. A slot tenant loses claim to the slot after all prepaid rent is consumed, which is about 30 days. A slot tenant can be outbid by another user anytime. In this case, the outbid tenant can either increase his bid, or forgo the claim to the slot and take back the remaining rent.
Transaction bundles auction
Block producers are also allowed to accept transaction bundles. Bundles are included after any priority queue transactions, but before transactions from regular Ethereum/Eden users. There is an overall gas limit for bundles (4M). The transaction bundle auction is a mature mechanism developed by Flashbots, which is widely used by arbitrageurs liquidators. In Eden Network, transaction bundles only have second-tier priority compared to slots, which means the system naturally favors big MEV extractors (who are willing and able to pay for the slot rents for at least 30 days) over medium ones.
Eden staking
Regular users are able to stake EDEN in exchange for transaction ordering priority and extra transaction handling options. Regular transactions (whether from the Eden network or public mempool) will be ordered first by staked EDEN balance then by ETH tip, and they will come after the priority queue transactions + transaction bundles. Users must stake a minimum of 100 EDEN in order to gain the benefit of special transaction handling options. Transactions submitted directly to the Eden Network relay by users with at least the minimum stake will not be gossiped to other nodes to provide for enhanced privacy and attack protection
Unsolved questions
Since its token launch, Eden Network has incurred considerable doubt. Although it claims that more than 50% of total hash power of Ethereum network is now mining Eden blocks, it’s unclear what’s Eden block’s share among all blocks produced, since miners can freely switch between producing Eden blocks and normal (or Flashbots) blocks with no cost. From a pure economic view, the following problems seem to be still present in Eden’s current structure.
Slot auction: smoothen the un-smoothable?
Slot auction in Eden block is meant to “institutionalize” MEV extraction, where some huge arbitrageurs and bot runners, and also DeFi protocols that don’t want to be attacked, are supposed to rent the slot and make the best use of it. The reality is, however, MEV is highly volatile, which means a rational MEV extractor cannot determine whether it’s worth it to bid a big amount of Eden for unpredictable MEV value for the next 30 days. At the same time, miners are forced to accept the auction result, which may let them earn much less than normal if the MEV value is actually high for the next period. This could explain why Eden slot auction is not hot.
Transaction bundles: second-tier Flashbots?
The problem with transaction bundle auction in Eden Network is that transaction bundles no longer enjoy the top priority. Instead, they are constantly executed after slots. For those who can’t afford slot auctions, they have to face the risk that their transaction bundles, and the underlying MEV opportunities, are actually executed by slot tenants before them. Therefore, medium MEV extractors will either be discouraged from the ecosystem, or simply use Flashbots instead.
Stake Eden: institutionalized sandwich attack?
For average Ethereum users, “staking 100 EDEN so that your transactions won’t be sandwiched” may sound attractive. But there are two problems with it. First, private transaction is a service already provided by Flashbots, Taichi minepool, and other private relay providers, which doesn’t require staking any token. Eden Network is providing a permissioned version of a permissionless service. Second, staking Eden doesn’t protect you from being sandwiched: the MEV attacker can simply stake more EDEN in their accounts, or pay a higher ETH tip. Front-running and sandwich-buy are actually made easier by Eden.
Neutral MEV regulating vs. Bad MEV prevention
The distinction between regulating neutral MEV (arbitrage, liquidation, etc.) and preventing bad MEV (front-running, sandwich attack, etc.) is sometimes neglected in the discussion of MEV solutions. For the former, the focus should be isolating MEV extraction from other on-chain transactions so that there won’t be a gas war that hurts every user. For the latter, however, the only fundamental solutions are transaction privacy and universal objectivity: it’s impossible to sandwich a transaction if it’s not even visible to you, or miners don’t have the power to order transactions at all. Eden Network’s solution to the former is still perplexed by the abovementioned problems, which goes on to affect its solution to the latter.
Other solutions
There are other solutions to the MEV problem. We categorize them into four groups.
Separation and auction
This group of solutions separates neutral MEV extraction from ordinary transactions. Therefore, average Ethereum users will be isolated from the gas war and the resulting soaring gas fee. The most classical solution of this kind is Flashbots.
Flashbots
Flashbots provides a unique type of Ethereum client (mev-geth) that enables transaction bundle auctions. Users can send their transaction bundles to mev-geth without being exposed to public mempool. The ordering of bundles is then determined by an auction among all users, denominated by ETH.
Private mining pool
There are mining pools stating that they don’t expose users’ transactions to the public mempool, so that users can directly send transactions to their nodes without worrying about being front-run. One of the most famous private mining pools is Taichi, which has been used by Samczsun to escape from the dark forest.
Private transaction
An intuitive response to MEV is to hide the transaction content from the public, and this is indeed possible. There are protocols like Libsubmarine that allows users to reveal the content of their transactions only after it’s been included in a block.
Objectivity
Someone wants to deprive nodes the right of sequencing. As what we see in certain L2 and new blockchains, technologies like Chainlink’s Fair Sequencing Service (FSS) and Verified Delay Function (VDF) are used to introduce objectivity to blockchain infrastructure.
Useful links
Ethereum is a Dark Forest: https://medium.com/@danrobinson/ethereum-is-a-dark-forest-ecc5f0505dff
Escaping the Dark Forest: https://samczsun.com/escaping-the-dark-forest/
Flashbots: https://medium.com/flashbots/frontrunning-the-mev-crisis-40629a613752
Paradigm article: https://research.paradigm.xyz/MEV
Dragonfly article: https://medium.com/dragonfly-research/we-live-in-a-mempool-backrunning-the-mev-crisis-a4ea0b493b05
MEV auction philosophy: https://ethresear.ch/t/mev-auction-auctioning-transaction-ordering-rights-as-a-solution-to-miner-extractable-value/6788
MEV Auction debate: https://medium.com/offchainlabs/meva-what-is-it-good-for-de8a96c0e67c
MEV on Ethereum: https://ethereum.org/ca/developers/docs/mev/
MEV smoothing proposal: https://ethresear.ch/t/committee-driven-mev-smoothing/10408
Mempool basics: https://dyor-crypto.fandom.com/wiki/Mempool
Solana on mempool: https://medium.com/solana-labs/gulf-stream-solanas-mempool-less-transaction-forwarding-protocol-d342e72186ad
Sealed-bid MEV auction: https://ethresear.ch/t/mev-sgx-a-sealed-bid-mev-auction-design/9677
Regarding Eden’s economy: https://twitter.com/bertcmiller/status/1435686488725934101
Grug capital research: https://www.chainnews.com/articles/574175057859.htm