Skip to main content

Configure mining (Deprecated)

caution

PoW consensus is deprecated in Besu version 24.11.0 and later. Please read this blog post for more context on the rationale behind this decision as well as alternative options.

Besu supports CPU and GPU mining, which are configured using command line options.

GPU mining tests used Ethminer with the stratum+tcp and getwork schemes.

Ethminer has been used with Besu to mine blocks on the Ropsten testnet, ETC Mainnet (uncle block only) and Mordor ETC testnet.

note
  • Some mining software supports the getwork scheme as the http scheme.
  • The Ropsten testnet is now deprecated. It transitioned to proof of stake consensus before deprecation.

Configure CPU mining

To enable CPU mining, start Besu with the following options:

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

Where <account> is the account you pay mining rewards to. For example, fe3b557e8fb62b89f4916b721be55ceb828dbd73.

Start and stop mining using the miner_start and miner_stop APIs.

Configure GPU mining

Besu supports GPU mining, tested using Ethminer with the stratum+tcp scheme.

To enable GPU mining, start Besu with the following options:

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

Where <account> is the account you pay mining rewards to. For example, fe3b557e8fb62b89f4916b721be55ceb828dbd73.

Optional command line options are:

note

Besu also supports the getwork scheme. Use the --miner-stratum-enabled option and enable the ETH RPCs.

The getwork scheme is supported as the http scheme in certain mining software.

Start and stop mining using the miner_start and miner_stop APIs.

Mining APIs

The JSON-RPC API methods for mining are:

Troubleshoot

Check block creation

On mining nodes, log messages indicate block creation.

2019-05-08 20:28:27.026+10:00 | pool-10-thread-1 | INFO  | IbftRound | Importing block to chain. round=ConsensusRoundIdentifier{Sequence=660, Round=0}, hash=0x759afaba4e923d89175d850ceca4b8ef81f7d9c727b0b0b8e714b624a4b8e8cc
2019-05-08 20:28:29.020+10:00 | pool-10-thread-1 | INFO | IbftRound | Importing block to chain. round=ConsensusRoundIdentifier{Sequence=661, Round=0}, hash=0x5443e504256765f06b3cebfbee82276a034ebcc8d685b7c3d1a6010fd4acfa14

On non-mining nodes, log messages indicate importing blocks.

2019-05-08 20:28:29.026+10:00 | EthScheduler-Workers-1 | INFO  | BlockPropagationManager | Imported #661 / 0 tx / 0 om / 0 (0.0%) gas / (0x5443e504256765f06b3cebfbee82276a034ebcc8d685b7c3d1a6010fd4acfa14) in 0.000s.
2019-05-08 20:28:31.031+10:00 | EthScheduler-Workers-0 | INFO | BlockPropagationManager | Imported #662 / 0 tx / 0 om / 0 (0.0%) gas / (0x0ead4e20123d3f1433d8dec894fcce386da4049819b24b309963ce7a8a0fcf03) in 0.000s.

To confirm the block number is increasing, use the eth_blockNumber JSON-RPC API method.

If there's no block creation in Clique or IBFT 2.0 networks, ensure the validator addresses in the genesis file match running nodes.

No mined transactions

If you add a transaction to the transaction pool and the transaction hash returns, but the transaction is never mined, check the --min-gas-price option on mining nodes. If the gasPrice on a transaction is lower than the min-gas-price for the mining node, the transaction will never mine.

In free gas networks, you must set --min-gas-price to zero.