@@ -26,7 +26,8 @@ openssl rand -hex 32 > jwt.txt
26
26
## Prepare the data directory
27
27
28
28
``` bash
29
- mkdir datadir
29
+ mkdir datadir
30
+ chmod 777 datadir
30
31
```
31
32
32
33
## Start a Op-besu node
@@ -35,10 +36,11 @@ mkdir datadir
35
36
<TabItem value =" op sepolia " label =" op sepolia " default >
36
37
37
38
``` shell
38
- docker run -it -p 8545:8545 -p 8551:8551 -v ./jwt.txt:/jwt/jwtsecret \
39
+ docker run -it --name op-besu - p 8545:8545 -p 8551:8551 -v ./jwt.txt:/jwt/jwtsecret \
39
40
-v ./datadir:/data/ \
40
41
ghcr.io/optimism-java/op-besu:latest \
41
42
--network=OP_SEPOLIA \
43
+ --sync-mode=FULL \
42
44
--p2p-enabled=false \
43
45
--discovery-enabled=false \
44
46
--data-path=" /data/" \
@@ -56,10 +58,12 @@ ghcr.io/optimism-java/op-besu:latest \
56
58
<TabItem value =" devnet or other " label =" devnet or other " >
57
59
58
60
``` shell
59
- docker run -it -p 8545:8545 -p 8551:8551 -v ./jwt.txt:/jwt/jwtsecret \
61
+ docker run -it --name op-besu-devnet - p 8545:8545 -p 8551:8551 -v ./jwt.txt:/jwt/jwtsecret \
60
62
-v ./datadir:/data/ \
61
63
ghcr.io/optimism-java/op-besu:latest \
62
64
--genesis-file=< devnet genesis file> \
65
+ --network-id=< network id> \
66
+ --sync-mode=FULL \
63
67
--p2p-enabled=false \
64
68
--discovery-enabled=false \
65
69
--data-path=" /data/" \
@@ -83,4 +87,50 @@ The following settings are a security risk in production environments:
83
87
- Setting ` --host-allowlist ` to ` "*" ` allows JSON-RPC API access from any host.
84
88
- Setting ` --rpc-http-cors-origins ` to ` "all" ` or ` "*" ` allows cross-origin resource sharing (CORS) access from any domain.
85
89
86
- :::
90
+ :::
91
+
92
+ ## Start Hildr node to sync L2 state
93
+
94
+ After starting the Op-Besu node, you can start the Hildr node to sync state.
95
+
96
+ Pull docker image of hildr:
97
+
98
+ ``` shell
99
+ docker pull ghcr.io/optimism-java/hildr:latest
100
+ ```
101
+
102
+ Get IP of the op-besu container, and hildr container will use it to connect to op-besu via the docker bridge:
103
+
104
+ ``` shell
105
+ docker inspect -f ' {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' op-besu
106
+ ```
107
+
108
+ Start Hildr node:
109
+
110
+ ``` shell
111
+ docker run -d -it --name hildr -p 11545:11545 \
112
+ -v ./jwt.txt:/jwt/jwtsecret \
113
+ ghcr.io/optimism-java/hildr:latest \
114
+ --network optimism-sepolia \
115
+ --jwt-file /jwt/jwtsecret \
116
+ --l1-rpc-url < l1_sepolia_rpc_url> \
117
+ --l1-ws-rpc-url < l1_sepolia_ws_rpc_url> \
118
+ --l1-beacon-url < l1_beacon_chain_sepolia_rpc_url> \
119
+ --l2-rpc-url < op_besu_rpc> \
120
+ --l2-engine-url < op_besu_engine_rpc> \
121
+ --rpc-port 11545 \
122
+ --log-level INFO \
123
+ --sync-mode full
124
+ ```
125
+
126
+ The synchronization needs to handle empty messages at the beginning, and the actual block synchronization will take place about 10 minutes later.
127
+
128
+ For example, use curl get block data from op-besu:
129
+
130
+ ``` bash
131
+ curl --request POST ' https://localhost:8545' \
132
+ --header ' Content-Type: application/json' \
133
+ --data-raw ' {"id":2, "jsonrpc":"2.0", "method": "eth_getBlockByNumber", "params":["0xe", true]}'
134
+ ```
135
+
136
+ You can confirm whether the block and transaction information is correct through the [ Sepolia network's blockchain explorer] ( https://sepolia-optimism.etherscan.io/ ) .
0 commit comments