|
| 1 | +# Run node on Sepolia |
| 2 | + |
| 3 | +1. Run a op-besu |
| 4 | + |
| 5 | +pull docker image: |
| 6 | + |
| 7 | +```shell |
| 8 | +docker pull ghcr.io/optimism-java/op-besu:latest |
| 9 | +``` |
| 10 | + |
| 11 | +create a directory that will be used later: |
| 12 | + |
| 13 | +```shell |
| 14 | +mkdir data_sepolia |
| 15 | +``` |
| 16 | + |
| 17 | +generate a jwt key, it will also be used by hildr: |
| 18 | + |
| 19 | +```shell |
| 20 | +openssl rand -hex 32 > jwt.txt |
| 21 | +``` |
| 22 | + |
| 23 | +run a op-besu by docker: |
| 24 | + |
| 25 | +```shell |
| 26 | +docker run -d -it --name op-besu -p 8545:8545 -p 8551:8551 -v ./jwt.txt:/jwt/jwtsecret \ |
| 27 | +-v ./data_sepolia:/data/ \ |
| 28 | +ghcr.io/optimism-java/op-besu:latest \ |
| 29 | +--network=OP_SEPOLIA \ |
| 30 | +--p2p-enabled=false \ |
| 31 | +--sync-mode=FULL \ |
| 32 | +--discovery-enabled=false \ |
| 33 | +--data-path="/data/" \ |
| 34 | +--engine-rpc-enabled \ |
| 35 | +--engine-jwt-secret="/jwt/jwtsecret" \ |
| 36 | +--rpc-http-enabled \ |
| 37 | +--host-allowlist="*" \ |
| 38 | +--engine-host-allowlist="*" \ |
| 39 | +--logging=INFO \ |
| 40 | +--version-compatibility-protection=false |
| 41 | +``` |
| 42 | + |
| 43 | +Sometimes docker could be running under the root user, it may throw some exception logs like below: |
| 44 | + |
| 45 | +```shell |
| 46 | +java.io.FileNotFoundException: /data/VERSION_METADATA.json (Permission denied) |
| 47 | + at java.base/java.io.FileOutputStream.open0(Native Method) |
| 48 | + at java.base/java.io.FileOutputStream.open(FileOutputStream.java:289) |
| 49 | + at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:230) |
| 50 | + at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:179) |
| 51 | + at com.fasterxml.jackson.core.TokenStreamFactory._fileOutputStream(TokenStreamFactory.java:334) |
| 52 | + at com.fasterxml.jackson.core.JsonFactory.createGenerator(JsonFactory.java:1547) |
| 53 | + at com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1257) |
| 54 | + at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3980) |
| 55 | + at org.hyperledger.besu.ethereum.core.VersionMetadata.writeToDirectory(VersionMetadata.java:71) |
| 56 | + at org.hyperledger.besu.ethereum.core.VersionMetadata.versionCompatibilityChecks(VersionMetadata.java:119) |
| 57 | + at org.hyperledger.besu.cli.BesuCommand.run(BesuCommand.java:1114) |
| 58 | + at picocli.CommandLine.executeUserObject(CommandLine.java:2026) |
| 59 | + at picocli.CommandLine.access$1500(CommandLine.java:148) |
| 60 | + at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461) |
| 61 | + at picocli.CommandLine$RunLast.handle(CommandLine.java:2453) |
| 62 | + at picocli.CommandLine$RunLast.handle(CommandLine.java:2415) |
| 63 | + at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273) |
| 64 | + at picocli.CommandLine$RunLast.execute(CommandLine.java:2417) |
| 65 | + at picocli.CommandLine.execute(CommandLine.java:2170) |
| 66 | + at org.hyperledger.besu.cli.BesuCommand.lambda$createExecuteTask$1(BesuCommand.java:1041) |
| 67 | + at picocli.CommandLine.execute(CommandLine.java:2170) |
| 68 | + at org.hyperledger.besu.cli.BesuCommand.lambda$createPluginRegistrationTask$2(BesuCommand.java:1051) |
| 69 | + at picocli.CommandLine.execute(CommandLine.java:2170) |
| 70 | + at org.hyperledger.besu.cli.util.ConfigDefaultValueProviderStrategy.execute(ConfigDefaultValueProviderStrategy.java:58) |
| 71 | + at picocli.CommandLine.execute(CommandLine.java:2170) |
| 72 | + at org.hyperledger.besu.cli.BesuCommand.executeCommandLine(BesuCommand.java:1078) |
| 73 | + at org.hyperledger.besu.cli.BesuCommand.parse(BesuCommand.java:1020) |
| 74 | + at org.hyperledger.besu.Besu.main(Besu.java:41) |
| 75 | +/data/VERSION_METADATA.json (Permission denied) |
| 76 | +``` |
| 77 | + |
| 78 | +Just need to modify the access permissions of `data_sepolia` to fix it: |
| 79 | + |
| 80 | +```shell |
| 81 | +sudo chmod 777 data_sepolia -R |
| 82 | +``` |
| 83 | + |
| 84 | +2. Run a hildr |
| 85 | + |
| 86 | +pull docker image: |
| 87 | + |
| 88 | +```shell |
| 89 | +docker pull ghcr.io/optimism-java/hildr:latest |
| 90 | +``` |
| 91 | + |
| 92 | +get IP of the op-besu container, and hildr container will use it to connect to op-besu via the docker bridge: |
| 93 | + |
| 94 | +```bash |
| 95 | +docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' op-besu |
| 96 | +``` |
| 97 | + |
| 98 | +run a hildr node: |
| 99 | + |
| 100 | +```bash |
| 101 | +docker run -d -it --name hildr -p 11545:11545 \ |
| 102 | +-v ./jwt.txt:/jwt/jwt.txt \ |
| 103 | +ghcr.io/optimism-java/hildr:latest \ |
| 104 | +--network optimism-sepolia \ |
| 105 | +--jwt-file /jwt/jwt.txt \ |
| 106 | +--l1-rpc-url <l1_sepolia_rpc_url> \ |
| 107 | +--l1-ws-rpc-url <l1_sepolia_ws_rpc_url> \ |
| 108 | +--l1-beacon-url <l1_beacon_chain_sepolia_rpc_url> \ |
| 109 | +--l2-rpc-url <op_besu_rpc> \ |
| 110 | +--l2-engine-url <op_besu_engine_rpc> \ |
| 111 | +--rpc-port 11545 \ |
| 112 | +--log-level INFO \ |
| 113 | +--sync-mode full |
| 114 | +``` |
| 115 | + |
| 116 | +The synchronization needs to handle empty messages at the beginning, and the actual block synchronization will take place about 10 minutes later. |
| 117 | + |
| 118 | +Use curl get block data from op-besu: |
| 119 | + |
| 120 | +```bash |
| 121 | +curl --request POST 'https://localhost:8545' \ |
| 122 | +--header 'Content-Type: application/json' \ |
| 123 | +--data-raw '{"id":2, "jsonrpc":"2.0", "method": "eth_getBlockByNumber", "params":["0xe", true]}' |
| 124 | +``` |
| 125 | + |
| 126 | +You can confirm whether the block and transaction information is correct through the Sepolia network's blockchain explorer. |
0 commit comments