"web3":"^1.0.0-beta.37“
"web3":"^1.0.0-beta.55“
import {Miner} from 'web3-eth-miner';然后
const options = {
defaultAccount: "0x78dB3e2129D58685444989dD9682DDDC70dd3C82",
defaultBlock: 'latest',
defaultGas: 1,
defaultGasPrice: 0,
transactionBlockTimeout: 50,
transactionConfirmationBlocks: 24,
transactionPollingTimeout: 480,
}
const miner = new Miner("http://127.0.0.1:9545", null,options);
console.log(miner); miner.start(2);miner.start()说它不是函数()..。参考文献:https://web3js.readthedocs.io/en/1.0/web3-eth-miner.html
发布于 2019-06-05 18:50:17
这将不适用于web3@1.0.0-beta.37,因为web3-eth-miner最近被添加,将web3更新为1.0.0-beta.55。
旧版本

新版本

https://ethereum.stackexchange.com/questions/71482
复制相似问题