diff --git a/README.md b/README.md index 31601736..580f416d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,103 @@ Follow the [spec](https://github.com/ethereum-optimism/optimism/blob/develop/spe - [Rust](https://github.com/a16z/magi) - [Go](https://github.com/ethereum-optimism/optimism/tree/develop/op-node) -## Build +## System requirements +To run a `hildr-node` and `op-geth` node, at least 4C8G and 100GB of disk is required, as well as the installation of Java version 21 and Go version 1.20.8, must lower then v1.21. + +## Installing Hildr Node + +### Building `hildr-node` from source + + +Install `op-geth` via the `Makefile` in the workspace root: + +```shell +git clone git@github.com:optimism-java/hildr.git \ + cd hildr && ./gradlew build -x test +``` + +This command will generate the `hildr-node` jar file in `hildr/hildr-node/build/libs` + +## Running on Optimism Sepolia + +You will need three things to run `hildr-node`: +1. An archival L1 node, synced to the settlement layer of the OP Stack chain you want to sync (e.g. reth, geth, besu, nethermind, etc.) +2. A Optimism Execution Engine (e.g. op-geth, op-reth, op-erigon, etc.) +3. An instance of hildr-node. +For this example, we'll start a Optimism Sepolia Node. + + +### Installing a Optimism Execution Engine + +Next, you'll need to install a [Optimism L2 Execution Engine](https://github.com/ethereum-optimism/optimism/blob/develop/specs/exec-engine.md), which is the equivalent to the Execution Client on the OP Stack. +Available options include: +1. [op-geth](https://github.com/ethereum-optimism/op-geth) +2. [reth](https://github.com/paradigmxyz/reth) +3. [op-erigon](https://github.com/testinprod-io/op-erigon) + +We'll use the reference implementation of the Optimism Execution Engine maintained by OP Labs, the `op-geth`. + +The `op-geth` can be built from source or pulled from a [Docker image available on Google Cloud](https://console.cloud.google.com/artifacts/docker/oplabs-tools-artifacts/us/images/op-geth). + +We'll run it by docker image. + +### Modify `.env` file + +There has a .env.defaul file in the `./docker` directory. Copy it as `.env` and modify the fields value below: + +```toml +# Set the network value to `devnet` in the configuration. +NETWORK=optimism-sepolia + +# The HTTP RPC endpoint of an L1 node +L1_RPC_URL=https://eth-goerli.g.alchemy.com/v2/ + +# The WebSocket RPC endpoint of an L1 node +L1_WS_RPC_URL=wss://eth-goerli.g.alchemy.com/v2/ + +# JWT secret for the L2 engine API +JWT_SECRET=bf549f5188556ce0951048ef467ec93067bc4ea21acebe46ef675cd4e8e015ff + +# The exeuction client Auth RPC port. +EXECUTION_CLIENT_AUTH_RPC_PORT=5551 + +# The execution client RPC port. +EXECUTION_CLIENT_RPC_PORT=5545 + +# The execution client WebSocket port. +EXECUTION_CLIENT_WS_PORT=5546 + +``` + +### Running `hildr-node` + +First, use Docker start a `op-geth` container in hildr project root directory: + +```shell +cd ./docker && docker compose -f docker/docker-compose.yml up op-geth +``` + +Then, once op-geth has been started, start up the `hildr-node` in `hildr` project root directory: +```shell +./gradlew :hildr-node:build -x test \ + && export $(grep -v '^#' .env|xargs) \ + && nohup java --enable-preview \ + -cp hildr-node/build/libs/hildr-node-0.2.0.jar io.optimism.Hildr \ + --network optimism-sepolia \ + --jwt-secret $JWT_SECRET + --l1-rpc-url $L1_RPC_URL + --l1-ws-rpc-url $L1_WS_RPC_URL + --l2-rpc-url http://127.0.0.1:5545 \ + --l2-engine-url http://127.0.0.1:5551 \ + --rpc-port 11545 \ # Choose any available port. + --sync-mode full >l2-hildr-node.log 2>&1 & +``` + +### Running devnet + +You also can run a hildr-node on [devnet](./docs/devnet.md) + +## Build Hildr ### Prerequisites - Install [GraalVM latest version](https://www.graalvm.org/latest/docs/getting-started/) @@ -49,7 +145,7 @@ the document under the `hildr-node/build/docs/javadoc/index.html` in your browse ./gradlew test ``` -## Running +## Running from docker image Next copy `.env.default` to `.env` ```sh diff --git a/docs/sepolia.md b/docs/sepolia.md deleted file mode 100644 index ceb3b622..00000000 --- a/docs/sepolia.md +++ /dev/null @@ -1,78 +0,0 @@ -# Run a optimism sepolia node - -Almost steps same as start a devnet hildr node. - -## Get started - -### Configure OP-Geth for Hildr - -Once you have successfully started the OP devnet docker containers, proceed to the next step: launching an `op-geth` L2 instance for Hildr node. - -Download genesis json file for the `op-geth`: -```shell -wget "https://storage.googleapis.com/oplabs-network-data/Sepolia/genesis.json" -O ./genesis-l2.json -``` - -Navigate to the `hildr/docker` directory and copy the configuration: - - cp .env.default .env - -Edit the `.env` file located within the directory: - -```toml -# Set the network value to `devnet` in the configuration. -NETWORK=optimism-sepolia - -# To avoid potential conflicts with the default ports in the OP devnet, it's recommended to modify the RPC ports. - -# The exeuction client Auth RPC port. -EXECUTION_CLIENT_AUTH_RPC_PORT=5551 - -# The execution client RPC port. -EXECUTION_CLIENT_RPC_PORT=5545 - -# The execution client WebSocket port. -EXECUTION_CLIENT_WS_PORT=5546 - -# Only for `custom` or `devnet` network. -# Specify the path to the `genesis-l2.json` file generated by `op-node`. -# For the devnet configuration, this file should be located in the `.devnet` folder within the Optimism directory. -OP_GENESIS_JSON_FILEPATH= -``` - -To initiate, start the `op-geth` node: - -``` - docker-compose up op-geth -``` - -### Launch Hildr node - -Build Hildr: - -```shell - ./gradlew build -x test -``` - -Launch Hildr node: - -```shell - java \ - --enable-preview \ - -cp hildr-node/build/libs/hildr-node-0.1.0.jar io.optimism.Hildr \ - --network optimism-sepolia \ # Specify the path to the `rollup.json` file, akin to `OP_ROLLUP_JSON_FILEPATH` - --jwt-secret bf549f5188556ce0951048ef467ec93067bc4ea21acebe46ef675cd4e8e015ff \ # Replace only if altered in `.env`. - --l1-rpc-url https://eth-sepolia.g.alchemy.com/v2/ \ # This depends on the Ethereum Sepolia Chain configuration. - --l1-ws-rpc-url wss://eth-sepolia.g.alchemy.com/v2/ \ # This depends on the Ethereum Sepolia Chain configuration. - --l2-rpc-url http://127.0.0.1:5545 \ # As per the Hildr `op-geth` configuration (refer to devnet profile). - --l2-engine-url http://127.0.0.1:5551 \ # As per the Hildr `op-geth` configuration (see devnet profile). - --rpc-port 11545 \ # Choose any available port. - --sync-mode full # Other modes haven't been tested. - -``` - -Remember to adjust the parameters as necessary based on your setup and configurations. - -## Trouble shooting - -If the Hildr node stops syncing, you can restart the Hildr node. \ No newline at end of file diff --git a/hildr-node/build.gradle b/hildr-node/build.gradle index c5ed0db4..b1ef22a4 100644 --- a/hildr-node/build.gradle +++ b/hildr-node/build.gradle @@ -23,7 +23,7 @@ plugins { } group 'me.grapebaba' -version '0.1.0' +version '0.2.0' repositories { // Use Maven Central for resolving dependencies.