sulenn
V2EX  ›  问与答

以太坊开发问题求教: web3.js 如何在本地的 geth 中启动 miner.start()挖矿

  •  
  •   sulenn · Jun 5, 2019 · 3146 views
    This topic created in 2550 days ago, the information mentioned may be changed or developed.

    需求:本地用 geth 启动了一个节点,然后想用 nodejs 代码的形式启动挖矿操作(不能用 console 终端交互的方式启动 miner.start())

    我自己尝试过很多方法都不行,例如:导入 “ web3-eth-miner ” 包,然后初始化连接,调用 miner.start(1).then(console.log) 命令,然后控制台报 TypeError: miner.start is not a function 的错误

    2

    本地 geth 版本为:Geth/v1.8.27-stable/linux-amd64/go1.12 web3 版本为[email protected] web3-eth-miner 版本为[email protected] 操作系统:ubuntu 18.04

    在此先谢过各位大佬了

    2 replies    2019-06-06 12:13:33 +08:00
    sulenn
        1
    sulenn  
    OP
       Jun 6, 2019
    要沉掉了。。有大佬能给点建议么?
    bluebirdv2
        2
    bluebirdv2  
       Jun 6, 2019 via Android
    geth 的启动参数是否有启用 miner api 呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2925 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 08:16 · PVG 16:16 · LAX 01:16 · JFK 04:16
    ♥ Do have faith in what you're doing.