Introduction
Decentralized Finance (DeFi) aims to disrupt finance through decentralized technologies such as blockchain and cryptocurrencies. Despite the many differences from traditional finance (TradFi), there is something that both DeFi and TradFi can relate to: frontrunning.
In traditional finance, frontrunning refers to trading based on publicly unavailable information about future purchases or sales. While clear in its definition, the extent to which frontrunning exists in practice in the traditional markets today is highly disputed. There is a lot of competition to get the fastest data feeds to exchanges, so high-frequency traders (HFT) may execute trades based on the information milliseconds before the rest of the market.
On Ethereum, this works slightly differently than TradFi – the behavior of taking advantage of arbitrage, stop hunting, liquidations, etc. are some examples. As the trading value of transactions increases, the value of trading has increased. This new form of profit-taking is called Miner or Maximal Extractable Value (MEV).
The key difference between front running in traditional markets and on Ethereum is; in traditional markets certain players have privileged access to submitting and re-ordering trades in the market. While MEV on Ethereum can contribute to greater levels of market participation, transparency, and efficiency. At its best, MEV helps make the DeFi markets more efficient by creating financial incentives to rectify price inconsistencies but can also lead to a dangerous side where all high value transactions are intercepted for making profit, spoiling the ethos of blockchain.
Why MEV Exist?
Blockchains, at their core, need to produce blocks filled with transactions. When blocks are produced by centralised miners, it defeats the core decentralisation objective of the blockchain. This is why most blockchains build incentive mechanisms where Miners/Validators are motivated by transaction fees to filter out and avoid junk or spam transactions. Fees on chains like Ethereum prohibit bad actors from congesting the network by overwhelming them with large volumes of transactions. Blockchains that haven’t required transactors to attach fees, such as EOS, have found their chains filled with junk.
Miners/Validators hold power to prioritise or de-prioritise certain transactions at will. This can be motivated by vested interests of the Miner, such as exploiting a particular transaction for monetary gain.
With Miners/Validators working out of self-interest, it is common for them to choose transactions with high value to process first. This is a blessing in disguise because the self-interest to earn high transaction fees can also lead to pushing out a few transactions for benefits other than transaction fees.
While MEV can be found on any blockchain, it is prevalent on Ethereum due to its account-based model and transaction execution schema. Ethereum keeps track of the balances of users accounts in a way similar to a traditional bank. There is a single balance that is credited and debited with every transaction. Other blockchains, most notably Bitcoin, operate using an unspent transaction output (UTXO) model, which works similar to holding paper bills.
Ethereum makes MEV easier mainly because transactions are sequential and complex. Complex transactions depending on older transaction execution to complete and the fact that all transactions are readable from mempool create tons of opportunities for MEV to exist on Ethereum.
There are different types of MEV like Arbitrage, Liquidation, Sandwiching, Just in time liquidity attacks, NFT MEV, etc. and more details on those can be found here.
MEV Today
In Ethereum’s current state, most miners are not attempting to exploit MEV themselves, thankfully not yet. Nearly all of the current activity is driven by non-mining traders or trading bots. However, some MEV can only be captured by miners because they have the authority to order or exclude transactions. Non-miners can access a strictly smaller subset of “simple” MEV.
Since each block can only contain a limited number of transactions, miners have full power in selecting which pending transactions in the mempool (the location block producers store unconfirmed transactions off-chain) they will include in their block. While miners usually order transactions by the highest gas price (transaction fee) in order to maximize their profits, this is not a requirement by the network. As a result, block producers can extract additional profits from users by taking advantage of their ability to arbitrarily reorder transactions, creating MEV.
Now let’s dive deeper into what happens after the user sends the transaction, and credits to lightclients who simplified this.
Searcher – The searcher’s goal is to extract MEV from Transactions. When they find a vulnerable transaction, they package it with their own transaction that does the extraction. This bundle is often referred to as a “fragment”. The searcher sends their fragments to the builder to be aggregated.
Builder – The builder or block builder aggregates the fragments into a block. This provides a layer of DoS protection for the miner. The miner could do the building themselves, but allowing this to be a specialized role means the builder can focus on providing good service to searchers and users.
Miner – Once the builder has produced a block, it forwards the block to the miners, who can create a seal for the block (e.g., mine it).
That’s roughly what MEV extraction looks like today. Searchers send txs to the builder in plaintext, builders send blocks to the miner in plaintext, and the miner extends the chain. Each actor trusts the next actor to not steal their MEV.
MEV Post Merge
With Ethereum Merge around the corner (roughly around 15-16 September 2022), which will remove the need for miners entirely from the network. Instead of being secured by the computation of miners, Ethereum will be secured through validator node operators. These node operators can be anyone who stakes multiples of 32 ETH on the network and run specialized software for proposing blocks and attesting to valid blocks. In exchange for their efforts, validators collect newly minted issuance and transaction fees.
Now with miners moving out of the picture, MEV is here to stay. So when Miners are not here, how is MEV still there? Well, we have validators now with more or less the same privilege as miners, and they have the edge here.
Post merge, there will be thousands of validators trying to push blocks. So when the MEV in a block is worth more than a validator’s relationship with a block builder, it will be a problem. If this happens, this will be a huge loss for builders, so the most probable outcome would be that a small validator will not be eligible to get MEV blocks. This will lead to large validators earning more proportionally for their stake than small validators. If that is the case, then small validators will go bankrupt, and only large validators will sustain themselves, which defeats the purpose of decentralization. Validators could delay future block proposals to optimize for a lucrative MEV opportunity, which presents new complications. To mitigate the feasibility for reorganizations of future blocks, a new weighting dynamic for the votes of validators called “proposer boosting” is in the process of being formally added to the specifications of Ethereum’s upgrade to PoS. The proposer boosting proposal is aimed at securing the network from any type of adversary, not just MEV-hungry validators, from pulling off future-looking block reorgs.
The proposal is to use a third-party software called MEV-Boost to multiplex the communication with many block builders. Under MEV Boost, block builders receive a fee to build the most lucrative blocks for validators and manage the complexities of running between validators and searchers. This creates a new area of specialization from which participants in MEV can earn rewards. While there are clear gains from being a searcher and identifying lucrative MEV opportunities, as well as being a validator and executing these strategies on-chain, users who focus exclusively on transaction bundle ordering and block gas optimization can also stand to earn a piece of the MEV pie.
Additionally, there is a proposal to delegate transaction ordering to block builders. This is further to obfuscate the content of blocks from validators and reduce the ability of validators to front-run searchers by replicating their transaction bundles. The process helps democratize MEV and ensure that the gains from such behavior are not centralized over the long-term to validators alone. Finally, having a neutral third party in the relationship between researchers and block producers is anticipated to improve the trust and encourage more complex and perhaps net-positive MEV types to be innovated over the long run. In these ways, protocol developers from the Ethereum Foundation are redesigning elements of how MEV is earned today to provide long-term security for Ethereum’s consensus model.
There is still much more work to be done to make the external builder protocol and MEV-boost. It is recommended to follow the latest developments on the 2.0 merge and other things from the below links:
- #block-construction channel on the Eth R&D discord
- https://github.com/ethereum/builder-specs repository for the latest information.
- https://twitter.com/lightclients
- https://github.com/flashbots/mev-boost
- https://github.com/ralexstokes/mev-rs
Author – Srikanth Yeleswarapu, Head of Technology, Woodstock Fund
Disclaimer: All the views presented in the article are personal views of the author and do not represent the fund in any form.