Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Block builders, relays and proposer-builder separation

After this lesson: I can pick the winning bid in a proposer-builder auction and say who does what.

60 min lesson1 commandBlock building and MEV lab: mempool, sandwiches, auctions and defences in Python

Who really builds a block?

Proposer-builder separation, PBS, splits block making into two jobs: specialist builders put blocks together, and the proposer only picks one and signs it. The block is sold in an auction every slot.

It shapes who holds power over the order of transactions. Today you run a sealed-bid auction on the toy chain and see who is paid what.

By the end of this lesson

Note

I can pick the winning bid in a proposer-builder auction and say who does what.

Key words

WordWhat it means
Proposerthe validator whose turn it is to add the next block
Buildera specialist that assembles a whole block and bids for it
Relaya go-between that checks blocks and passes bids on
Sealed bida bid no other bidder can see
Paymentwhat the winning builder pays the proposer

The cells students fill in are left blank in this preview.

Three roles: builder, relay and proposer

Builders read the mempool and private order flow and choose transactions. They put them in the order that earns most and bid to have their block used.

A relay sits in the middle. It checks each block is valid and passes only the bid and a header to the proposer, not the transactions. The proposer picks the highest bid and signs the header, then the relay releases the full block.

Worked example: who does what

RoleSees the transactionsDecidesIs paid
BuilderYesWhich transactions and their orderBlock value minus its bid
RelayYesWhether a block is validNothing in the toy
ProposerNo, until it signsWhich bid winsThe winning bid

The cells students fill in are left blank in this preview.

The block is sold in a sealed-bid auction

Each builder works out what its block is worth to it, its value, and offers the proposer part of that, its payment. No builder sees another's bid.

In the lab, a block may hold at most 4 transactions. The relay refuses east, which offers 160 for a block worth only 150, and south, whose block holds 6. North pays 90, the most of the valid bids, and wins.

Run the sealed-bid auction

Command
docker exec jupyter python3 steps/auction.py

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Worked example: the four bids

BuilderValuePaymentTransactionsRelay passes
north120904Yes, and wins
east1501603No, pays more than its value
south110956No, too many transactions
west100702Yes

The cells students fill in are left blank in this preview.

Try it: what each builder keeps

Code: python
bids = {"north": [120, 90], "west": [100, 70]}

for name in bids:
    value = bids[name][0]
    payment = bids[name][1]
    print(name, "would pay the proposer", payment, "and keep", value - payment)
# Add "quay": [140, 100] to bids and run again.
# Which bid should the proposer pick, and what does quay keep?

Why separate the jobs, and what it costs

Building a block that earns most needs heavy software and fast access to order flow. Separation lets a small proposer earn the same as a large one, without running any of it.

The cost is trust and concentration. A few builders can decide what goes in most blocks, and a relay is trusted to release the block it promised. Lesson 6 measures that concentration.

A common mistake

Warning

Many people think the proposer chooses the transactions in its block. Under PBS it only picks the highest valid bid and signs a header it cannot read. The builder chose the transactions and their order.

About this lab and its source: Block building and MEV lab: mempool, sandwiches, auctions and defences in Python

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.