[Ethereum] Connecting nodes in private network

go-ethereumNetworkprivate-blockchain

I have two ubuntu systems with ethereum installed. I started the node in each system using the following command : –

geth --datadir 'path of node folder' init 'path of genesis.json'
geth --datadir 'path of node folder' --networkid 12512 console

The systems are connected to a local network. The genesis file in both the systems are same. The time is in sync. But when I execute admin.addPeer("enode@ip:port"), I am getting net.peerCount as 0. There was no error while pinging the ip from one system to the other. Executing 'netstat -ntpl' gave the following:

machine 1: tcp6 0 0 :::30303 :::* LISTEN 3423/geth
machine 2: tcp6 0 0 :::30303 :::* LISTEN 3028/geth

Any help is appreciated.

Best Answer

There were two things I needed to do:

1. Turn on UPnP in my network settings.

2. 'Genesis block mismatch'. Though I had the same genesis file in both the nodes I was getting this error. So I replaced it with the following:-

{
  "nonce": "0x0000000000000042",
  "timestamp": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "extraData": "0x0",
  "gasLimit": "0x8000000",
  "difficulty": "0x400",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x3333333333333333333333333333333333333333",
  "alloc": {
   }
}

from https://souptacular.gitbooks.io/ethereum-tutorials-and-tips-by-hudson/content/private-chain.html"

This resolved the connectivity issue.

Related Topic