[Ethereum] Private chain Ethereum handshake failed Genesis block mismatch

genesisgo-ethereumprivate-blockchain

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…..

Best Answer

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

Related Topic