Degen Code

Degen Code

Share this post

Degen Code
Degen Code
Flashbots — Smart Contract Bribe
Copy link
Facebook
Email
Notes
More

Flashbots — Smart Contract Bribe

Nice Bundle, Real Shame If Something Happened To It

Aug 06, 2022
∙ Paid
5

Share this post

Degen Code
Degen Code
Flashbots — Smart Contract Bribe
Copy link
Facebook
Email
Notes
More
11
Share

A very interesting feature of Flashbots is the ability to pay miners directly, instead of competing in a priority gas auction (PGA). Their modified node software (mev-geth) performs a special calculation to evaluate the effective gas price of submitted bundles.

Miners participating in the Flashbots pool will evaluate the gas prices of the individual transactions, but also take into account all direct transfers by means of the coinbase.transfer() call. The purpose of this function call is to send a direct Ether payment to the miner. Whenever you see coinbase, that is a placeholder for the address of the miner that proposed that particular block.

Please review the formula provided at the Flashbots link, paying special attention to the first part of the expression : Δcoinbase. This represents the Ether sent directly to the miner as part of a proposed bundle.

The rest of the numerator expression adds the gas payments for all new transactions inthe bundle, and subtracts the gas payments for pending transactions already submitted by others.

After that, the total gas use is factored in to allow the miner to select for the highest effective gas price (gas fee paid per unit of gas consumed).

Paying a miner directly via a coinbase transfer is a new concept, and it must be implemented at the smart contract level.

Flashbots Vyper Contract

Vyper provides everything we need to implement this feature. Reference the Environment Variables and Constants page where we see that block.coinbase is always available to us, and is interpreted as an address.

Bribe Function

We can use this reference to build a bribe() function that sends an Ether payment directly to the miner.

Coinbase transfers must be done in native Ether, but we can hold a balance of both Ether and WETH on the contract. The bribe must handle both balances intelligently to avoid unnecessary gas use.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 BowTiedDevil
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More