Flashbots — Keeping Blockchains Decentralized

Tiena Sekharan
Coinmonks

--

Say you’ve identified an arbitrage opportunity- Buying an asset cheap on one DEX and selling the same at a higher price on another DEX.

When you execute this on a public blockchain, your transaction will wait in the mempool (memory pool) visible to everyone, till it is picked up by miners/validators and added to a block. In the early years of blockchain, this wasn’t a problem. But today, specialist bots are constantly scanning the mempool looking for profitable transactions. If they find your transaction, they can replicate it and get the replicated transaction added to the blockchain ahead of yours by paying higher gas fees. The bot will capture the arbitrage profit that you have identified and by the time your transaction is executed the price differential between the DEXes will have reduced if not disappeared.

In the language of tradfi, you would have been front-run.

This is one of the simplest examples of MEV (Maximum Extractable Value) — Profits that Miners, Validators, Trading Bot, or other privileged protocol actors generate by deliberately including, excluding, or reordering transactions in blocks. For a more detailed note on MEV please read here.

Is MEV good or bad?

MEV has been justified by its practitioners on the grounds that it makes markets more efficient by say removing arbitrage opportunities. But there are some negative externalities:

At the Protocol level

Centralisation — Miners/Validators ensure blockchain security. They’re compensated for their service with (i) block rewards and (ii) transaction fees. Today, these 2 sources of income are no longer sufficient to run a viable miner/validator operation. MEV is becoming an increasingly important 3rd source of income. If a miner/validator cannot generate MEV then it cannot compete and hence cannot survive.

MEV generation is a specialized activity requiring advanced tools and skills that few possess. This means that since running a mining/validating operation without MEV is unviable, the pool of entities securing the blockchain will drop. With only a few large miners/validators left, the blockchain will become centralized.

Time Bandit Attacks — Additionally, there is an existential risk to Ethereum if Validators see MEV opportunities in older blocks and decide to rewrite block history.

For Trading Bots

Network congestion and Increased Gas Fees — MEV opportunities are finite and several bots tend to chase the same opportunity. If a transaction offers MEV of $100, it is rational for multiple bots to pay just under $100 to have their transaction included ahead of both the original user and that of other bots. Several entities executing the same transaction cause network congestion and raise average transaction fees.

For Users

Front-running, Back-running, Sandwich Attacks — Users are seeing the profits from their trading strategies stolen by bots that execute front-running, back-running, and sandwich attacks. Only those with access to the most advanced bots will be able to profit from blockchain protocols while the majority of the population will be unable to interact with it.

So what is the solution? Proposer Builder Separation (PBS)

MEV is problematic. But crypto doesn’t ban problematic things. Crypto believes in having incentives guide behavior instead of regulation. As long as there is a possibility of making profits, humans will find a way of capturing that profit. Hence banning MEV will likely simply result in a game of whack-a-mole.

The approach taken by crypto to tackle MEV is to democratise it i.e. find those profits and divide them fairly among ecosystem participants. In the context of the movie “Dumb Money” ensure that it isn’t just Citadel and Robinhood that is keeping all the profits.

To counter the negative externality of centralization highlighted above, Vitalik Buterin suggested Proposer-Builder Separation (PBS).

The validator role includes 2 tasks — (i) Building Blocks and (ii) Adding (or proposing) Blocks to the Chain. With PBS one accepts that building blocks with maximum profitability is a technically sophisticated task that over time is likely to become centralized. But if adding blocks remains fairly straightforward then several entities can offer this service and help retain blockchain decentralization.

Remove the burden of block construction from validators. Instead, enable them to buy blocks constructed by third-party Block Builders that specialize in maximizing MEV.

Flashbots

Flashbots, an R&D Organization is working towards making MEV markets more efficient, distributed, and democratic. MEV-Boost is an implementation of PBS built by Flashbots to help Validators access profitable Blocks.

Below is what the MEV-Boost flow looks like:

Source — Flashbots Docs

There are 4 main players involved.

1. Searchers

Searchers scan public and private mempools and create bundles with high MEV by including, excluding, and reordering transactions, and sending those to Block Builders. Searchers could be the users themselves who execute arbitrage and liquidation strategies.

Source — Flashbots Docs

2. Block Builders

Block Builders collect bundles from multiple Searchers, assemble complete blocks that maximize their earnings after factoring in transaction fees and MEV, and send full blocks to Relays. Block Builders must be trustworthy as they see transaction details and hence have the opportunity to extract MEV for themselves.

Source — Flashbots Docs

3. Relays

Relays collect full blocks from Block Builders, confirm the validity of the block, calculate the profitability, and convey block headers (NOT full transaction details) to Validators. Like Block Builders, Relays also must be trustworthy as they too see transaction details and hence have the opportunity to extract MEV themselves.

Source — Flashbots Docs

4. Validators

Validators add blocks to the chain. First, they receive block headers from Relays via MEV-Boost. Next, they convey their commitment to proposing the most profitable block header from all the block headers received from multiple Relays. On receiving this commitment, the full block details are added to the blockchain, and transactions within it are made public. Since Validators do not see transaction details till they commit to proposing a block, they are trustless parties who cannot front-run.

Source — Flashbots Docs

Note that access to MEV-Boost ensures that Validators earn MEV without expending resources on searching and extracting MEV.

Summarising how Flashbots counters the negative externalities of MEV

Centralization

Flashbots separates the tasks of Block Building and Block Validation. The complex job of Block Building is carried out by specialist third parties who sell blocks to Proposers.

The incentive structure thus means that less sophisticated Validators have access to the same blocks as the most sophisticated. Block Builders earn no MEV if their blocks don’t make it to the chain. Hence, any entity that has the skills to build blocks is incentivized to share blocks with all Validators.

This helps retain blockchain decentralization. The protocol does not lose the smaller Validators that cannot compete with the technically advanced ones in MEV generation.

Network congestion and Increased Gas Fees

With transactions and block space bids done in private, the same transaction is not sent by multiple parties and hence network congestion and high fees are avoided. Additionally, with FB, you pay gas fees only if your transaction successfully makes it to the block.

Front-running, Back-running, Sandwich Attacks

When users submit transactions to a private pool where others cannot snoop around your transactions and front-run them. Also, users can earn additional income through a product called MEV-Share. While front-running is bad for users, transactions can generate MEV in other ways that do not negatively impact the original transaction. When such MEV is generated, a share of that MEV is refunded to users

MEV vs PFOF

There are parallels between Maximal Extractable Value (MEV) and Payment for Order Flow (PFOF) paid by Market Makers with High-Frequency Trading tools.

Market Makers play a key role in offering liquidity and maintaining fair and orderly markets. Brokerages send client trades to Market Makers as they’re better equipped to handle large orders with minimal price impact.

Market Makers make a payment called PFOF to Brokerages. If it is Market Makers that are offering a valuable service to brokerages then why are they the ones paying brokerages instead of the other way around. Market Makers pay for this flow because they make money off it. At the most basic level, they make a bid-ask spread on each trade. Additionally, flow data offers valuable market color that their complex trading algorithms can convert to profits. For example, if the algorithms pick up a trend that retail investors are becoming interested in the Stock of Company X, the market maker may be getting a signal to load up on the stock of Company X.

The point to highlight is that there’s additional money that can be made on client trades by those servicing that trade. If only the liquidity providers that pay PFOF can access these trades then not only will the initial retail traders get sub-optimal pricing but also over time there will be very few liquidity providers left who will monopolize the market.

In the blockchain world, MEV is that additional profit that can be made on blockchain transactions. If only a few specialist intermediaries have the tools and skills to include transactions in blocks then block production would become a monopoly and the monopolists would capture all the MEV to the detriment of users. If there are several entities then users can sell MEV to the entity that protects their trades and offers the most competitive price.

--

--

Tiena Sekharan
Coinmonks

I’m passionate about Cryptocurrencies and am keen to help those struggling to make sense of this world with all its confusing terms and esoteric concepts.