1 of 41

mev and ethereum

Alex Stokes

@ralexstokes

ethtokyo - 15 April 2023

2 of 41

what is mev?

  • A question that only gets more interesting the longer you sit with it

  • “Miner extractable value”, “Maximal extractable value”, “MEV”

  • Ability of block producer to choose how transactions are sequenced on-chain

3 of 41

example plz: “sandwich”

  • Uniswap
    • Look at USDC/ETH pool with price at 1656
    • “Buy 1 ETH for 1656 USDC plz”
    • “I’ll accept slippage of 0.5%”
      • 1664.28

  • If we are the first transaction after this snapshot
    • Get 1656 USDC 😀

4 of 41

example plz: “sandwich”

  • But, time in between snapshot and when we get our trade on-chain
    • Block producer has ability to insert, remove, or reorder transactions in their block arbitrarily
  • Sandwich “attack”
    • Attacker buys up to slippage tolerance of target trade
      • “Frontrun”
    • Target trade goes through, pushing price up
    • Attacker immediately sells tokens they just bought for a profit 🤑
      • “Backrun”

  • Need slippage to use DEX productively, but also exposure to MEV

5 of 41

why do we care?

  • Most (all?) interactions on-chain expose MEV

  • The question becomes: what do you do about it?

  • “mev-aware protocol design”
    • Raw incentives to drive behavior in cryptoeconomic systems
    • Powerful, but also space for abuse

6 of 41

mev on ethereum?

7 of 41

Transaction supply chain - @thegostep

8 of 41

Transaction supply chain, tomorrow and beyond

bundler

userOp

ERC-4337

4337 bundles

9 of 41

Transaction supply chain, tomorrow and beyond

ERC-4337

Order flow auctions (OFA)

user

wallet

solvers in OFA

searchers

builders

validators

bundlers

10 of 41

Transaction supply chain, tomorrow and beyond

ERC-4337

Order flow auctions (OFA)

user

wallet

solvers in OFA

searchers

builders

validators

bundlers

Layer 2?�Centralized vs decentralized components

11 of 41

MEV on Ethereum

  • MEV is a centralizing force
  • Can “firewall” MEV concerns away from core protocol
    • Proposer-builder separation (PBS)

  • Large design space, want to be thoughtful about anything we enshrine in the protocol

  • What can we do in the meantime?
    • mev-boost

12 of 41

Transaction supply chain, tomorrow and beyond

ERC-4337

Order flow auctions (OFA)

user

wallet

solvers in OFA

searchers

builders

validators

bundlers

Layer 2?�Centralized vs decentralized components

13 of 41

MEV on Ethereum, future directions

  • Open R&D into other parts of the “supply chain”
    • Wallet innovations for “MEV capture”
      • MEV rebates
      • ERC-4337 and MEV
    • Application-level design
      • MEV minimization
      • MEV utilization?
    • Protocol-level design
      • MEV minimization, capture? MEV burning?
    • Decentralized block building, searching
  • Flashbots SUAVE
  • Rook, CoWSwap, many others!

14 of 41

PBS

mev-boost today

enshrined PBS tomorrow?

15 of 41

What is mev-boost?

  • “Off-chain” implementation of proposer-builder separation (PBS)
  • Stewarded by Flashbots in collaboration with Ethereum researchers and developers

  • https://boost.flashbots.net

16 of 41

How do we implement PBS?

  • Proposers: may want to sell blockspace

  • Builders: want to buy blockspace

17 of 41

Block builders

Proposers �(validators in Ethereum)

18 of 41

Block builders

Proposers �(validators in Ethereum)

🤨❓

19 of 41

mev-boost

  • Network that hosts the marketplace for this exchange
    • Has first-price open-bid auction mechanism
    • Otherwise, unopinionated

  • Software implementation with supporting specification to handle the communication from builder to proposer

20 of 41

Rendezvous service

Block builders

Proposers �(validators in Ethereum)

mev-boost

21 of 41

So how would it work?

  • Each “slot”, a proposer can simply query the builder network for bids
  • Proposer can pick the highest bid, and include that execution payload in their own block

22 of 41

But, there’s a catch…

  • Ethereum has a decentralized validator set
    • Encourage stakers of all sizes

  • Anyone can become a validator and be able to include the contents of built blocks in their own proposals (!)

23 of 41

MEV stealing

  • Builders will take a “tip” to compensate them for their work of assembling the built execution payload
  • Validators can take built payloads, remove builder payment and collect *all* MEV

0xdeadbeefcafe… (builder)

0xcafe3143… (proposer)

0xdeadbeefcafe… (builder)

0xcafe3143… (proposer)

😇

😈

24 of 41

How to stop MEV stealing?

  • Option 1: Only allow trusted validators to access the network
    • “They simply won’t steal”
    • But, hard to implement
    • But, some MEV opportunities can be larger than the “reputation” built up so far
    • But, harms decentralization as only a subset of stakers can access profitable opportunities

  • Option 2: Remove the conditions that demand the trust assumption
    • how?

25 of 41

Democratization with mev-boost

  • Support permissionless access to the builder network

  • Modify the previous mechanism with a “commit-reveal” scheme
  • Builders commit to a block, and *this* is what the proposer chooses as part of bid selection

  • Builders must later reveal the full block

26 of 41

builder

proposer

27 of 41

But wait, there’s more

  • Want to encourage a permissionless network of block builders, just like validators
  • Builders are trusted to reveal the selected block

  • “Availability attack”
    • Can grief proposers by not releasing the “purchased” block

28 of 41

Enter the relay

  • Builders and proposers do not necessarily trust each other
  • Fix the problem with a trusted intermediary: the relay

  • Relays ensure:
    • builders only provide good blocks
    • the block data is made available
  • Relays are trusted to not leak builder work / MEV

  • Can have many competing relays

29 of 41

https://writings.flashbots.net/writings/searching-post-merge

Another relay

Yet �another relay

30 of 41

mev-boost post merge?

31 of 41

32 of 41

ok, so we are good?

33 of 41

Relay censorship quickly entered the chat

34 of 41

“sandwich the ripper”

  • Proposer exploited behavior of relays to access a block via equivocation
  • Could steal MEV in the block
    • “Unbundling attack”

  • In this case, targeted a block with many sandwich bundles
  • Could drain liquidity of sandwich bots

35 of 41

“sandwich the ripper”

36 of 41

pbs: what’s next?

37 of 41

Longer-term for PBS

  • Iterate towards “enshrined” PBS
    • Get rid of relays!

  • Vitalik’s “two-slot” PBS: https://ethresear.ch/t/two-slot-proposer-builder-separation/10980
    • Put auction in the protocol, use gossip network for bids, blocks

  • Lots of open questions here! More R&D awaiting…

38 of 41

Near-term for PBS

  • Harden mev-boost, relay model today
  • Early explorations of a PBS spec
  • Latency games in mev-boost

@casparschwa, EF RIG

@mikeneuder

39 of 41

Near-term for PBS

mev-boost.pics

40 of 41

Immediate-term for mev-boost

  • “sandwich the ripper” fix, but pushing up against synchrony bounds

  • Shapella (capella + shanghai) happened 🎉
  • 4844, other protocol features around the corner 👀

  • Implement out-of-protocol censorship resistance techniques?
    • “Inclusion lists”, but hard to enforce off-chain…

41 of 41

  • @ralexstokes on twitter