Skip to content

Commit 64a70be

Browse files
ferranbtavalonche
andauthored
Add docs on how to run Flashblocks (#331)
* Add flashblocks docs * Update docs * Update docs/flashblocks.md Co-authored-by: shana <[email protected]> --------- Co-authored-by: shana <[email protected]>
1 parent 4e3fb84 commit 64a70be

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed

docs/flashblocks.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Flashblocks
2+
3+
Flashblocks is a feature in rollup-boost that enables pre-confirmations by proposing incremental sections of blocks. This guide walks you through setting up a complete Flashblocks environment with rollup-boost, op-rbuilder, and a fallback builder.
4+
5+
## Overview
6+
7+
The setup consists of three main components:
8+
9+
- **rollup-boost**: The main service with Flashblocks enabled
10+
- **op-rbuilder**: A builder with Flashblocks support
11+
- **op-reth**: A fallback builder (standard EL node)
12+
13+
## Prerequisites
14+
15+
- Rust toolchain installed
16+
- Access to the rollup-boost and op-rbuilder repositories
17+
18+
## Setup Instructions
19+
20+
### 1. Start rollup-boost with Flashblocks
21+
22+
Launch rollup-boost with Flashblocks enabled:
23+
24+
```bash
25+
cargo run --bin rollup-boost -- \
26+
--l2-url http://localhost:5555 \
27+
--builder-url http://localhost:4445 \
28+
--l2-jwt-token 688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a \
29+
--builder-jwt-token 688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a \
30+
--rpc-port 4444 \
31+
--flashblocks \
32+
--log-level info
33+
```
34+
35+
This command uses the default Flashblocks configuration. For custom configurations, see the [Flashblocks Configuration](#flashblocks-configuration) section below.
36+
37+
### 2. Generate Genesis Configuration
38+
39+
Navigate to the op-rbuilder directory and create a genesis file:
40+
41+
```bash
42+
cd op-rbuilder
43+
cargo run -p op-rbuilder --bin tester --features testing -- genesis > genesis.json
44+
```
45+
46+
### 3. Start the op-rbuilder
47+
48+
Launch op-rbuilder with Flashblocks enabled using the generated genesis file:
49+
50+
```bash
51+
cargo run --bin op-rbuilder -- node \
52+
--chain genesis.json \
53+
--datadir data-builder \
54+
--port 3030 \
55+
--flashblocks.enabled \
56+
--disable-discovery \
57+
--authrpc.port 4445 \
58+
--authrpc.jwtsecret ./crates/op-rbuilder/src/tests/framework/artifacts/test-jwt-secret.txt \
59+
--http
60+
```
61+
62+
**Note**: The JWT token is located at `./crates/op-rbuilder/src/tests/framework/artifacts/test-jwt-secret.txt` and matches the configuration used in rollup-boost.
63+
64+
### 4. Start the Fallback Builder
65+
66+
Launch op-reth as a fallback builder:
67+
68+
```bash
69+
op-reth node \
70+
--chain genesis.json \
71+
--datadir one \
72+
--port 3131 \
73+
--authrpc.port 5555 \
74+
--disable-discovery \
75+
--authrpc.jwtsecret ./crates/op-rbuilder/src/tests/framework/artifacts/test-jwt-secret.txt
76+
```
77+
78+
This runs a standard op-reth execution layer node that serves as the fallback builder for rollup-boost.
79+
80+
### 5. Simulate the Consensus Layer
81+
82+
Use the built-in tester utility to simulate a consensus layer node:
83+
84+
```bash
85+
cargo run -p op-rbuilder --bin tester --features testing -- run
86+
```
87+
88+
## Configuration Details
89+
90+
### Port Configuration
91+
92+
- `4444`: rollup-boost RPC port
93+
- `4445`: op-rbuilder auth RPC port (matches rollup-boost builder URL)
94+
- `5555`: op-reth auth RPC port (matches rollup-boost L2 URL)
95+
- `3030`: op-rbuilder P2P port
96+
- `3131`: op-reth P2P port
97+
98+
### Flashblocks Configuration
99+
100+
rollup-boost provides several configuration options for Flashblocks functionality:
101+
102+
#### Basic Flashblocks Flag
103+
104+
- `--flashblocks`: Enable Flashblocks client (required)
105+
- Environment variable: `FLASHBLOCKS`
106+
107+
#### WebSocket Connection Settings
108+
109+
- `--flashblocks-builder-url <URL>`: Flashblocks Builder WebSocket URL
110+
111+
- Environment variable: `FLASHBLOCKS_BUILDER_URL`
112+
- Default: `ws://127.0.0.1:1111`
113+
114+
- `--flashblocks-host <HOST>`: Flashblocks WebSocket host for outbound connections
115+
116+
- Environment variable: `FLASHBLOCKS_HOST`
117+
- Default: `127.0.0.1`
118+
119+
- `--flashblocks-port <PORT>`: Flashblocks WebSocket port for outbound connections
120+
- Environment variable: `FLASHBLOCKS_PORT`
121+
- Default: `1112`
122+
123+
#### Connection Management
124+
125+
- `--flashblock-builder-ws-reconnect-ms <MILLISECONDS>`: Timeout duration if builder disconnects
126+
- Environment variable: `FLASHBLOCK_BUILDER_WS_RECONNECT_MS`
127+
- No default value specified
128+
129+
#### Example with Custom Configuration
130+
131+
```bash
132+
cargo run --bin rollup-boost -- \
133+
--l2-url http://localhost:5555 \
134+
--builder-url http://localhost:4445 \
135+
--rpc-port 4444 \
136+
--flashblocks \
137+
--flashblocks-builder-url ws://localhost:9999 \
138+
--flashblocks-host 0.0.0.0 \
139+
--flashblocks-port 2222 \
140+
--flashblock-builder-ws-reconnect-ms 5000 \
141+
--log-level info
142+
```

0 commit comments

Comments
 (0)