Have you read a lot about MEV, relays, block building, Flashbots, Ethereum and don't fully understand it yet?
Why? Because no one can explain them well.
How can we best understand MEV and Ethereum? It can be understood by tracing the chain of events of a single transaction.
Most of us know how Ethereum transactions work from a user perspective: you can exchange, bid, buy, sell, or do pretty much anything else.
Today, let's take a look at the token exchange transaction: it is one of the simplest and most frequent transactions on the Ethereum network.
Let's take a look at exchanging ETH to USDC. In this case, where does the transaction start? Uniswap.
Connect Uniswap to your Metamask wallet, and swap.
From here, the transaction (TX) is sent out via RPC (Remote Procedure Call). This is the first "stop" in the transaction pipeline.
If you haven't changed your Metamask settings, by default the RPC endpoint you connect to is called Infura (a product of Consensys).
Think of Infura as a "waiter" that submits your "order" to Ethereum. It acts as a middleman between you and the Ethereum network.
Your transaction goes into the Ethereum mempool: a public transaction pool where transactions stay until they are included in a block.
Typically, these transactions are ordered within a block based on the priority fee/tip paid.
Unless there is MEV (Maximum Extractable Value) available.
The story here is divided into two parts:
1. How is MEV generated?
2. What is the flow mechanism of MEV in the Ethereum network?
(Terminology clarification: MEV searchers are those who try to find MEV opportunities in the network)
Let's start with the first part of the story: how did MEV come about in the first place?
Say you sell $10,000 of ETH on-chain.
In an AMM, there is slippage in every transaction: every dollar of asset sold pushes the new price down a little.
If I sell a large amount of an asset (ETH as an example), the new price of the asset may be lower than the current market price.
In this case, it would be wise for MEV Seekers to buy ETH at the new price and sell it at the market price. This is a risk-free arbitrage.
Sometimes MEV searchers will buy an asset immediately ahead of you and sell it to you at a premium. (This is backrunning: trailing transactions)
There are many other forms of MEV (including "long tail" MEV), which can be very complex, but these AMMs - slippage arbitrage are one of the most common MEV trades.
Now for the second part: the mechanics.
MEV Seekers rely on the specific order of transactions in Ethereum blocks to make a profit.
Take the previous example: when I sell my ETH, you (MEV searcher) need to be the first transaction after my purchase to take advantage of the arbitrage.
If someone else gets the first transaction before you after I sell ETH, you lose.
They will buy ETH and sell it for a profit instead of you.
So it all boils down to competition between different MEV seekers.
Therefore, the fundamental question surrounding MEV boils down to how seekers get their transactions included in blocks.
Usually, it depends on how much priority fee/tip is paid.
If I pay the highest tip of all transactions in a block, then my transaction will be included first.
Since before the Ethereum merger, the tip/priority fee was owned by the miner, the name "miner-extractable value" was born.
MEV is usually a competition to see who will pay the most for a particular transaction slot.
Most of the "meat on the bone" goes to network participants, not MEV seekers themselves.
However, there is an incentive that will lead to cartelization: if I am an MEV searcher, I can directly cooperate with anyone who is building a block, and I can gain an advantage over other searchers.
But cartels are not healthy for Ethereum: they make MEV permissionless and lead to poor user experience.
This is where Flashbots come in: Flashbots are a large auction, a way for MEV seekers to bid for block space slots.
If you want to get the deal right after me, you can pay. If you win the auction, you can backrun my transaction.
The ecosystem of Flashbots is as follows:
If you successfully bid for the slot, you can simultaneously submit a "bundle" of transactions: in this case, my transaction + your trailing transaction.
The bundle is given to a block builder who will include it with other profitable transactions in an attempt to generate the most valuable blocks.
Block builders then pass the block to a service called a relayer, which "hosts" the block on their behalf.
Relayers receive blocks from builders and present block "bids" (spends) to validators.
Many repeaters operate simultaneously, competing with each other.
A word of caution: Some relayers, including the Flashbots relayer, censor transactions.
These relayers comply with the guidelines of the U.S. Department of the Treasury's Office of Foreign Assets Control (OFAC) and will not pass on transactions that do not comply with OFAC regulations. This is a big problem.
Other relayers, such as Fold Finance, are non-compliant, meaning transactions that do not comply with OFAC regulations can still go through, although they often take longer.
For non-OFAC compliant blocks, it is very important that transactions go through, otherwise Ethereum is somewhat of a US government controlled system.
Relayers receive all blocks and bids and "reveal" them to validators. Validators then choose a block to propose.
Validators connect to relayers and use a piece of middleware software (MEV-boost is the most popular, but there are others) to select the most profitable blocks.
Relayers “escrow” the contents of blocks so that validators cannot steal MEV.
After validators choose which blocks they want to propose, relayers pass the entire content on to validators, who in turn pass it on to the network.
From here, your MEV transaction is complete.
Now, I believe you have a better understanding of MEV, Ethereum and the relationship between them.