Read this article How can I reliably induce a blockchain fork for testing purposes?.

Example from that thread is outdated, and need to be refreshed.

First my step is create initial chaindata from own genesis

geth --datadir=./1 init custom_genesis.json


    "nonce": "0",
    "difficulty": "0x20000",
    "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x",
    "gasLimit": "0x2FEFD8",
    "alloc": {},
    "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    "difficulty": "200000000",
    "gasLimit": "2100000"

which successfully created but not working when started

nohup geth --datadir=./1 --dev --nodiscover --networkid=15 --maxpeers=10 --verbosity=4 --preload ./utils.js --port=30305 --mine --minerthreads=1 > ./1/info.log 2>&1 &

and result

Fatal: Error starting protocol stack: database already contains an incompatible genesis block (have 5308cb1366d2a01a, new e5be92145a301820)

It is another problem, but question not in this point.


param forces to run app on autogenerated port, so usage of this param

--port 30304

will be ignored. So adding manually nodes via param --bootnodes or in file <datadir>/static-nodes.json will not work.

Also such param


does not exist anymore. Manually usage of admin.addPeer does not help, seems that nodes does not see each other and always answer true, even this node does not exist.( Please help anyone.

My 2 nodes runner script

nohup geth --datadir=./1 --dev --nodiscover --networkid=15 --maxpeers=10 --verbosity=4 --preload ./utils.js --port=30305 --mine --minerthreads=1 > ./1/info.log 2>&1 &

nohup geth --datadir=./2 --dev --nodiscover --networkid=15 --maxpeers=10 --verbosity=4 --preload ./utils.js --port=30306 --mine --minerthreads=1 > ./2/info.log 2>&1 &

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.