8

I have a private testnet set up on my local machine:

geth --rpc --rpcaddr "localhost" --rpcport "8545" --dev --mine --datadir="~/Library/Ethereum_dev" --rpccorsdomain="http://localhost" console 2>>geth.log

It's working great.

However, I'm on a MacBook Pro 2010 which is 5.5 years old now. Geth is eating one of my CPUs and I only have two.

I tried to use nice to suppress CPU usage:

nice -n 19 geth --rpc --rpcaddr "localhost" --rpcport "8545" --dev --mine --datadir="~/Library/Ethereum_dev" --rpccorsdomain="http://localhost" console 2>>geth.log

But I'm still using way too much for my liking. Does anyone have any ideas?

9

The --mine flag using your CPU power to generate testnet blocks.

Add the --minerthreads "1" flag to limit the mining to a single core, like that:

geth --rpc --rpcaddr "localhost" --rpcport "8545" --dev --mine --minerthreads "1" --datadir="~/Library/Ethereum_dev" --rpccorsdomain="http://localhost" console 2>>geth.log

You can also control the miner from the geth console:

> miner.stop()
true
> miner.start(1)
true

... where the number is the number of threads used by the miner. You dont have to keep the miner running all the time. Just start or stop it when ever you need it to create blocks for the transaction verification.

  • This is a very useful answer for me. Thank you kindly... – Eamorr Feb 5 '16 at 19:00
  • this still uses 100% of 1 CPU, I would like to restrict miner even further - so that CPU fans dont even start on a mac – dark_ruby Aug 13 '17 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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