5

As we know , Bitcoin core-Regtest is used to set up our own blockchain starting from Genesis Block. I have created Two nodes on my localhost running on different ports (I am using Windows 8.1). They are connected to each other. Now I want to increase the difficulty level and create mining competition between two nodes.

I can manually use generate Number_of_blocks to mine that many Number_of_blocks on any node and It also includes my recent transactions which are not yet included in the blockchain while mining.

But how can have such an arrangement in which I will increase difficulty and start mining on both the nodes, and whoever comes first will broadcast the block and win the race.??

Any reference or step by step explanation would be much appreciated

1 Answer 1

1

Previous versions of bitcoin core included a miner, and you could use the RPC call setgenerate to activate it. However, this functionallity was removed on Bitcoin Core v0.13.0. In any case, this does does not seem to work on regtest (I have tried it with v0.11.1 and it returns a message saying to use generate instead).

Whenever I need to "simulate" nodes competing to mine in a regtest network, I define their mining power and randomly select which one of them is going to mine taking into account their defined mining power. Then, I send a generate 1 RPC call to the miner that has been selected.

2
  • Yes but how would I define mining power of a node in the software bitcoin core? And how would send generate 1 RPC call to selected miner? Commented Mar 5, 2018 at 8:25
  • @DOLLYPATWA you answered your own question, you would use the rpc interface and send a generate 1 block call to it.
    – PW Kad
    Commented Oct 14, 2018 at 16:31

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.