Following the value of one attack
Measuring MEV means following the value taken by ordering, from the user who lost it to everybody who ends up with a share. It also means asking how few builders make most blocks.
Both numbers matter for design. Today you split the value of one sandwich and measure how concentrated a toy builder market is.
By the end of this lesson
Note
I can measure how extracted value is shared out and how concentrated block building is.
Key words
| Word | What it means | Example |
|---|---|---|
| Extracted value | what an ordering attack takes, measured in tokens | |
| Share | one party's part of the whole, as a percentage | |
| Market share | the percentage of blocks one builder makes | |
| Concentration | how much of a market a few players hold | |
| HHI | the sum of every market share squared | 55 squared plus 20 squared ... |
The cells students fill in are left blank in this preview.
The value of an attack is passed along
A bot rarely keeps all it takes. To be placed around the user, it tips the builder. To win the block, the builder bids most of what it earns to the proposer.
In the lab, Ana loses 81 blue and the bot gains 88 red. The bot tips the builder 60, and the builder bids 50 to the proposer. So the proposer ends with the biggest share.
Follow the value of one sandwich
docker exec jupyter python3 steps/measure.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Worked example: who keeps the 88 red
| Who | Keeps | Share of the gain |
|---|---|---|
| The bot | 88 minus 60 = 28 red | 32% |
| The builder | 60 minus 50 = 10 red | 11% |
| The proposer | 50 red | 57% |
The cells students fill in are left blank in this preview.
Try it: split another gain
gain = 200
to_builder = 150
to_proposer = 120
shares = [["bot", gain - to_builder], ["builder", to_builder - to_proposer], ["proposer", to_proposer]]
for share in shares:
print(share[0], "keeps", share[1], "which is", 100 * share[1] // gain, "in every 100")
# Builders compete harder: change to_proposer to 145. Who gains from the competition?
How many builders make the blocks?
Count which builder won each block, then work out each one's market share. The top share, and the top two together, are quick measures.
A fuller one is the HHI: square every market share and add them up. A market split evenly between many has a low HHI. One builder with everything scores 10000. In the lab, 100 auctions gave north 55 blocks, an HHI of 3684.
Count the winners of 100 auctions
docker exec jupyter python3 steps/builders.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Worked example: 100 toy auctions
| Builder | Blocks | Share squared |
|---|---|---|
| north | 55 | 3025 |
| east | 20 | 400 |
| south | 13 | 169 |
| quay | 9 | 81 |
| west | 3 | 9 |
| All five | 100 | HHI 3684 |
The cells students fill in are left blank in this preview.
Why concentration is a risk
If one or two builders make most blocks, they can leave out transactions they dislike, which is censorship. One failure can also stall many blocks.
These measures turn a worry into a number you can watch over time. A design that spreads building out, or limits what a builder can see, should push the HHI down.
A common mistake
Warning
Many people think MEV is all profit for bots. When builders compete, most of the value is bid on to proposers, as the lab's 57% shows. The user still loses it either way, so the measure that matters for users is the loss.