Skip to content

Commit 7de4cda

Browse files
fmolettajrchatruc
andauthored
docs(l1): add quick guide on how to sync with holesky (#2485)
**Motivation** Add instructions on how to set up ethrex along with a consensus node and start syncing with holesky or other testnets <!-- Why does this pull request exist? What are its goals? --> **Description** <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #issue_number --------- Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
1 parent df4953a commit 7de4cda

File tree

1 file changed

+58
-7
lines changed

1 file changed

+58
-7
lines changed

README.md

+58-7
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ P2P options:
248248
249249
--syncmode <SYNC_MODE>
250250
Can be either "full" or "snap" with "full" as default value.
251-
251+
252252
[default: full]
253253
254254
--p2p.enabled
255-
255+
256256
257257
--p2p.addr <ADDRESS>
258258
[default: 0.0.0.0]
@@ -262,12 +262,12 @@ P2P options:
262262
263263
--discovery.addr <ADDRESS>
264264
UDP address for P2P discovery.
265-
265+
266266
[default: 0.0.0.0]
267267
268268
--discovery.port <PORT>
269269
UDP port for P2P discovery.
270-
270+
271271
[default: 30303]
272272
273273
RPC options:
@@ -285,21 +285,72 @@ RPC options:
285285
286286
--authrpc.addr <ADDRESS>
287287
Listening address for the authenticated rpc server.
288-
288+
289289
[default: localhost]
290290
291291
--authrpc.port <PORT>
292292
Listening port for the authenticated rpc server.
293-
293+
294294
[default: 8551]
295295
296296
--authrpc.jwtsecret <JWTSECRET_PATH>
297297
Receives the jwt secret used for authenticated rpc requests.
298-
298+
299299
[default: jwt.hex]
300300
```
301301
<!-- END_CLI_HELP -->
302302

303+
### Syncing with Holesky
304+
305+
#### Step 1: Set up a jwt secret for both clients
306+
307+
As an example, we put the secret in a `secrets` directory in the home folder.
308+
309+
```bash
310+
mkdir -p ~/secrets
311+
openssl rand -hex 32 | tr -d "\n" | tee ~/secrets/jwt.hex
312+
```
313+
314+
We will pass this new file’s path as an argument for both clients.
315+
316+
#### Step 2: Launch Ethrex
317+
318+
Pass holesky as a network and the jwt secret we set in the previous step.
319+
This will launch the node in full sync mode, in order to test out snap sync you can add the flag `--syncmode snap`.
320+
321+
```bash
322+
cargo run --release --bin ethrex -- --http.addr 0.0.0.0 --network holesky --authrpc.jwtsecret ~/secrets/jwt.hex
323+
```
324+
325+
#### Step 3: Set up a Consensus Node
326+
327+
For this quick tutorial we will be using lighthouse, but you can learn how to install and run any consensus node by reading their documentation.
328+
329+
You can choose your preferred installation method from [lighthouse's installation guide](https://lighthouse-book.sigmaprime.io/installation.html) and then run the following command to launch the node and sync it from a public endpoint
330+
331+
```bash
332+
lighthouse bn --network holesky --execution-endpoint http://localhost:8551 --execution-jwt ~/secrets/jwt.hex --http --checkpoint-sync-url https://checkpoint-sync.holesky.ethpandaops.io
333+
```
334+
335+
When using lighthouse directly from its repository, replace `lighthouse bn` with `cargo run --bin lighthouse -- bn`
336+
337+
Aside from holesky, these steps can also be used to connect to other supported networks by replacing the `--network` argument by another supported network and looking up a checkpoint sync endpoint for that network [here](https://eth-clients.github.io/checkpoint-sync-endpoints/)
338+
339+
If you have a running execution node that you want to connect to your ethrex node you can do so by passing its enode as a bootnode using the `--bootnodes` flag
340+
341+
Once the node is up and running you will be able to see logs indicating the start of each sync cycle along with from which block hash to which block hash we are syncing. You will also get regular logs with the completion rate and estimated finish time for state sync and state rebuild processes during snap sync. This will look something like this:
342+
343+
```bash
344+
INFO ethrex_p2p::sync: Syncing from current head 0xb5f7…bde4 to sync_head 0xce96…fa5e
345+
INFO ethrex_p2p::sync::state_sync: Downloading state trie, completion rate: 68%, estimated time to finish: 1h20m14s
346+
INFO ethrex_p2p::sync::trie_rebuild: State Trie Rebuild Progress: 68%, estimated time to finish: 1h5m45s
347+
```
348+
349+
If you want to restart the sync from the very start you can do so by wiping the database using the following command:
350+
```bash
351+
cargo run --bin ethrex -- removedb
352+
```
353+
303354
# ethrex L2
304355

305356
In this mode, the ethrex code is repurposed to run a rollup that settles on Ethereum as the L1.

0 commit comments

Comments
 (0)