3

I'm trying to do cpu mining on testnet to debug coinbase transactions in my application.

Tried running GUI miner, I get the below output:

2014-07-31 11:31:51: Running command: poclbm.exe testnetuser:test123456@localhost:18332 --device=0 --platform=0 --verbose -r1
2014-07-31 11:31:51: Listener for "Default" started
2014-07-31 11:31:53: Listener for "Default": No PyOpenCL
2014-07-31 11:31:53: Listener for "Default": Not using OpenCL
2014-07-31 11:31:53: Listener for "Default": Nothing to mine on, exiting

I tried UFASoft miner, set the listening port to 18332 but nothing happens.

What is the easiest way to do cpu mining on testnet?

Is there another way of getting coinbase transactions in my testnet wallet?

2 Answers 2

5

Even on testnet the difficulty is sufficiently high that it will take you a long time to mine anything using cpu. (Lots of people testing ASICs, presumably.)

Your best bet is probably Testnet in a box. Then you can cpu mine just by using ´setgenerate true´ in Bitcoin Core.

4
  • I thought setgenerate true option was removed. Thanks.
    – Emre K.
    Commented Aug 1, 2014 at 6:44
  • This worked for me.
    – Emre K.
    Commented Aug 1, 2014 at 8:51
  • 2
    There is now regtest mode in plain bitcoind, you don't need any additional dependency. Using regtest you have a private blockchain and using generate method you mine instantly.
    – jangorecki
    Commented Aug 28, 2015 at 18:04
  • 1
    @jangorecki: That comment should rather be an answer. :)
    – Murch
    Commented Apr 25, 2016 at 18:38
2

Testnet has a special rule, which makes it easy to mine in particular circumstances. If there are no blocks found for more than 20 minutes, the difficulty drops and you can easily mine a testnet block with a normal CPU. Obviously your luck depends on if other powerful miners are mining or not, so sometimes you will find more blocks in a week, sometimes no block for months.

Heck, you can even mine with bitcoin-cli:

while [ 1 ]
do
    bitcoin-cli generatetoaddress 1 "2N5fJkfCv4cF6vsa5QQJnsazBKWNXynn9zp" 10000000
done

For example, I found 6 blocks in less than 2.5 months, but your luck depends on the activity of other miners.

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.