Are there any methods other than RPC command invalidateblock <hash> for creating forks?
I know that forks occur when two miners (nearly) simultanously each generate a block for a previous common block but is this the only natural way to fork the blockchain?

I want to test blockchain forks with multiple nodes and would like to have one node intentionally create forks from time to time. How can I achieve this?
Do I need to make all nodes generate blocks simultanously and hope that randomly two or more blocks are created at the same time? - This would lead to a mess, right?

  • I'm guessing that you're trying to test how your software handles arbitrarily large reorgs, right? Have you tried splitting your network into A and B, and disconnecting them from each other to create a fork?
    – Nick ODell
    Jun 16, 2015 at 16:17
  • @NickODell: I'm more interested in testing selfish mining in regtest. I want to fork the blockchain again after reorganisation in an automated fashion so everytime selfish mining fails OR wins a round of 'race' ,the blockchain is forked again to start a new selfish mine attack. Splitting is not a solution i guess since at least the selfish miner has to watch honest miners actions in order to react according to selfish mine algorithm so they need to stay connected. Jun 16, 2015 at 17:32


Your Answer

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

Browse other questions tagged or ask your own question.