Skip to content

Commit 1100638

Browse files
authored
Merge pull request #253 from primev/bidder-deposit-revamp
2 parents 4a43308 + 4a7ce6b commit 1100638

File tree

5 files changed

+233
-137
lines changed

5 files changed

+233
-137
lines changed

v1.1.0/get-started/bidders/best-practices.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Bidders will start receiving commitments instantly in most cases. If you're havi
6161

6262
Bidders on mev-commit need funds available in their account to submit bids, which can be obtained via bridging to your wallet address and then depositing to your node address. For testnet, you can obtain funds by using the [bridge](/v1.1.0/get-started/bridge). Once funds are deposited, the auto deposit function will automatically deposit funds into your account for the next 3 [windows](/v1.1.0/concepts/bids/bidder-deposit) to bid. Unused funds will automatically transfer into upcoming windows for bidding. You can read more about the auto deposit feature [here](https://docs.primev.xyz/v1.1.0/get-started/bidders/bidder-node-commands#autodeposit-funds).
6363

64-
<!-- ## (Optional) Provider RPCs
64+
{/* ## (Optional) Provider RPCs
6565
6666
If you don't send transaction payloads in your bid, you can send your transactions directly to block builders. Below is a table of Provider RPCs to send your transactions to on testnet. You may already be sending transactions to these providers if you have existing transaction operations.
6767
@@ -84,6 +84,4 @@ If you don't send transaction payloads in your bid, you can send your transactio
8484
<td>[rpc.titanbuilder.xyz](https://rpc.titanbuilder.xyz/)</td>
8585
</tr>
8686
</tbody>
87-
</table> -->
88-
89-
87+
</table> */}

v1.2.x/concepts/bids/bidder-deposit.mdx

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,16 @@ title: Understanding Bidder Deposit Rules
33
sidebarTitle: Bidder Deposit
44
---
55

6-
Bidders need to deposit funds to be able to place bids on the mev-commit network. As bids are posted privately, providers cannot determine how much bidders have bid previously. To still ensure that bidders can cover all their bids, we bind deposits to specific L1 block numbers. Providers con thus ensure that bids from a given bidder do not exceed the amount deposited for the corresponding L1 block number. It is important to note that if a bidder deposits, for example, 1 ETH for some L1 block number, they can post bids totaling 1 ETH for each provider. This is because only a single provider can post the block to L1, meaning bids made to other providers will not be executed.
6+
Bidders need to deposit funds to be able to place bids on the mev-commit network. As bids are posted privately, providers cannot determine how much bidders have bid to other providers for the relevant L1 block. To ensure that bidders can cover all their bids, we bind deposits to specific providers. Providers can thus ensure that bids from a given bidder do not exceed the amount deposited for them.
77

8-
To simplify the user experience, mev-commit considers windows consisting of $\text{blocksPerWindow} = 10$ blocks and splits deposits to a window evenly over the corresponding blocks.
8+
It is important to note that if a bidder deposits, for example, 1 ETH for every provider, they can still only post bids totaling 1 ETH for a given block. This is because only a single provider can post the block to L1, meaning bids made to other providers will not be executed.
99

10-
The remaining funds of a bidder from a window (if any) can be unlocked after the corresponding blocks have been settled. The bidder can then withdraw the funds from the deposit. To further ease the user experience, bidders can enable autodeposits in their nodes, to automatically withdraw deposits from previous windows and redeposit them into future ones.
10+
Deposited funds can be withdrawn by the bidder at any time, after waiting the ~10 minute cooldown period.
1111

12-
## Current window number
12+
## Deposit Manager
1313

14-
The window number for a given L1 block can be calculated via the following formula, where `blocksPerWindow` is equal to 10 and `blockNumber` is the L1 block number for which the bidder wants to bid:
14+
It's recommended that bidders leverage the _deposit manager_ to deposit, and automate ongoing re-deposits to specific providers.
1515

16-
$$
17-
\frac{{\text{{blockNumber}} - 1}}{{\text{{blocksPerWindow}}}} + 1
18-
$$
16+
The deposit manager is an on-chain contract that a bidder account can enable by "setting their code" to the implementation using EIP-7702. After enabling the deposit manager, a bidder's deposits are automatically replenished from the bidder's EOA balance during the preconf settlement process, according to _target deposit_ amounts configured by the bidder.
1917

20-
21-
## Minimum Deposit
22-
23-
Since deposits are split across $\text{blocksPerWindow} = 10$ L1 blocks, bidders have to deposit at least 10 times the amount they want to bid for a single block.
24-
25-
In the case of autodeposit, the deposits would be locked for around 3 windows at a time. Therefore, the total amount locked would be 30 times the amount.
26-
27-
## Withdrawal Time
28-
29-
The earliest withdrawal time can be calculated as follows: the withdrawal start time plus 20 L1 blocks (which is 240 seconds or 4 minutes) and the oracle lag of 10 L1 blocks (which is 120 seconds or 2 minutes), totaling 360 seconds or 6 minutes. Therefore, the total time before funds can be withdrawn is approximately 30 blocks (6 minutes) from the initial deposit.
30-
31-
## Deposit/Withdrawal Flow
32-
33-
<Frame>
34-
<img src="/v1.2.x/images/bidder-deposit.png" />
35-
</Frame>
36-
37-
This diagram illustrates the process and timeline of bidding, settlements, and withdrawals within mev-commit system, structured around a series of windows.
38-
39-
### Diagram Description
40-
41-
#### Timeline of Blocks
42-
43-
- The horizontal axis represents a sequence of windows.
44-
- Windows are labeled as `n-2`, `n-1`, `n` and `n+1`, indicating their position relative to the current window `n`.
45-
46-
#### Current Window
47-
48-
- The "Current Window" is the interval within which bidding occurs.
49-
- The window consists of 10 L1 blocks.
50-
51-
#### Bidding Phase
52-
53-
- Bidding occurs in the current window, starting from the current block `n` and extending into the future blocks (`n+1`, etc.).
54-
- The arrow labeled "Bidding" points to the right, indicating that bidding continues into future blocks.
55-
56-
#### Settlements Phase
57-
58-
- Settlements happen after the bidding window closes.
59-
- The arrow labeled "Settlements" points downward, showing the transition from the bidding phase to the settlement phase.
60-
61-
#### Withdrawals Phase
62-
63-
- Withdrawals occur after settlements are completed.
64-
- The arrow labeled "Withdrawals" points to the left, indicating the final phase where bidders can withdraw their remaining funds.
18+
A target deposit is the desired amount of funds that a bidder wants to be deposited for a specific provider. Bidders should set this to the maximum cumulative amount of ETH they would ever bid to a provider with respect to a single L1 block.

v1.2.x/developers/bidder-api/bidder-deposit.mdx

Lines changed: 109 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,33 @@ title: "Managing Your Bidder Deposit"
33
sidebarTitle: Managing Your Bidder Deposit
44
---
55

6-
**To Check Your Deposit for current window:**
6+
**To check your deposit for a specific provider**
77

88
```shell
9-
> curl localhost:13523/v1/bidder/get_deposit | jq
9+
> curl -s "http://localhost:13523/v1/bidder/get_deposit?provider=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" | jq
1010
{
1111
"amount": "0",
12-
"windowNumber": 1
12+
"provider": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
1313
}
1414
```
1515

16-
**To Check Your Deposit for a specific window:**
16+
**To check deposits for all providers and get bidder EOA balance**
1717

1818
```shell
19-
> curl localhost:13523/v1/bidder/get_deposit?window_number=1 | jq
19+
> curl -s "http://localhost:13523/v1/bidder/get_all_deposits" | jq
2020
{
21-
"amount": "0",
22-
"windowNumber": 1
21+
"deposits": [
22+
{
23+
"provider": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
24+
"amount": "3000000000000000000"
25+
}
26+
],
27+
"bidderBalance": "9996999791340641239011"
2328
}
2429
```
2530

26-
**Funding Your Node Account:**
31+
**Funding your node account**
32+
2733
First, retrieve the Ethereum account address of your node:
2834

2935
```shell
@@ -49,52 +55,124 @@ sidebarTitle: Managing Your Bidder Deposit
4955
}
5056
```
5157

52-
To add funds to your account on the mev-commit chain, you may use the [bridge](/v1.2.x/getting-started/bridge).
58+
To add funds to your bidder EOA on the mev-commit chain, you may use the [bridge](/v1.2.x/get-started/bridge).
5359

60+
**Automate depositing - The easy way**
5461

55-
- **Adding to Your Deposit:**
62+
It's recommended that bidders leverage the _deposit manager_ to deposit, and automate ongoing re-deposits to specific providers.
5663

57-
To increase your deposit for the current window, use the following command, specifying the desired amount:
64+
The deposit manager is an on-chain contract that a bidder account can enable by "setting their code" to the implementation using EIP-7702. After enabling the deposit manager, a bidder's deposits are automatically replenished from the bidder's EOA balance during the preconf settlement process, according to _target deposit_ amounts configured by the bidder.
65+
66+
The easiest way to enable the deposit manager is by setting two flags/environment variables upon starting your bidder node:
5867

5968
```shell
60-
> curl -X POST localhost/v1/bidder/deposit/YOUR_AMOUNT | jq
69+
> ./mev-commit --enable-deposit-manager=true --target-deposit-amount=<amount>
6170
```
6271

63-
To increase your deposit for the specific window, use the following command, specifying the desired amount and window number:
72+
Where the target deposit amount will be set for all valid providers that're currently a part of the network. Alternatively you can use the `MEV_COMMIT_ENABLE_DEPOSIT_MANAGER` and `MEV_COMMIT_TARGET_DEPOSIT_AMOUNT` environment variables.
73+
74+
**Automate depositing - Through API**
75+
76+
To enable the deposit manager through API, use the following command:
6477

6578
```shell
66-
> curl -X POST "localhost/v1/bidder/deposit/YOUR_AMOUNT" \
67-
-H "Content-Type: application/json" \
68-
-d '{
69-
"window_number": 1
70-
}' | jq
79+
> curl -s -X POST http://localhost:13523/v1/bidder/enable_deposit_manager | jq
80+
{
81+
"success": true
82+
}
83+
```
84+
85+
Then to set target deposits customized to each provider:
86+
87+
```shell
88+
> curl -s -X POST http://localhost:13523/v1/bidder/set_target_deposits -H 'Content-Type: application/json' -d '{"target_deposits":[{"provider":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","target_deposit":"3000000000000000000"}]}' | jq
89+
{
90+
"successfullySetDeposits": [
91+
{
92+
"provider": "3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
93+
"targetDeposit": "3000000000000000000"
94+
}
95+
],
96+
"successfullyToppedUpProviders": [
97+
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
98+
]
99+
}
71100
```
72101

73-
To increase your deposit for the specific L1 block number, use the following command, specifying the desired amount and L1 block number:
102+
**Manually adding to your deposit**
103+
104+
If you'd like to manually increase the deposit for a provider, use the following command, specifying the desired amount:
74105

75106
```shell
76-
> curl -X POST "localhost/v1/bidder/deposit/YOUR_AMOUNT" \
77-
-H "Content-Type: application/json" \
107+
> curl -s -X POST "http://localhost:13523/v1/bidder/deposit/1000000000000000000?provider=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" | jq
108+
{
109+
"amount": "1000000000000000000",
110+
"provider": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
111+
}
112+
```
113+
114+
To manually deposit evenly to multiple providers, use the following command:
115+
116+
```shell
117+
> curl -s -X POST "http://localhost:13523/v1/bidder/deposit_evenly?total_amount=2000000000000000000&providers=0x8F644015Aa59984BF849259375d9135A89a940e7&providers=0x353ff5537cc2fe78C8632c41Bb848735C2982c45" | jq
118+
{
119+
"providers": [
120+
"8f644015aa59984bf849259375d9135a89a940e7",
121+
"353ff5537cc2fe78c8632c41bb848735c2982c45"
122+
],
123+
"amounts": [
124+
"1000000000000000000",
125+
"1000000000000000000"
126+
]
127+
}
128+
```
129+
130+
After successfully depositing, you are ready to send bids and receive preconfirmations on the network.
131+
132+
**Withdrawing from your deposit**
133+
134+
To withdraw funds from your deposit to a specific provider, use the following command:
135+
136+
```shell
137+
> curl -s -X POST http://localhost:13523/v1/bidder/request_withdrawals \
138+
-H 'Content-Type: application/json' \
78139
-d '{
79-
"block_number": 1,
140+
"providers": [
141+
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
142+
]
80143
}' | jq
144+
{
145+
"providers": [
146+
"3c44cdddb6a900fa2b585dd299e03d12fa4293bc"
147+
],
148+
"amounts": [
149+
"3000000000000000000"
150+
]
151+
}
81152
```
82-
After successfully adding to your deposit, you are ready to send bids and receive preconfirmations on the network.
83-
84-
- **Withdrawing from Your Deposit:**
85153

86-
To withdraw funds from your deposit, use the following command:
154+
Then you must wait the withdrawal period to elapse, currently ~10 minutes. Then finally call:
87155

88156
```shell
89-
> curl -X POST localhost/v1/bidder/withdraw \
90-
-H "Content-Type: application/json" \
157+
curl -s -X POST http://localhost:13523/v1/bidder/withdraw \
158+
-H 'Content-Type: application/json' \
91159
-d '{
92-
"window_number": 1
160+
"providers": [
161+
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
162+
]
93163
}' | jq
164+
{
165+
"providers": [
166+
"3c44cdddb6a900fa2b585dd299e03d12fa4293bc"
167+
],
168+
"amounts": [
169+
"3000000000000000000"
170+
]
171+
}
94172
```
95-
If you don't specify a window number, the current window will be used by default.
96173

97-
### Outcome of Preconfirmed Bids:
174+
### Outcome of preconfirmed bids
175+
98176
When a bid is preconfirmed by a provider, there are several possible outcomes:
99177

100178
| Outcome Matrix | Provider Wins Slot Auction| Provider Loses Slot Auction |

v1.2.x/get-started/bidders/best-practices.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ The `decayStartTimestamp` and `decayEndTimestamp` are important components for h
5757
## Troubleshooting
5858
Bidders will start receiving commitments instantly in most cases. If you're having trouble receiving commitments, check your bid parameters and ensure your bid is high enough for the commitment you're requesting. Additionally check that you are connected to providers (via the [topology endpoint](https://docs.primev.xyz/v1.2.x/get-started/bidders/bidder-node-commands#topology)) and that you are receiving mev-commit events (via the [health endpoint](https://docs.primev.xyz/v1.2.x/get-started/bidders/bidder-node-commands#health)).
5959

60-
## Bidder Funds and Autodeposit Window
60+
## Bidder Depositing
6161

62-
Bidders on mev-commit need funds available in their account to submit bids, which can be obtained via bridging to your wallet address and then depositing to your node address. For testnet, you can obtain funds by using the [bridge](/v1.2.x/get-started/bridge). Once funds are deposited, the auto deposit function will automatically deposit funds into your account for the next 3 [windows](/v1.2.x/concepts/bids/bidder-deposit) to bid. Unused funds will automatically transfer into upcoming windows for bidding. You can read more about the auto deposit feature [here](https://docs.primev.xyz/v1.2.x/get-started/bidders/bidder-node-commands#autodeposit-funds).
62+
Bidders on mev-commit need to be funded with ETH which can be obtained via [bridging](/v1.2.x/get-started/bridge). Then a bidder must deposit toward one or more providers. To automate this process, the bidder can enable the deposit manager and set target deposits for each provider. Read more about the deposit manager [here](https://docs.primev.xyz/v1.2.x/get-started/bidders/bidder-node-commands#deposit-manager).
6363

64-
<!-- ## (Optional) Provider RPCs
64+
{/* ## (Optional) Provider RPCs
6565
6666
If you don't send transaction payloads in your bid, you can send your transactions directly to block builders. Below is a table of Provider RPCs to send your transactions to on testnet. You may already be sending transactions to these providers if you have existing transaction operations.
6767
@@ -84,6 +84,6 @@ If you don't send transaction payloads in your bid, you can send your transactio
8484
<td>[rpc.titanbuilder.xyz](https://rpc.titanbuilder.xyz/)</td>
8585
</tr>
8686
</tbody>
87-
</table> -->
87+
</table> */}
8888

8989

0 commit comments

Comments
 (0)