How to Setup an Ethereum Classic Node on Hyperledger Besu

Stevan Lohja
Ethereum Classic Cooperative
4 min readMay 8, 2021

Hyperledger Besu is an Apache 2.0 licensed, MainNet compatible, Ethereum client written in Java. Besu allows you to run Ethereum Classic and related Testnets. Nodes allow you to download and sync the blockchain, interact with the blockchain via API, run mining nodes, and more.

Goals

  • Install and manage Besu with Docker
  • Start Besu for ETC MainNet and related TestNet
  • Start Besu as a API service and/ or mining service
  • Optional: Setup basic metrics and monitoring

System Requirements

ℹ️ More system resources will increase the download and sync performance of the Besu node.

Prerequisites

  • Docker: Docker will be used to install and manage the Besu service.
  • Storage Volume (recommended): Running a node will download and sync the blockchain. Therefore, it’s recommended to have sufficient disk space to store the persistent data of the blockchain. A mounted HDD or SSD with fast IO will have more performant results.

ℹ️ Running Besu as a docker container without mounted storage for the chain data will cause the Besu container to grow in size and restarting the Besu container could risk restarting the chain state.

Install Besu

  • Install Besu via Docker by pulling the image:
$ docker pull hyperledger/besu
  • Check the Besu image is installed:
$ docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger/besu latest 59d4d204ed23 13 days ago 326MB

Update Besu

  • To update Besu, pull the latest image or specific release tag:
$ docker pull hyperledger/besu:latest
$ docker pull hyperledger/besu:<release>

Start Besu on Ethereum Classic MainNet

ℹ️ Please read this section completely before initiating your ETC node.

  • Create a directory for the persistent data storage of the blockchain:
$ mkdir /mnt/volume/classic/
  • Start Besu to download and sync the Ethereum Classic (ETC) MainNet:
$ docker run --name classic-node -p 8545:8545 --mount type=bind,source=/mnt/volume/classic,target=/var/lib/besu hyperledger/besu \
--data-path=/var/lib/besu --network=classic --rpc-http-enabled --rpc-ws-enabled

docker run --name classic-node -p 8545:8545 --mount type=bind,source=/mnt/volume/classic,target=/var/lib/besu hyperledger/besu

The first part of the command is proprietary to Docker. We tell Docker run a container with the name classic-node, expose port 8545 for our HTTP JSON-RPC service, mount the directory we want to use for the data-path for our persistent data storage, and the image we want the container to run. The following commands and options are proprietary to Besu. We tell Besu to set the data-path for the chain to /var/lib/besu which we’ve binded to /mnt/volume/classic, set Besu to sync the Ethereum Classic network, and enabled the HTTP JSON-RPC and web socket service on localhost only.

ℹ️ By default, Besu is set to FAST sync. Set Besu to FULL sync with --sync-mode=FULL. To run the process in detached mode, add -d docker option. For example:

$ docker run --name classic-node -d -p 8545:8545 --mount type=bind,source=/mnt/volume/classic,target=/var/lib/besu hyperledger/besu \
--data-path=/var/lib/besu --network=classic --sync-mode=FULL --rpc-http-enabled --rpc-ws-enabled

Confirm node is running

  • eth_chainId returns the chain ID of the network. Ethereum Classic MainNet chainId is 61 or 0x3d is HEX format.
$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' localhost:8545
  • eth_syncing returns the starting, current, and highest block.
$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' localhost:8545

Mining

Besu supports both CPU and GPU mining.

  • Configure CPU mining by adding the following options:

--rpc-http-api=ETH,MINER --miner-enabled --miner-coinbase=<account>

  • Configure GPU mining with the following options:

--rpc-http-api=ETH,MINER --miner-enabled --miner-stratum-enabled --miner-coinbase=<account>

Optional command-line options are:

  • --miner-stratum-host to specify the host of the mining service.
  • --miner-stratum-portto specify the port of the mining service.

CORS, Host/ Domain

CORS and allowed host can be set with the following options:

--rpc-http-cors-origins="all" --host-allowlist="*"

🚨 These settings are a security risk for production environments since it exposes the RPC connection on your node to any remote connection. Set CORS and allowed host accordingly to your production environment.

Metrics

Besu supports Prometheus monitoring and alerting service to access Besu and you can use Grafana to visualize the collected data. To enabled Besu metrics add the following options:

--metrics-enabled

ℹ️ The default host and port are 127.0.0.1 and 9545. To specify host and port use --metrics-host and --metrics-port options.

Start Besu on Ethereum Classic TestNet

Besu supports ETC MainNet as well as ETC Testnets such as; Astor, Mordor, Kotti.

  • Start Besu to download and sync an ETC Testnet by setting the --network=<network> to Astor, Morder, Kotti.

ℹ️ Use a unique data directory for each network. E.g.: Use /mnt/volume/classic for ETC MainNet and /mnt/volume/astor for the Astor TestNet.

Hyperledger Besu Documentation

Visit the Besu documentation to learn more about the project and features:

--

--