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_hashrate
RPC 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_makeDag
RPC Method
Generate the DAG for the given block number.
>>> web3.miner.makeDag(10000)
- Delegates to
-
Miner.
setExtra
(extra)¶ - 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.miner.setExtra('abcdefghijklmnopqrstuvwxyzABCDEF')
- Delegates to
-
Miner.
setGasPrice
(gas_price)¶ - 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.miner.setGasPrice(19999999999)
- Delegates to
-
Miner.
start
(num_threads)¶ - Delegates to
miner_start
RPC Method
Start the CPU mining process using the given number of threads.
>>> web3.miner.start(2)
- Delegates to
-
Miner.
stop
()¶ - Delegates to
miner_stop
RPC Method
Stop the CPU mining operation
>>> web3.miner.stop()
- Delegates to
-
Miner.
startAutoDAG
()¶ - Delegates to
miner_startAutoDag
RPC Method
Enable automatic DAG generation.
>>> web3.miner.startAutoDAG()
- Delegates to
-
Miner.
stopAutoDAG
()¶ - Delegates to
miner_stopAutoDag
RPC Method
Disable automatic DAG generation.
>>> web3.miner.stopAutoDAG()
- Delegates to