How to fork blockchain intentionally without RPC commands?

1

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?

Aliakbar Ahmadi

Posted 2015-06-16T15:12:05.553

Reputation: 1 415

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 – 2015-06-16T16:17:08.137

@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. – Aliakbar Ahmadi – 2015-06-16T17:32:48.740

No answers