Skip to content

Commit bee8702

Browse files
Add docs for gas fee refunds (#555)
* Add docs for gas fee refunds * Add multiplexing and bundle stats instructions * Explain smart bundles * Correct prefix from eth to flashbots * Add refund rule * Specify API users and update description of refund API * Fix build errors caused by link issues --------- Co-authored-by: George Zhang <georgezhangtj97@gmail.com>
1 parent 6dbf3c1 commit bee8702

File tree

11 files changed

+201
-10
lines changed

11 files changed

+201
-10
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Gas Fee Refunds
3+
---
4+
5+
## Introduction
6+
7+
Searchers and private transaction API users are automatically eligible to receive gas fee refunds. If Flashbots can include a bundle on chain for a lower price, you are eligible to receive a refund.
8+
9+
Gas fee refunds do not change how bundles are executed and searchers do not need to make any changes to be eligible for them.
10+
11+
## Where do refunds come from
12+
13+
Gas fee refunds include both priority fees and coinbase transfers.
14+
15+
In an optimal case, searchers are refunded the difference between their bid and the bid of the next-best bundle or transaction targeting the same state. Ie. the refund effectively results in the searcher paying the second price. In practice, searchers will receive some fraction of this amount depending on how much profit the Flashbots builder makes.
16+
17+
## Which bundles receive refunds
18+
19+
Flashbots provides refunds for bundles in blocks landed by the Flashbots block builder. Whether a bundle receives a refund depends on a few factors that vary from block to block:
20+
* How much network congestion and competition there was
21+
* Whether the Flashbots builder made a profit and how much
22+
* How much the specific bundle contributed to the value of the block
23+
* If the bundle was sent directly to Flashbots, or shared with other block builders by the searcher
24+
25+
## How to maximize both refunds and speed
26+
27+
Transactions which are sent directly to the Flashbots Builder via the Bundle Relay, and not multiplexed _by the searcher_ to other block builders, are likely to receive higher refunds. This is because they increase the profit of the Flashbots builder which is used to provide refunds.
28+
29+
The Flashbots block builder does not land 100% of blocks. In order to land bundles in all blocks, searchers can ask Flashbots to share their bundles with other block builders in cases where the Flashbots builder does not win a block. Flashbots will automatically share with all specified builders on the searcher's behalf.
30+
31+
### Smart multiplexing
32+
33+
To share bundles with other builders, add the `builders` field to your `eth_sendBundle` request. The `builders` field accepts a list of strings which correspond to the "name" tags of [registered builders](https://github.com/flashbots/dowg/blob/main/builder-registrations.json).
34+
35+
All `eth_sendBundle` requests are shared with the Flashbots builder. They are multiplexed to other block builders at the end of the slot if the Flashbots builder determines it will not win that block.
36+
37+
For example:
38+
39+
```
40+
{
41+
"jsonrpc": "2.0",
42+
"id": 1,
43+
"method": "eth_sendBundle",
44+
"params": [
45+
{
46+
"txs": ["0x123abc...", "0x456def..."],
47+
"blockNumber": "0xb63dcd",
48+
"minTimestamp": 0,
49+
"maxTimestamp": 1615920932
50+
"builders": ["builder0x69", "beaverbuild.org"]
51+
}
52+
]
53+
}
54+
```
55+
56+
Searchers can also use `mev_sendBundle` to multiplex bundles if they prefer. Though this method is more complex and not necessary for gas fee refunds.
57+
58+
_Note: Smart multiplexing has a 1% rate of false positives, meaning that in 1% of MEV-Boost blocks there is a risk that searcher bundles will not be landed._
59+
60+
### Bundle stats for multiplexed bundles
61+
62+
To view bundle stats on multiplexed `eth_sendBundle` requests, use the `flashbots_getSbundleStats` API. You will see a new "smart" field in the response to multiplexed `eth_sendBundle` which indicates that the sbundle stats endpoint should be used.
63+
64+
## How are refunds calculated
65+
66+
The Flashbots builder uses a refund rule to retroactively calculate refunds for all bundles landed in its blocks.
67+
68+
The refund rule aims to have bundles make the minimum net payment so that bidding optimally is as straight forward as possible. We do this by measuring the contribution of bundles above the other bundles the builder has received, and refunding as much of that as possible.
69+
70+
Bundles sent by the same signer will be treated as non-competitive.
71+
72+
### The Flat Tax Rule
73+
74+
<div className="med caption-img">
75+
76+
![Flat tax rule](/img/flat-tax-rule.png)
77+
78+
Definition of the flat tax rule
79+
80+
</div>
81+
82+
Notice that if the block generates enough value after paying the proposer, everyone should be refunded their contribution, meaning everyone pays the minimum they need to pay to beat competition.
83+
84+
### Identity constraint
85+
86+
To avoid the rule being gamed by submitting bundles from multiple identities, we impose an additional constraint that no set of identities can receive in total more refunds than they contribute to the block.
87+
88+
<div className="med caption-img">
89+
90+
![Identity constraint](/img/identity-constraint.png)
91+
92+
Definition of the identity constraint
93+
94+
</div>
95+
96+
## Who receives refunds
97+
98+
The refund recipient is the signer used on the `eth_sendBundle`, `mev_sendBundle`, or `eth_sendPrivateTransaction` request.
99+
100+
## How to track refunds
101+
102+
Refunds are tracked from a start date of July 8, 2024. Via an upcoming API, users will be able to:
103+
* View unclaimed refund amounts
104+
* Delegate refunds to an Ethereum account other than their signing key address.

docs/flashbots-auction/advanced/multiplexing.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import Builders from '../../specs/mev-share/_builders.mdx';
66

77
Some users might want to send their transactions or bundles to multiple builders for various reasons. The ability to multiplex is supported by our APIs.
88

9-
When you are using [`mev_sendBundle`](https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#mev_sendbundle) to send bundle, or [`eth_sendPrivateTransaction`](https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#eth_sendprivatetransaction) to send transaction, simply specify the builders you want to multiplex to in the `privacy.builders` parameter.
9+
If you are using [`mev_sendBundle`](https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#mev_sendbundle) to send bundles, or [`eth_sendPrivateTransaction`](https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#eth_sendprivatetransaction) to send transactions, specify the builders you want to multiplex to in the `privacy.builders` parameter.
10+
11+
If you are using [`eth_sendBundle`](https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#eth_sendbundle) to send bundles, specify the builders you want to multiplex to in the `builders` parameter.
1012

1113
Below is the list of builders that you can multiplex to:
1214

docs/flashbots-auction/advanced/rpc-endpoint.mdx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Each method is documented below.
4646
maxTimestamp, // (Optional) Number, the maximum timestamp for which this bundle is valid, in seconds since the unix epoch
4747
revertingTxHashes, // (Optional) Array[String], A list of tx hashes that are allowed to revert
4848
replacementUuid, // (Optional) String, UUID that can be used to cancel/replace this bundle
49+
builders, // (Optional) Array[String], A list of [registered](https://github.com/flashbots/dowg/blob/main/builder-registrations.json) block builder names to share the bundle with
4950
}
5051
]
5152
}
@@ -81,9 +82,43 @@ example response:
8182
}
8283
```
8384

85+
If `builders` are specified, the response will include an additional `smart` field. Use the `flashbots_getSbundleStats` API to look up stats for smart bundles.
86+
87+
example with `builders`:
88+
89+
```json
90+
{
91+
"jsonrpc": "2.0",
92+
"id": 1,
93+
"method": "eth_sendBundle",
94+
"params": [
95+
{
96+
"txs": ["0x123abc...", "0x456def..."],
97+
"blockNumber": "0xb63dcd",
98+
"minTimestamp": 0,
99+
"maxTimestamp": 1615920932,
100+
"builders": ["builder0x69"]
101+
}
102+
]
103+
}
104+
```
105+
106+
example response:
107+
108+
```json
109+
{
110+
"jsonrpc": "2.0",
111+
"id": "123",
112+
"result": {
113+
"bundleHash": "0x2228f5d8954ce31dc1601a8ba264dbd401bf1428388ce88238932815c5d6f23f",
114+
"smart": "true"
115+
}
116+
}
117+
```
118+
84119
### mev_sendBundle
85120

86-
`mev_sendBundle` uses a new bundle format to send bundles to MEV-Share. See the [Sending Bundles](/flashbots-mev-share/searchers/sending-bundles#simulating_bundles) page for more information, or check out the [Sending Bundles](/flashbots-mev-share/searchers/sending-bundles) page for a short guide.
121+
`mev_sendBundle` uses a new bundle format to send bundles to MEV-Share. See the [Understanding Bundles](/flashbots-mev-share/searchers/understanding-bundles) page for more information, or check out the [Sending Bundles](/flashbots-mev-share/searchers/sending-bundles) page for a short guide.
87122

88123
<SendBundleSpec />
89124

docs/flashbots-protect/additional-documentation/eth-sendPrivateTransaction.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ and 70% of the backrun value is left to the builder.
220220

221221
### eth_sendPrivateRawTransaction
222222

223-
`eth_sendPrivateRawTransaction` behaves like [eth_sendPrivateTransaction](#eth_sendprivatetransaction) but its format
223+
`eth_sendPrivateRawTransaction` behaves like [eth_sendPrivateTransaction](#) but its format
224224
is similar to that of [`eth_sendRawTransaction`](https://docs.alchemy.com/reference/eth-sendrawtransaction)
225225

226226
This method has the following JSON-RPC format:
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Gas Fee Refunds
3+
---
4+
5+
## Introduction
6+
7+
Flashbots Protect users are automatically eligible to receive gas fee refunds. If Flashbots can include your transaction on chain for a lower price, you are eligible to receive a refund. This applies to both the RPC and the private transaction API.
8+
9+
Gas fee refunds do not change how transactions are executed and users do not need to make any changes to be eligible for them.
10+
11+
Gas fee refunds are calculated separately, and applied in addition to, refunds from [MEV-Share](/flashbots-protect/mev-share).
12+
13+
## Where do refunds come from
14+
15+
Users and orderflow providers (like wallets) often pay high priority fees to land transactions on chain. Many of these transactions could be executed just as quickly for a fraction of the gas cost.
16+
17+
It can be difficult to estimate gas correctly when sending a transaction. The Flashbots block builder calculates this on behalf of users and automatically refunds transactions that overpay.
18+
19+
Gas fee refunds include both priority fees (more common in user transactions) and coinbase transfers (less common).
20+
21+
## Which transactions receive refunds
22+
23+
Flashbots provides refunds for transactions in blocks landed by the Flashbots block builder. Whether a transaction receives a refund depends on a few factors that vary from block to block:
24+
* How much network congestion and competition there was
25+
* Whether the Flashbots builder made a profit and how much
26+
* How much the specific transaction contributed to the value of the block
27+
* If the transaction was sent directly to Flashbots, or shared with other RPCs and block builders
28+
29+
## How to maximize both refunds and speed
30+
31+
Transactions which are sent directly to the Flashbots RPC or API, and not multiplexed _by the user_ to other RPCs or block builders, are likely to receive higher refunds. This is because they increase the profit of the Flashbots builder which is used to provide refunds.
32+
33+
The Flashbots block builder does not land 100% of blocks. In order to improve inclusion speed, users can ask Flashbots to share their transactions with other block builders in cases where the Flashbots builder does not win a block. Flashbots will automatically share with all specified builders on the user's behalf.
34+
35+
There are two ways to share with other builders:
36+
* Use [fast mode](/flashbots-protect/quick-start#faster-transactions) to share with all registered builders
37+
* Choose [specific builders](/flashbots-protect/mev-share#builders) to share transactions with
38+
39+
## Who receives refunds
40+
41+
For the RPC: The refund recipient is the address specified in the first [refund parameter](/flashbots-protect/mev-share#refunds) on an RPC request, if one is provided. Otherwise, refunds are sent to the transaction originator (`tx.origin`) by default.
42+
43+
For the private transaction API: The refund recipient is the signer used on the `eth_sendPrivateTransaction` request.
44+
45+
## How to track refunds
46+
47+
Refunds are tracked from a start date of July 8, 2024. Users wil be able to view unclaimed refund amounts via an upcoming API.

docs/flashbots-protect/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ It has the following key benefits:
2020

2121
- **Configurable:** You can choose which builders to send to and your mev-share settings.
2222
- **Frontrunning protection:** Transactions are sent to a private Flashbots mempool where they will be hidden from front-running and sandwich bots.
23-
- **Receive backrunning MEV refunds**: If your transaction creates MEV via backrunning, you will receive an MEV refund through [MEV-Share](/flashbots-mev-share/introduction).
23+
- **Receive refunds**: If your transaction creates MEV via backrunning, you will receive an MEV refund through [MEV-Share](/flashbots-mev-share/introduction). If your transaction pays a higher priority fee than required for inclusion on chain, you will receive a [gas fee refund](/flashbots-protect/gas-fee-refunds).
2424
- **Revert protection:** Users do not pay for failed transactions since transactions that would revert are excluded.
2525

2626
You can use Flashbots Protect by clicking the button below or by sending transactions using `eth_sendRawTransaction` to `rpc.flashbots.net/fast` or the custom URL based on your advanced configuration below.

docs/flashbots-protect/quick-start.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Flashbots Protect has the following key benefits:
1010

1111
- **Highly Configurable:** Customize your preference level for privacy, latency, and rebate returns.
1212
- **No frontrunning:** Transactions are hidden from the public mempool away from front-running and sandwich bots.
13-
- **Earn MEV refunds**: If your transaction creates MEV, earn refunds through [MEV-Share](/flashbots-mev-share/introduction).
13+
- **Earn refunds**: If your transaction creates MEV, earn MEV refunds through [MEV-Share](/flashbots-mev-share/introduction). If your transaction pays high priority fees, earn [gas fee refunds](/flashbots-protect/gas-fee-refunds).
1414
- **No failed transactions:** Transactions are only included in the block if they will not revert. Users do not pay fees for failed transactions.
1515

1616
### Faster Transactions
@@ -49,10 +49,10 @@ You can also add Flashbots Protect RPC manually in MetaMask by following these s
4949
3. Click “Add a network manually” and fill in the following information:
5050

5151
- **Network Name:** Flashbots Protect
52-
- **New RPC URL:** <https://rpc.flashbots.net/fast> or the URL provided above based on your configuration
52+
- **New RPC URL:** [https://rpc.flashbots.net/fast](https://rpc.flashbots.net/fast) or the URL provided above based on your configuration
5353
- **Chain ID:** 1
5454
- **Currency Symbol:** ETH
55-
- **Block Explorer URL:** <https://etherscan.io/>
55+
- **Block Explorer URL:** [https://etherscan.io/](https://etherscan.io/)
5656

5757
4. Click “Save.”
5858
5. Click “Switch to Flashbots Protect”
@@ -62,10 +62,10 @@ You can also add Flashbots Protect RPC manually in MetaMask by following these s
6262
Flashbots Protect RPC for Goerli testnet can be added with these details:
6363

6464
- **Network Name:** Goerli Flashbots Protect
65-
- **New RPC URL:** <https://rpc-goerli.flashbots.net/>
65+
- **New RPC URL:** [https://rpc-goerli.flashbots.net/](https://rpc-goerli.flashbots.net/)
6666
- **Chain ID:** 5
6767
- **Currency Symbol:** ETH
68-
- **Block Explorer URL**: <https://goerli.etherscan.io/>
68+
- **Block Explorer URL**: [https://goerli.etherscan.io/](https://goerli.etherscan.io/)
6969

7070
Below is the list of Flashbots Protect RPCs we currently support across Ethereum mainnet and testnets:
7171

docs/guide-send-tx-bundle.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ With `relay.flashbots.net` identified as the go-to for advanced operations, the
2727

2828
- **For Single Transactions**: Use `eth_sendPrivateTransaction`.
2929
- **For Bundles of Transactions**:
30-
- **Use**: `mev_sendBundle` for more flexibility and power, like leveraging the [new bundle format](flashbots-mev-share/searchers/understanding-bundles), [MEV-Share](flashbots-mev-share/introduction), and [multiplexing to multiple builders](flashbots-auction/advanced/multiplexing).
30+
- **Use**: `mev_sendBundle` for more flexibility and power, like leveraging the [new bundle format](flashbots-mev-share/searchers/understanding-bundles) and [MEV-Share](flashbots-mev-share/introduction).
3131
- **Use**: `eth_sendBundle` if you want something simple and quick! The OG way of sending bundles.
32+
- Both bundle APIs support [multiplexing to multiple builders](flashbots-auction/advanced/multiplexing).

docs/sidebars.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = {
3434
"Advanced Concepts": [
3535
'flashbots-auction/advanced/understanding-bundles',
3636
'flashbots-auction/advanced/multiplexing',
37+
'flashbots-auction/advanced/gas-fee-refunds',
3738
'flashbots-auction/advanced/coinbase-payment',
3839
'flashbots-auction/advanced/bundle-pricing',
3940
'flashbots-auction/advanced/reputation',
@@ -53,6 +54,7 @@ module.exports = {
5354
'flashbots-protect/overview',
5455
'flashbots-protect/quick-start',
5556
'flashbots-protect/mev-share',
57+
'flashbots-protect/gas-fee-refunds',
5658
'flashbots-protect/cancellations',
5759
'flashbots-protect/stuck_transactions',
5860
'flashbots-protect/large-transactions',

static/img/flat-tax-rule.png

181 KB
Loading

static/img/identity-constraint.png

529 KB
Loading

0 commit comments

Comments
 (0)