Go-ethereum: Cannot start and stop the miner after connect using Geth attach

Created on 1 Jul 2018  ·  4Comments  ·  Source: ethereum/go-ethereum

Hi ,

System information

Geth version: geth version
Geth
Version: 1.8.11-stable
Git Commit: dea1ce052a10cd7d401a5c04f83f371a06fe293c
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Operating System: windows

Expected behaviour

Run the command below:
geth attach http://127.0.0.1:8545

Welcome to the Geth JavaScript console!

instance: Geth/v1.8.11-stable-dea1ce05/windows-amd64/go1.10.2
coinbase: 0x785297738c9d541bd063e94a70a77d2d6dc8b26a
at block: 81 (Sun, 01 Jul 2018 17:56:19 CST)
modules: eth:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0

Run the command to miner.stop() , expected to stop the miner

Actual behaviour

it shows the error below
ReferenceError: 'miner' is not defined
at :1:1

Most helpful comment

The miner namespace is not exposed on the HTTP interface. Either attach via IPC, or you can explicitly change the APIs exposed over HTTP via the --rpcapi flag.

All 4 comments

The miner namespace is not exposed on the HTTP interface. Either attach via IPC, or you can explicitly change the APIs exposed over HTTP via the --rpcapi flag.

Gettign the same error even after exposing miner via --rpcapi flag.

below is the command i used to run Geth
geth --testnet --datadir="C:\EthereumTestnetDataDir" --syncmode "fast" --rpc –-rpcaddr “localhost” --rpcport "8545" --rpcapi "db,eth,net,web3,personal,miner,admin,txpool,debug" --identity "node1" --rpccorsdomain "*" --verbosity 3 console

SOLVED

@userid2018 @marvelsteve
Try running the node in geth --unlock geth-address--syncnode "fast" in a separate terminal. Once you're done running this open up a new terminal and write this command - geth --exec='eth.coinbase' attach ipc:/home/.ethereum/geth.ipc.
This will show the assigned coinbase account and then you can inititate mining using - geth --exec='miner.start()' attach ipc:/home/.ethereum/geth.ipc

The miner namespace is not exposed on the HTTP interface. Either attach via IPC, or you can explicitly change the APIs exposed over HTTP via the --rpcapi flag.

it worked! thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aakilfernandes picture aakilfernandes  ·  3Comments

leonzhao picture leonzhao  ·  3Comments

bgrieder picture bgrieder  ·  3Comments

freshonline picture freshonline  ·  3Comments

prene picture prene  ·  3Comments