As mainstream adoption gathers steam and the number of decentralized finance (DeFi) transactions explode, the Ethereum community is debating a growing controversy: the best way to tackle the Miner Extractable Value (MEV) problem.
Disputes come as no surprise given that in the past three years, the total value locked (TVL) in DeFi applications has gone from zip to $54 billion today. In 2021 alone, DeFi on Ethereum has enjoyed a colossal rise in value, increasing 246% already by July.
Dr. Friederike Ernst is chief operating officer at Gnosis.
But with rising value comes increased attempts at exploitation, as we’ve seen with the co-occurring rise of MEV.
Defined in a 2019 Flash Boys 2.0 paper by a group of researchers at Cornell University, MEV is “the measure of the profit a miner can make through their ability to arbitrarily include, exclude or re-order transactions within the blocks they produce.” Miners can exploit and profit from front-running, back-running and sandwiching transactions in any block they mine. These types of activities are not well received by DeFi users as they translate to higher costs for executing transactions, and have a higher chance of paying for a failed transaction.
As DeFi scales and pulls in wider adoption, such behaviors affect more users and transactions than ever and are unlikely to be solved by Ethereum’s transition from proof-of-work (PoW) to proof-of-stake (PoS), according to a report from research group Flashbots.
Why MEV is an issue
Is MEV really that bad for Ethereum? Well, it depends on which side of the fence you’re on. Since January 2020, miners have “extracted” nearly $750 million in value from Ethereum users. In the last 30 days, that figure stands close to $94 million.
MEV-type value extraction, executed by miners who hold sole power to organize transactions within a block, is endemic due to the Ethereum Virtual Machine (EVM) mempool design. This element of mempool design has garnered the Cixin Lin-inspired nickname “the dark forest,” a side effect of the EVM architecture that goes unnoticed by most users.
In a nutshell, every transaction on Ethereum submitted to the chain is monitored to check if there’s a possibility of taking advantage of it. It’s in the dark forest that the mainstream Ethereum community learned there is often an adversarial relationship between users and miners.
The MEV “dark forest” gives rise to two intertwined problems:
- DeFi users are constantly suffering from all types of MEV, such as front-running attacks that end up making the users’ transactions fail even though they paid to execute them, or back-running attacks where the users get value extracted from their operations solely because the miners are in a privileged position.
- Even when a transaction tries to prevent a possible protocol exploit, it can still lead to a bigger problem because the existence of the transaction itself signals the protocol weakness to everyone else.
Not all hope is lost.
MEV is not going to go away unless we design resilient components for users. Critical infrastructure and correct tooling for DeFi are necessary to combat the problem. And it has to be at the dapp level. The transition to proof-of-stake is an unlikely solution, as changing Ethereum’s core protocol requires a very high level of consensus (which is most likely not going to happen).
There are multiple ways in which dapps or users can combat MEV, but the most realistic approach is to have a trading mechanism (protocol) that enforces batch auctions. Batch auctions, or batch trading, is when an exchange’s order book processes orders across a time range with the goal of executing all trades within a batch simultaneously. This serves as a price finding mechanism for correctly pricing token pairs with the same clearing price for each block.
In traditional markets, batch auctions are used during market opens to process all the orders placed during non-market hours. In DeFi, batch auctions are helpful to execute numerous transactions simultaneously in the same block.
In a system where miners or validators have all the power to reorganize transactions, batch auctions settlements can take away that power from them. This is because a batch settlement forces the miners to execute transactions regardless of the order they have. With a batch auction with uniform clearing prices, the order of the trades can not alter the prices.
Batch auctions allow dapps built on top of a protocol to offer users improved trading methods, such as:
- Gasless order submission, or when users submit off-chain orders via signed messages
- Enforcement of the same prices for all trades that happen at the same time, even if they are from different traders
- Helping users get matched directly with one another – in a “coincidence of wants” – without depending on external, third party liquidity pools
Off-chain, more gain
Submitting off-chain orders through signed messages is a new way of conducting trading that has not been widely used before. Dapp users don’t need to submit on-chain orders for them to be valid. Rather, they can submit off-chain orders by signing a transaction with their order preferences (they are signing a message with their intent to trade).
Because the orders have been placed off-chain, the transactions are not sent to the mempool individually, until they are later sent and settled via the batch auction settlement transaction all at once. This means they can be settled all together in a single batch, which increases the difficulty to replicate and makes the re-organization of transactions irrelevant because all trades have the same price regardless of the order.
At the same time, off-chain orders can allow a protocol to be non-trading route dependent, so that even if a miner is able to pick up the signed messages and tries to take advantage of them, it would be irrelevant as the miner does not know against which AMM pool those trades will be settled. As the protocol does not force users to be bound to a specific trading path, it can focus on achieving better prices rather than on executing transactions the fastest.
Protocols that have price-finding mechanisms based on batch auctions with uniform clearing prices and coincidence of wants (CoWs) can offer their users a level of MEV protection unmatched by any other form of MEV prevention developed so far. (Coincidence of wants is an economic phenomenon where two parties each hold an item the other wants, so they exchange these items directly without the need of a third party providing liquidity to facilitate the exchange to happen.)
On a deeper level, this means that if protocols use batch auctions instead of a constant function market maker design, they can offer their users the chance to settle trades directly based on the CoWs that can be found. The protocol can therefore optimize prices according to the different orders it receives in each batch, so that it’s always able to give the best price to traders while protecting them from MEV. As we mentioned before, batch auctions can also allow a protocol to establish uniform clearing prices, which, along with CoWs, can help users be protected from MEV.
This protection comes from the fact that, because the protocol matches the trades without external on-chain liquidity. In other words, in the event of a COW, the protocol would not need to execute an on-chain transaction against an automated market maker (AMM) to make the trades liquid.
Additionally, if no CoWs can be found, uniform clearing prices within a batch auction make the transaction ordering of the auction irrelevant because all trades of the same token pair get the same settlement price, therefore removing the possibility of MEV actors having a chance to extract value by reorganizing transactions.
MEV is a growing problem for Ethereum, but it can be mitigated. Protocols focused on batch auctions, with these sorts of qualities, can help the DeFi-automated market maker space in the fight against MEV. It’s up to us as a community to ensure we only use those dapps that have the users interest at heart, and that allow them to coordinate trades in a smarter and more efficient manner.
Thanks to Alex Vinyas & the Gnosis team for their feedback in developing this op-ed.