Skip to content
You are reading Hyperledger Besu development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.
Date of last update: August 18, 2022

Start Besu

Nodes can connect to Ethereum Mainnet and public testnets.

Use the besu command with the required command line options to start a node. Alternatively, use the launcher to start Besu interactively with the most common options.

Prerequisites

Besu installed

Local block data

When connecting to a network other than the network previously connected to, you must either delete the local block data or use the --data-path option to specify a different data directory.

To delete the local block data, delete the database directory in the besu/build/distribution/besu-<version> directory.

Genesis configuration

Besu specifies the genesis configuration, and sets the network ID and bootnodes when connecting to Goerli, Sepolia, and Mainnet.

Important

The Ropsten, Rinkeby, and Kiln testnets are deprecated.

When you specify --network=dev, Besu uses the development mode genesis configuration with a fixed low difficulty. A node started with --network=dev has an empty bootnodes list by default.

The genesis files defining the genesis configurations are in the Besu source files.

To define a genesis configuration, create a genesis file (for example, genesis.json) and specify the file using the --genesis-file option.

Syncing and storage

By default, Besu syncs to the current state of the blockchain using fast sync in:

  • Networks specified using --network except for the dev development network.
  • Ethereum Mainnet.

We recommend using snap sync for a faster sync, by starting Besu with --sync-mode=X_SNAP.

By default, Besu stores data in the Forest of Tries format. We recommend using Bonsai Tries for lower storage requirements, by starting Besu with --data-storage-format=BONSAI.

Confirm node is running

If you started Besu with the --rpc-http-enabled option, use cURL to call JSON-RPC API methods to confirm the node is running.

Example

  • eth_chainId returns the chain ID of the network.

    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
    

    For example, after connecting to Mainnet, eth_syncing will return something similar to:

    {
      "jsonrpc" : "2.0",
      "id" : 1,
      "result" : {
        "startingBlock" : "0x0",
        "currentBlock" : "0x2d0",
        "highestBlock" : "0x66c0"
      }
    }
    

Run a node for testing

To run a node that mines blocks at a rate suitable for testing purposes:

besu --network=dev --miner-enabled --miner-coinbase=0xfe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-http-cors-origins="all" --host-allowlist="*" --rpc-ws-enabled --rpc-http-enabled --data-path=/tmp/tmpDatdir

You can also use the following configuration file on the command line to start a node with the same options as above:

network="dev"
miner-enabled=true
miner-coinbase="0xfe3b557e8fb62b89f4916b721be55ceb828dbd73"
rpc-http-cors-origins=["all"]
host-allowlist=["*"]
rpc-ws-enabled=true
rpc-http-enabled=true
data-path="/tmp/tmpdata-path"

Caution

The following settings are a security risk in production environments:

Run a node on Goerli testnet

To run a node on Goerli specifying a data directory:

besu --network=goerli --data-path=<path>/<goerlidata-path>

Where <path> and <goerlidata-path> are the path and directory to save the Goerli chain data to.

Run a node on Sepolia testnet

To run a node on Sepolia specifying a data directory:

besu --network=sepolia --data-path=<path>/<sepoliadata-path>

Where <path> and <sepoliadata-path> are the path and directory to save the Sepolia chain data to.

Run a node on Ethereum Mainnet

To run a node on the Ethereum Mainnet:

besu

To run a node on Mainnet with the HTTP JSON-RPC service enabled and available for localhost only:

besu --rpc-http-enabled

Besu launcher

Use the Besu launcher to interactively configure and start a node with the most common options. The launcher asks a series of questions and generates a configuration file.

To run the Besu launcher:

besu --Xlauncher

Answer each question, or press ++Enter++ to accept the default value.

? Which Ethereum network would you like to use ? goerli
? Which synchronization mode? fast
? Do you want to enable pruning? no
? What is the data directory ? /Users/me/besu
? Do you want to enable the JSON-RPC HTTP service ? yes
? Do you want to configure the JSON-RPC options now ? yes
? What is the JSON RPC HTTP host address ? 127.0.0.1
? What is the JSON RPC HTTP port ? 8545
? Select the list of APIs to enable on JSON-RPC HTTP service [eth, net, web3]
? Do you want to enable the JSON-RPC Websocket service ? no
? Do you want to enable GraphQL functionality ? no
? Do you want to use Ethstats ? no
? Do you want to enable NAT ? no
? Do you want to enable mining ? no

If a configuration file is already present in the directory where the command is executed, Besu will start and use the values in the configuration file. To force the launcher to interact during a restart, use the --Xlauncher-force option, or delete the configuration file.