Configure mining (Deprecated)
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.
- Some mining software supports the
getwork
scheme as thehttp
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:
--miner-stratum-host
to specify the host of the mining service.--miner-stratum-port
to specify the port of the mining service.
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:
miner_start
to start mining.miner_stop
to stop mining.eth_mining
to determine whether the client is actively mining new blocks.eth_getMinerDataByBlockHash
andeth_getMinerDataByBlockNumber
to get the miner data for a specified block.eth_hashrate
to get the number of hashes per second with which the node is mining. Not supported for GPU mining.eth_getWork
to get the hash of the current block, the seed hash, and the target boundary condition. Only used when using thegetwork
scheme.eth_submitWork
to submit the PoW solution. Only used when using thegetwork
scheme.
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.