Miner API

The web3.geth.miner object exposes methods to interact with the RPC APIs under the miner_ namespace that are supported by the Geth client.


The following methods are available on the web3.geth.miner namespace.

  • Delegates to miner_makeDag RPC Method

Generate the DAG for the given block number.

>>> web3.geth.miner.make_dag(10000)
  • Delegates to miner_setExtra RPC Method

Set the 32 byte value extra as the extra data that will be included when this node mines a block.

>>> web3.geth.miner.set_extra('abcdefghijklmnopqrstuvwxyzABCDEF')
  • Delegates to miner_setGasPrice RPC Method

Sets the minimum accepted gas price that this node will accept when mining transactions. Any transactions with a gas price below this value will be ignored.

>>> web3.geth.miner.set_gas_price(19999999999)
  • Delegates to miner_start RPC Method

Start the CPU mining process using the given number of threads.

>>> web3.geth.miner.start(2)
  • Delegates to miner_stop RPC Method

Stop the CPU mining operation

>>> web3.geth.miner.stop()
  • Delegates to miner_startAutoDag RPC Method

Enable automatic DAG generation.

>>> web3.geth.miner.start_auto_dag()
  • Delegates to miner_stopAutoDag RPC Method

Disable automatic DAG generation.

>>> web3.geth.miner.stop_auto_dag()