Miner API¶
-
class
web3.miner.Miner¶
The web3.miner object exposes methods to interact with the RPC APIs under
the miner_ namespace.
Properties¶
The following properties are available on the web3.miner namespace.
-
Miner.hashrate¶ - Delegates to
eth_hashrateRPC Method
Returns the current number of hashes per second the node is mining with.
>>> web3.eth.hashrate 906
Note
This property is an alias to
web3.eth.hashrate.- Delegates to
Methods¶
The following methods are available on the web3.miner namespace.
-
Miner.makeDAG(number)¶ - Delegates to
miner_makeDagRPC Method
Generate the DAG for the given block number.
>>> web3.eth.makeDag(10000)
- Delegates to
-
Miner.setExtra(extra)¶ - Delegates to
miner_setExtraRPC Method
Set the 32 byte value
extraas the extra data that will be included when this node mines a block.>>> web3.eth.setExtra('abcdefghijklmnopqrstuvwxyzABCDEF')
- Delegates to
-
Miner.setGasPrice(gas_price)¶ - Delegates to
miner_setGasPriceRPC 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.eth.setGasPrice(19999999999)
- Delegates to
-
Miner.start(num_threads)¶ - Delegates to
miner_startRPC Method
Start the CPU mining proccess using the given number of threads.
>>> web3.eth.start(2)
- Delegates to
-
Miner.stop()¶ - Delegates to
miner_stopRPC Method
Stop the CPU mining operation
>>> web3.eth.stop()
- Delegates to
-
Miner.startAutoDAG()¶ - Delegates to
miner_startAutoDagRPC Method
Enable automatic DAG generation.
>>> web3.eth.startAutoDAG()
- Delegates to
-
Miner.stopAutoDAG()¶ - Delegates to
miner_stopAutoDagRPC Method
Disable automatic DAG generation.
>>> web3.eth.stopAutoDAG()
- Delegates to