2

I have setup a CPU miner on ropsten testnet but when I run eth.hashrate it always returns zero. Can anyone tell me why this is? I have searched for an answer, but cannot find a satisfactory answer. I am doing this as a self learning exercise, so would really like to get this working on geth rather than using another medium

Exact setup steps were as follows

Sync ropsten blockchain

$geth --testnet --fast --cache=1024

Once the entire blockchain synced, I verified that the latest blocknumber was correct

$geth --testnet attach

eth.blockNumber

This returned the same blockNum as the the latest block number on Ropsten etherscan

I then created my first account i.e the etherbase account

$geth --testnet account new

and secured with passphrase

I then began mining with

$geth --testnet --mine

the output I get appears to be mining Console output from geth miner

However, my hashrate is always zero hashrate is zero

2 Answers 2

2

I was also mining on my private network for 30+ minutes and got 0 too.

I was also trying to figure out what's happening and found this:

https://github.com/ethereum/go-ethereum/blob/fe6cf00f480aa6347b8d55079cbe6c473482ea27/miner/miner.go#L142

It looks like the function's name is either misleading or we fall into the race case (bug).

Starting the miner and after, ether is increasing.

The screenshot from the running node's side

3
  • Hmmm, I'm not familiar with golang nor with the geth codebase. But if it's a race condition, I would have thought I would at least sometimes get a non zero result. One thing I did notice is that the return value is an integer. Could it be a resolution problem? I.e if my hashrate is KH/s and the return value of agent.GetHashRate() is specified in MH/s then the integer return value would just be rounded to zero everytime.....
    – Arran Duff
    Commented Jun 14, 2018 at 14:20
  • I guess I should have asked. Did you mine any ether on your private network while it was saying your hashrate was zero?
    – Arran Duff
    Commented Jun 14, 2018 at 14:31
  • I did not check the code thorougly, but maybe it worth sending an "Issue" to their GitHub. Yes I have mined a few thousand ethers before and meanwhile checking the restult of miner.
    – Ethernal
    Commented Jun 14, 2018 at 14:51
0

Start mining with miner.start()

You can also start and stop CPU mining at runtime using the console. miner.start takes an optional parameter for the number of miner threads.

miner.start(8) true

miner.stop() true

Another way to do the same

When you start up your ethereum node with geth it is not mining by default.
To start it in mining mode,
you can use geth --fast --cache=1024 --mine --minerthreads=8 --rpc
2
  • When you start up your ethereum node with geth it is not mining by default. To start it in mining mode,you can use geth --fast --cache=1024 --mine --minerthreads=8 --rpc Commented Jun 14, 2018 at 12:44
  • 1
    I have tried both of these already. Hashrate is still zero
    – Arran Duff
    Commented Jun 14, 2018 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.