2

I'm setting up a private chain between two VMs.

The first node started mining successfully, and the connetion between the two VMs has no problem.

But when I try to connect the second node to the first, I got this error:

DEBUG[05-08|09:21:11] Ethereum handshake failed
id=e8d86dae37655a1b conn=dyndial err="Genesis block mismatch - dfc3e94e54007bba (!= 573969da5d11c81a)"

I copied the genesis.json file from the first node to the second, how can they mismatch?

The command I used to start the first node is:

geth --identity nodeBcDev1 --nodiscover --networkid 9191 --port 60830 --maxpeers 5 --lightkdf --cache 512 --rpc --rpccorsdomain "*" --datadir "C:\BlockChain\Data" --minerthreads 2 --mine

The command to connect from the second node:

geth --networkid 9191 --port 60830 --rpc --rpcport 8545 --rpccorsdomain "*" --datadir "C:\BlockChain\Data" --minerthreads 2 --bootnodes "enode://41cc17dydeefide8018c39054653d638430c3abfe3f77g009dc9294h0e8a9d62a5b819fb5810391fddab560d4c1bf9d1c9b110c6fbe603731388a993751bd95e@10.0.0.1:60830" --verbosity 4

Finally, the genesis.json file:

{
    "nonce"         : "0x0000000000000055",
    "mixHash"       : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "parentHash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty"    : "0x1",
    "gasLimit"  : "0x800000",
    "timestamp" : "0x0",
    "extraData" : "",
    "coinbase"  : "0x0000000000000000000000000000000000000000",
    "alloc"         : {},
    "config"    : {
        "chainId": 9191,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

My client id matches the network id, and I know the connection was successful because the lines above the handshake failure was:

DEBUG[05-08|09:21:11] Ethereum peer connected                  id=df887467936a7c9b conn=dyndial name=Geth/v1.8.0-unstable/linux-amd64/go1.9.4

Really confused.....

5
  • values of port and rpcport will be different on both node, network id will be the same
    – Aniket
    Commented May 8, 2018 at 9:42
  • @A.K., my two nodes are on two different VMs, do port and rpcport have to be different? Commented May 8, 2018 at 9:46
  • not in that case, Just check whether node1 is externally accessible, try to put --rpcaddr "0.0.0.0"
    – Aniket
    Commented May 8, 2018 at 9:51
  • @A.K., I can ping the first node from the second node after I enabled pinging on first node Commented May 8, 2018 at 9:54
  • just login to the console of both nodes and do eth.getBlock(0) if the Hash` field is different, then you screw it somewhere in initializing the genesis block. First use init command to initialize both nodes with the correct genesis block, and then start the nodes
    – Nulik
    Commented May 11, 2018 at 22:21

3 Answers 3

1

This is common issue for setting up local network. There are major four issues can stop syncing blocks.

  1. Mismatching genesis block.
  2. Didn't added boot node.
  3. Network id is mismatch.
  4. Unable to access node system

    How to check your genesis block is same for two or more nodes?

    Type below command in your geth consle.

    > admin.nodeInfo.protocols.eth.genesis

    0x981XXXXXXXXXXXxxxxxxxxXXXXXXXxxxxxXXXXxxxxXXXXXxxxXXx Join two nodes two genesis file should match. If its not matched geth node will reject connect, because of replay attack. i.e you need to init your nodes with same genesis.json. Please don't edit genesis.json

    --nodiscover:

    When you use this option your node will not be exposed to outside system to scan. Then how to add this node to an other node, use --bootnodes or admin.addPeer('');

    Network id is mismatch

    While running your geth node your network id may be mismatch, or you may forgot to add. use --networkid at time of geth command.

    Unable to access node system

    Due to some network firewalls settings, your port is not accessible. Like AWS you need to add tcp port to be enabled for EC2 instance.

For more details please refer below link: https://medium.com/mercuryprotocol/how-to-create-your-own-private-ethereum-blockchain-dad6af82fc9f

2
  • 1, definitely the same genesis block; 2, this is set; 3, same network id; 4, I've opened the port on Azure VMs. Do the port and rpcport have to be different? The two nodes are on different VMs (but same private network) Commented May 8, 2018 at 11:47
  • Use different ports via --port command and make sure said port is accurately reflected when referencing as enode. Commented May 9, 2018 at 0:01
0

The same problem I resolved with

$ geth init genesis.json

before starting node.

1
  • Just remark to the genesis.json file MUST be identical in all nodes.
    – Magno C
    Commented Aug 16, 2023 at 17:19
0

I'm having similar issues also creating my own devnet. I start up my first node and then the second, I witness something really weird where I have a pre-defined genesis file but this one gets modified once initialized, but the modification is different on both and I get a mismatch. Does anyone have any clue how to solve this im ded

2
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
    – 0xSanson
    Commented Oct 10, 2023 at 9:03
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 12, 2023 at 16:30

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.