How to use Hyperledger Besu on Windows

Stevan Lohja
Ethereum Classic Cooperative
3 min readFeb 23, 2021

Hyperledger Besu is an enterprise Ethereum client written in Java under the Apache 2.0 license. The best installation option for Windows users is to install via binary distribution or build from source. If you must use Docker, just use Linux or MacOS for a better Docker experience.

Dependencies

Besu requires Java SDK version 11 or greater to compile.

Check Java is installed:

$ java — version 
java 15.0.2 2021–01–19 Java(TM) SE Runtime Environment (build 15.0.2+7–27) Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7–27, mixed mode, sharing)

Download and install binary

Binary releases hosted and downloadable from Bintray. View all releases. Links to binary releases are included in the release notes on Github.

  • Download and unpack the release. Rename the directory besu-<version> to simply besu and move to C:\Program Files.

C:\Program Files\besu\bin\

PATH

  • Add Besu to Path by going to View Advanced System Properties > Enviorment Variables > Add C:\Program Files\besu\bin to Path.

Now besu can be run anywhere in Powerline or Gitbash.

  • Check Besu is installed:
$ besu --version
besu/v20.10.4/windows-x86_64/oracle-java-15

UPDATE

Update Besu by replacing the older besu folder with the newer version.

METRICS

Before running a besu node, let’s set up basic metric tools to monitor the health and performance of our node.

  • Download and unpack Prometheus for Windows > Move the directory to C:\Program Files\ > As with Besu, add the Prometheus folder to your Path:
  • Check Prometheus is installed:
$ prometheus --version
  • Add the following YAML fragment to the scrape_configs block of the prometheus.yml file:
- job_name: besu
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:9545

Grafana is hosted at http://localhost:3000/ by default and initial username and password is admin:admin.

Start Besu

  • Create a start_besu.bat file with the following contents:
besu --network=classic --sync-mode=FULL --rpc-http-cors-origins="all" --host-allowlist="*" --rpc-ws-enabled --rpc-http-enabled --data-path=<PATH> --metrics-enabled

--network=classic tells Besu to start and sync the Ethereum Classic network. The default sync mode if Fast (~50 GB for Ethereum Classic mainnet), but this example, --sync-mode=FULL tells Besu to sync a full node (~ 1 TB for Ethreum Classic mainnet). --rpc-http-cors-origins="all" and --host-allowlist="*" is not recommended for production. --rpc-ws-enabled and --rpc-http-enabled enables the HTTP JSON-RPC API. Running a node downloads and syncs a copy of the blockchain. So, --data-path=<PATH> defines where we want to put our chain data. And finally, --metrics-enabled allows Prometheus to access Besu.

  • Create a start_prometheus.bat file with the following contents:
prometheus --config.file="PATH\TO\prometheus.yml"

Grafana

Grafana is a feature-rich metrics dashboard tool that can provide an overview of your Besu node. Grafana uses the Prometheus service to query the Besu data.

More metrics will populate as the node syncs to the latest block height.

API

There are a variety of methods to interact with your Besu node. See https://besu.hyperledger.org/en/stable/HowTo/Interact/APIs/API/ for more information.

--

--