<p>Are there any methods other than RPC command <code>invalidateblock &lt;hash&gt;</code> for creating forks?<br/>
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?</p>

<p>I want to test blockchain forks with multiple nodes and would like to have one node <strong>intentionally create forks from time to time</strong>. How can I achieve this? <br/>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?</p>

CC BY-SA 3.0
2015-06-16T16:17:08.137Z
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
CC BY-SA 3.0
2015-06-16T17:32:48.740Z
@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
<json-rpc><blockchain-fork><testing><regtest><selfish-mining>
How to fork blockchain intentionally without RPC commands?
Aliakbar Ahmadi
# How to fork blockchain intentionally without RPC commands?

(Asked by: username_0 on 2015-06-16)

Are there any methods other than RPC command `invalidateblock`  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?

**Tags:** json-rpc, blockchain-fork, testing, regtest, selfish-mining

> **Comments:**
> **username_1**: 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?  
> **username_0**: @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.  

---

## 0 answers

