Skip to content

Commit

Permalink
Merge pull request #162 from eth-protocol-fellows/pbs
Browse files Browse the repository at this point in the history
Wiki - PBS research content
  • Loading branch information
taxmeifyoucan authored Apr 10, 2024
2 parents ce0e88f + 8b948e0 commit d5c6495
Show file tree
Hide file tree
Showing 13 changed files with 895 additions and 6 deletions.
9 changes: 4 additions & 5 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
- [Precompiled Contracts](/wiki/EL/precompiled-contracts.md)
- [Transaction](/wiki/EL/transaction.md)
- [DevP2P]
- [MPT]
- [JSON-RPC](/wiki/EL/JSON-RPC.md)
- [Consensus Layer](/wiki/CL/overview.md)
- [CL Clients](/wiki/CL/cl-clients.md)
Expand All @@ -53,13 +52,13 @@
- [Scaling](/wiki/research/scaling/scaling.md)
- [Core Changes](/wiki/research/scaling/core-changes/core-changes.md)
- [EIP-4844](/wiki/research/scaling/core-changes/eip-4844.md)
- Blobs
- Sharding
- Statelessness
- Purge
- MEV
- PBS
- Censorship
- [MEV](/wiki/research/PBS/mev.md)
- [PBS](/wiki/research/PBS/pbs.md)
- [MEV-boost](/wiki/research/PBS/mev-boost.md)
- [ePBS](/wiki/research/PBS/ePBS.md)
- Proof of Stake
- [Upgrades](/docs/wiki/research/Beacon%20Chain%20Upgrades.md)
- SSF
Expand Down
Binary file added docs/images/MEV-Boost blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/PBS-outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/mev-boost-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pbs/block-building.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pbs/mev-boost.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pbs/scourge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
618 changes: 618 additions & 0 deletions docs/wiki/research/PBS/ePBS.md

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions docs/wiki/research/PBS/mev-boost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Mev-boost: A popular PBS Implementation

[Mev-boost](https://github.com/flashbots/mev-boost) is a widely recognized, out-of-the-protocol, open-source implementation of Proposer-Builder Separation (PBS) for Ethereum. It allows validators to outsource block building to specialized builders, potentially leading to increased validator rewards and improved network efficiency.

Here's how mev-boost works:

<figure style="text-align: center;">
<img src="images/pbs/block-building.png" alt="Block-building">
<figcaption style="text-align: center;">Current Block building. Source: <a href="https://barnabe.substack.com/p/pbs">Baranabé's article</a></figcaption>
</figure>

On one side, mev-boost implements the [builder API](https://github.com/ethereum/builder-specs) used by an Ethereum node to outsource it block production. On the other, it connects to a network of relays and handles the communication between builders and proposers.

1. **Block Building:**
Specialized builders, known as "searchers" in mev-boost, compete to create the most profitable block for the proposer. They do this by optimizing transaction ordering and inclusion, taking into account factors like gas fees, transaction priority, and potential [MEV (Maximal Extractable Value)](/wiki/research/PBS/mev.md).
Searchers submit their constructed blocks to relays.
2. **Relay Network:**
Mev-boost operates a network of relays that act as intermediaries between searchers and proposers.
Relays receive blocks from searchers and perform various functions like block validation, filtering, and propagation.
Relays ensure that only valid and high-quality blocks are sent to proposers.
3. **Proposer Selection:**
Validators run mev-boost software connected to their beacon node. When validator is chosen to propose a block, they receive blocks from relays and choose the best one based on predefined criteria, typically the block that offers the highest reward.
The validator then proposes the selected block to the network for validation and inclusion in the blockchain.

## PBS Block Creation

The process of block creation through PBS works as follows:

### Block Construction

- Builders continuously monitor the transaction pool (mempool) for new transactions. They assess these transactions based on potential MEV opportunities. They select the transactions that best align with their MEV optimization criteria. Also, block builders can take transaction bundles from private orderflows, or from MEV searchers, just as miners did in PoW Ethereum with the original Flashbots auctions. In the latter case, builders accept sealed-price bids from searchers and include their bundles in the block.
- Once the transactions are selected, builders assemble them into a block ensuring that the block adheres to the Ethereum protocol's rules, e. g., txs are valid, the gas limit is not surpassed.

### Block Auction

Instead of builders directly offering their assembled blocks to validators with a specified price, the standard practice is to use relays. Relays validate the transaction bundles before passing them onto the proposer (validator). Also, implementations can introduce escrows responsible for providing data availability by storing blocks sent by builders and commitments sent by validators.

### Benefits of mev-boost:

- **Increased validator rewards:** By outsourcing block building to specialized searchers, validators can potentially earn higher rewards through optimized transaction ordering and MEV extraction.
- **Reduced centralization:** Mev-boost enables a more competitive block-building landscape, reducing the economy of scale of large mining pools and enabling home stakers achieve same kind of rewards.

### Challenges and Considerations:

While mev-boost offers certain benefits, it also raises some concerns:

- **Security:** Introducing new actors and dependencies can create new attack vectors and vulnerabilities. There have been multiple [incidents](https://collective.flashbots.net/t/post-mortem-april-3rd-2023-mev-boost-relay-incident-and-related-timing-issue/1540) of missed blocks on mainnet due to mev-boost issues.
- **Censorship resistance:** If only a few powerful searchers or relays dominate the ecosystem, it could lead to centralization and censorship concerns.
- **Coordination:** Effective communication and coordination between searchers, relays, and proposers are crucial for the smooth functioning of mev-boost.

It's important to note that mev-boost is just one implementation of PBS. Other implementations with different designs and features are also being developed and explored, for example [mev-rs](https://github.com/ralexstokes/mev-rs) is under development.

Overall, mev-boost represents a significant step towards realizing the potential benefits of PBS in Ethereum. However, continuous research and development are crucial to address the challenges and ensure a secure, decentralized, and efficient implementation. One path towards more stable PBS model is [enshrining it in the protocol](/wiki/research/PBS/ePBS.md), adding mev-boost like features directly to the Ethereum clients.

## Resources

- [Flashbots docs on mev-boost](https://boost.flashbots.net/)
- [Overview of censoring entities](https://censorship.pics/)
- https://www.mevwatch.info/
- [MEV-Boost: Merge ready Flashbots Architecture, 2021](https://ethresear.ch/t/mev-boost-merge-ready-flashbots-architecture/11177)
21 changes: 21 additions & 0 deletions docs/wiki/research/PBS/mev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Maximal Extractable Value (previously Miner Extractable Value)

Maximal Extractable Value (MEV) refers to the the maximum value that can be extracted from block production beyond the standard block reward and gas fees by strategically ordering, including, or excluding transactions in a block.

In Ethereum, MEV has gained greater attention as validators extract increasingly more value, especially in DeFi (Decentralized Finance) applications. Arbitrage opportunities facilitated by strategies like front-running, sandwiching or back-running are possible by ordering transactions in the block. This can also lead to negative consequences, such as unfair advantages for large-scale pools, censorship or increased slippage for DeFi users.

[Proposer-builder separation (PBS)](/wiki/research/PBS/pbs.md) can change the dynamics of MEV extraction in that there could be a redistribution of MEV between the two roles, potentially changing the incentives and rewards associated with each. Since block builders are responsible for transaction ordering and inclusion, they may develop new strategies or promote increased competition that could result in more efficiency and fairer distribution of MEV across the network.

## Evolution of MEV

Maximal Extractable Value (MEV) originated during the proof-of-work era, where it was known as "Miner Extractable Value." This terminology reflected the miners' ability to influence transaction order in the block, including their inclusion, exclusion, and sequencing. Following Ethereum's transition to proof-of-stake with The Merge, validators have taken over the consensus, rendering mining obsolete within the protocol. Despite these changes, the mechanisms for value extraction remain in place, leading to the adoption of the term "Maximal Extractable Value" to address these activities.

Although MEV has been possible since the inception of Ethereum, it gained significant attention with the rise of DeFi and more accessible tooling. In the early days, MEV opportunities were primarily seized by outbidding rivals in the public mempool, marking the era known as Priority Gas Auction or PGA. Details about this chaotic era is captured in [Flashboys 2.0](https://arxiv.org/abs/1904.05234). During that time, [Flashbots](https://www.flashbots.net/) came out as open R&D initiative to improve public knowledge and access to MEV tools.

In the Post-Merge world, the concept of miners ceased to exist but their builder and proposer role is facilitated by validators, responsible to add blocks to the chain in the same way. Anticipating the changes after The Merge, Flashbots, along with the client teams and the Ethereum Foundation commenced the development of [mev-boost](/wiki/research/PBS/mev-boost.md). MEV-boost is an out-of-protocol implementation of Proposer-builder Separation. See the [section on PBS](/wiki/research/PBS/pbs.md).

## Resources

- [A study of the transaction supply chain from CryptoKitties to MEV-Boost to PBS - Barnabé Monnot](https://www.youtube.com/watch?v=jQjBNbEv9Mg)
- [MEV Day playlist](https://www.youtube.com/playlist?list=PLRHMe0bxkuel3w3C7P_WVvp9ShLi3HKRI)
- [How to light up dark forest - Flashbots](https://collective.flashbots.net/t/how-to-light-up-the-dark-forest-a-walkthrough-of-building-a-cryptopunk-mev-inspector/881)
Loading

0 comments on commit d5c6495

Please sign in to comment.