The MEV Bible, Part 1 of 2

MEV, short for Miner or Maximal Extractable Value, is a term that has been around in the crypto world for some time now. While there is no universally accepted definition, we’ll define MEV as the total value that validators can extract by sequencing, altering, or censoring transactions at the expense of users. The existence of MEV potentially threatens the ability of blockchains to create fair, transparent, permissionless, and decentralized systems, making it a critically important research topic.

The existence of MEV poses a significant threat to the foundational principles of blockchains, including fairness, transparency, permissionlessness, and decentralization. The concept of MEV was first introduced by pmcgoohan in a 2014 Reddit post, dubbed “Miner Frontrunning,” and later formalized in the groundbreaking paper Flash Boys 2.0 in 2019. MEV presents a considerable challenge for blockchains as high transaction fees incentivize validators to prioritize certain transactions over others, potentially causing systemic issues that hinder the network’s ability to reach consensus. This concern is not only highlighted in the Flash Boys paper but also alluded to in a 2016 research paper on Bitcoin by esteemed academics from Princeton.

Since then, MEV has come front and center as the explosion of DeFi (Decentralized Finance) and NFTs (Non-Fungible Tokens) created enormous profits for MEV practitioners and miners/validators. It has also stirred up significant amounts of controversy due to transaction censorship that is in line with OFAC rules post the Tornado Cash incident. While there’s no way to calculate the exact amount of MEV and transaction censorship within a network, estimates are that the lower bound of total MEV is worth over $680 million and the percentage of OFAC compliant transactions is around 42% as February 28, 2023.

The aim of this primer is to provide you with a comprehensive understanding of MEV on Ethereum and evaluate current and potential solutions. As MEV is a complex and interdisciplinary topic, we will start by introducing fundamental concepts related to transactions and block production, which will form the basis for understanding MEV. We will then delve into the concept of MEV, its possibility, and the different types of MEV that exist in the ecosystem. We will examine MEV from a philosophical perspective, highlight its benefits and drawbacks, and conclude with an overview of potential solutions and their advantages and disadvantages.

Should MEV be fought or embraced?

Core Concept: Transactions and Block Production

In Ethereum, transactions are broadcasted to a network of computers or nodes that store the transaction in their local¹ mempools, where the transaction waits until a node validates it and commits it to a block on the blockchain. A mempool is a list of pending transactions that have not yet been included in the blockchain and each node has its own unique mempool to manage.

¹In the context of this discussion, “local” refers to data that is stored on a specific node or computer rather than on the blockchain itself. For example, when you store something on your computer’s hard drive, it is considered local to your computer. It’s important to note that each computer or node has its own mempool, which is essentially a list of unconfirmed transactions, and these mempools are unique to each node. THERE IS NO UNIVERSAL MEMPOOL THAT ALL NODES SHARE!

Ethereum Transaction Lifecycle:

  1. A user will initiate a transaction from a dApp or wallet, such as sending funds to another account or contract.

  2. The user will then sign off on that transaction with their wallet, using their private key.

  3. The wallet will then send the signed transaction to a node to get it onto the Ethereum network. A node is just a computer that is part of the Ethereum network running software that can verify blocks and transaction data.

  4. The node will verify the transaction to ensure that it’s valid, set the transaction’s status to ‘Pending’, include in it’s own unique mempool, and then broadcast the transaction to it’s peers (other nodes that it’s connected to) — the verification process checks for a number of things and this step #4 also happens over and over again each time a node receives a transaction, which is how transactions are propagated through the network.

Now that we have some idea for how transactions are verified, stored in mempools, and propagated across the network, we can dive into the validation process to get a better understanding of how blocks of transactions are produced and included in the blockchain.

While the transaction lifecycle is taking place, the block producing process is also happening simultaneously.

Users who want to validate transactions have to run a node and stake 32 ETH as collateral with that particular node — these nodes are also known as validating nodes or validators. A user can operate multiple validators but must stake 32 ETH with each one. The reason for posting this collateral is to protect the network since some or all the collateral will be destroyed if a validator behaves poorly. We won’t get into what can cause the collateral to be slashed, but if you are curious, you can read more about that here.

During the block production process, the Ethereum network will randomly select a validator to propose a block. Once chosen, the validator will batch a set of transactions from their mempool (remember validators are just nodes that have 32 ETH worth of collateral posted), execute them and determine a new state for the network. The validator will then wrap all this information into a block and pass it to other validators in the network who will vote or ‘attest’ to the block. These other validators will re-execute the transactions in the block to ensure they agree with the proposed change to the global state. Assuming the block is valid they add it to their own database. This process of batching transactions into a block and proposing that block to be voted on by other validators happens every twelve seconds. If a validator hears about two conflicting blocks for the same slot they use their fork-choice algorithm to pick the one supported by the most staked ETH.

Now that we’ve gotten a good grasp for how transactions are propagated through the network and how transactions are actually included in the final blockchain, we can begin to explore what MEV is.

MEV Overview

What is MEV?

Like everything else in crypto, MEV is a fairly nascent field that is still relatively under-researched. There are multiple definitions of MEV depending on who you talk to, but for the purposes of this primer, we’ll stick to our definition of what MEV is — The total value that validators can extract by sequencing, altering, or censoring transactions as well as the profit they receive from transaction fees and block rewards.

Why is MEV possible?

  1. The mempools are public, meaning anyone can look at pending transactions and see which ones are profitable

  2. Validators proposing a new block have full control over which transactions to include and the order of transactions

These two facts mean that validators can effectively look into the mempool and sequence, alter, or censor certain transactions in order to generate a profit. We’ll dive into some specific examples in the following section.

Types of MEV

This value accrued to validators can be further broken into harmless and harmful profits.

Harmless MEV: These sources of revenue occur regardless of sequencing, reordering, or censoring transactions

  • Transaction Fees — Fees paid to validators for getting transactions included in the block.

  • Block Rewards — Validators receive rewards for attesting to blocks inline with the majority of other validators, proposing blocks, and participating in sync committees.

The validators earn these fees regardless of their ability to manipulate transactions so they can be considered neutral or harmless MEV.

Harmful MEV²: These sources of revenue occur because of sequencing, reordering, and transaction censorship.

  • Arbitrage — Taking advantage of price discrepancies across the crypto ecosystem, e.g., buying ETH at $1100 on one trading venue and selling it for $1200 on another. One could argue that some types of arbitrage have a neutral impact since price discrepancies have to be closed anyways, but one could also argue that MEV participants create an environment that does not incentivize competitive arbitrage strategies, which could lead to less efficient markets since MEV and arbitrage require different skillsets — for example, there’s a math competition where the first person to solve the problem wins, you and your friends are honest mathematicians but you are competing against opponents who can simply copy your answer and then pay a higher fee to turn it in first. While you and your friends are optimizing for math knowledge to solve these problems, your opponents are actually optimizing for the ability to copy your answer and turn it in first. These two skills are unrelated and this scenario might result in less incentive for the math-smart wiz kids to participate in these competitions.

  • Front-Running — When a transaction is inserted before another transaction in order to generate a profit, usually at the expensive of another user. It’s fairly obvious that this type of behavior is harmful and an example could be if a validator sees a profitable arbitrage transaction, copies it and executes the transaction themselves, and then places their transaction ahead of the original one.

  • Back-Running — When a transaction is inserted right after another transaction in order to generate a profit. This one is less obviously harmful, but when paired with a front-running transaction it becomes one of the most malicious types of MEV, a sandwich attack. Back-running can seem like front-running at times since the two are very similar and an example of a back-running strategy would be for a validator to wait for the deployment transaction of a hot NFT collection and then place their transaction right after to mint all the NFTs.

  • Sandwiching — When there is a front-running transaction and a back-running transaction that sandwich a users transaction between them. This is one of the most malicious types of MEV and is purely harmful, the classic example is Alice makes a transaction to purchase 1000 units of Token A on a DEX but sets her slippage too high, a validator could front-run Alice’s transaction by purchasing 1000 units of Token A to drive up the price, Alice would then purchase her tokens at a higher price, and the validator would then back-run that transaction and sell their tokens after, profiting off of Alice’s slippage and causing her to overpay for her tokens. If you have ever traded on a DEX, there’s a high chance that you have been sandwich attacked.

  • Censoring — When a transaction or a set of transactions are omitted from inclusion. This is another one of those fairly malicious types of MEV that is purely harmful. There’s a number of reasons why censorship is bad, first and foremost because the act of censoring transactions goes against everything decentralized blockchain networks stand for. We’ll use a liquidation event as an example here, where the price of an asset drops sharply and some on-chain loan is going to default. The borrower attempts to add more margin to their account but the validator proposing the new block purposely omits this transaction and places their own transaction to liquidate the position, causing the borrower to default and allowing the validator to purchase the assets at a significant discount.

²One caveat here is that the majority of profits coming from this category are not necessarily accruing to the validators, but rather professionalized arbitrageurs and other MEV participants. However, we categorize these as MEV since the validator could decide to run these strategies themselves.

Hopefully by now, you have some basic understanding around the block building process, the power that validators have in the network, and the problems that MEV can cause for users. In Part 2 of this MEV piece, we’ll dive deeper into the ecosystem, introduce the the actors in the MEV space and talk about some potential solutions.

Previous
Previous

The MEV Bible Part 2 of 2

Next
Next

Introducing Breed VC