Start Besu
Use the besu
command with the required command line options to start a node.
Prerequisites
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
To define a genesis configuration, create a genesis file (for example, genesis.json
) and specify the file using the --genesis-file
option.
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.
Predefined genesis configurations for named networks are in the Besu source files.
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.
-
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"
}
}