0

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

  • values of port and rpcport will be different on both node, network id will be the same – Aniket May 8 '18 at 9:42
  • @A.K., my two nodes are on two different VMs, do port and rpcport have to be different? – Allen Zhang May 8 '18 at 9:46
  • not in that case, Just check whether node1 is externally accessible, try to put --rpcaddr "0.0.0.0" – Aniket May 8 '18 at 9:51
  • @A.K., I can ping the first node from the second node after I enabled pinging on first node – Allen Zhang May 8 '18 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 May 11 '18 at 22:21
0

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

  • 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) – Allen Zhang May 8 '18 at 11:47
  • Use different ports via --port command and make sure said port is accurately reflected when referencing as enode. – blockstreetboi89 May 9 '18 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.