mirror of
https://github.com/FlipsideCrypto/web3.py.git
synced 2026-02-06 10:56:47 +00:00
45 lines
1.3 KiB
Python
Executable File
45 lines
1.3 KiB
Python
Executable File
from .utils.functional import (
|
|
apply_formatters_to_return,
|
|
)
|
|
from .utils.encoding import (
|
|
to_decimal,
|
|
)
|
|
|
|
|
|
class Miner(object):
|
|
def __init__(self, web3):
|
|
self.web3 = web3
|
|
|
|
@property
|
|
@apply_formatters_to_return(to_decimal)
|
|
def hashrate(self):
|
|
return self.web3._requestManager.request_blocking("eth_hashrate", [])
|
|
|
|
def makeDAG(self, number):
|
|
return self.web3._requestManager.request_blocking("miner_makeDag", [number])
|
|
|
|
def setExtra(self, extra):
|
|
return self.web3._requestManager.request_blocking("miner_setExtra", [extra])
|
|
|
|
def setEtherBase(self, etherbase):
|
|
return self.web3._requestManager.request_blocking("miner_setEtherbase", [etherbase])
|
|
|
|
def setGasPrice(self, gas_price):
|
|
return self.web3._requestManager.request_blocking(
|
|
"miner_setGasPrice", [gas_price],
|
|
)
|
|
|
|
def start(self, num_threads):
|
|
return self.web3._requestManager.request_blocking(
|
|
"miner_start", [num_threads],
|
|
)
|
|
|
|
def stop(self):
|
|
return self.web3._requestManager.request_blocking("miner_stop", [])
|
|
|
|
def startAutoDAG(self):
|
|
return self.web3._requestManager.request_blocking("miner_startAutoDag", [])
|
|
|
|
def stopAutoDAG(self):
|
|
return self.web3._requestManager.request_blocking("miner_stopAutoDag", [])
|