0

I'm currently setting up Local Private Ethereum Network using Puppeth. And followed the steps provided in tutorial: Provisioning a Local Private Ethereum Network with Puppeth .

As per the above documentation:

7. Connect the two nodes.

console2> admin.nodeInfo.enode {ENODE-URL} 
console1> admin.addPeer({ENODE-URL})

If everything went well, net.peerCount should be 1 in both consoles.

But, below is what I'm getting:

Console 1:

myMac:console1 admin$ geth attach ipc:../node1/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.3-stable/darwin-amd64/go1.9.2
coinbase: 0xf8b09187db667abb9cb1494237e65b3e2c3373a0
at block: 0 (Wed, 10 Jan 2018 21:36:58 +04)
 datadir: /Users/admin/EtherNet/testnet/node1
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> admin.addPeer("enode://f48fcf69ba27442ff3813912ec12ea1ad249f14739dabfcadb3985c3654540e047700030adba5800bf33d0adbdd9ca5f1c47aae2498a0d9dafb8c2fd730969b4@[::]:3002"
... ^C
> admin.addPeer("enode://f48fcf69ba27442ff3813912ec12ea1ad249f14739dabfcadb3985c3654540e047700030adba5800bf33d0adbdd9ca5f1c47aae2498a0d9dafb8c2fd730969b4@[::]:3002")
true
> net.peerCount
3
> 
> admin.addPeer("enode://f48fcf69ba27442ff3813912ec12ea1ad249f14739dabfcadb3985c3654540e047700030adba5800bf33d0adbdd9ca5f1c47aae2498a0d9dafb8c2fd730969b4@[::]:3002")
true
> net.peerCount

5
> net.peerCount
1
> net.peerCount
1
> 

Console 2:

myMac:console2 admin$ geth attach ipc:../node2/geth.ipc 
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.3-stable/darwin-amd64/go1.9.2
coinbase: 0x3fd97155061e47960b59b563a178fa248493017c
at block: 0 (Wed, 10 Jan 2018 21:36:58 +04)
 datadir: /Users/admin/EtherNet/testnet/node2
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> 
> admin.
admin.addPeer              admin.getNodeInfo          admin.nodeInfo             admin.sleepBlocks          admin.toLocaleString       
admin.constructor          admin.getPeers             admin.peers                admin.startRPC             admin.toString             
admin.datadir              admin.hasOwnProperty       admin.propertyIsEnumerable admin.startWS              admin.valueOf              
admin.exportChain          admin.importChain          admin.removePeer           admin.stopRPC              
admin.getDatadir           admin.isPrototypeOf        admin.sleep                admin.stopWS               
> admin.nodeInfo.
(anonymous): Line 2:1 Unexpected end of input
> admin.nodeInfo.enode
"enode://f48fcf69ba27442ff3813912ec12ea1ad249f14739dabfcadb3985c3654540e047700030adba5800bf33d0adbdd9ca5f1c47aae2498a0d9dafb8c2fd730969b4@[::]:3002"
> net.peerCount
1
> 
> net.peerCount
2
> net.peerCount
1
> net.peerCount
2
> 
> net.peerCount
3
> net.peerCount
5
> 

I've ONLY 2 nodes and node2 is attached to node1. So, there is ONLY ONE PEER for each. But, why does the 'net.peerCount' keep changing, on subsequent execution of the same command?

  • Do you use the --noDiscover flag when launching your node? If note, other node try to connect (because of broadcast) but get rejected after that. To avoid that, launch geth with --nodiscover – Florian Castelain Jan 11 '18 at 9:50
  • You don't broadcast your information, but you receive connection attempts that get rejected because of a different genesis file. I had the same issue on my private chain. Just add the "--nodiscover" flag and check if this is really the problem. – Florian Castelain Jan 11 '18 at 10:15
  • @Andromelus, since this is a FRESH LOCAL setup and I've not turned on RPC as well, I'm not expecting anyone to know that my network-nodes exist. I didn't do anything to broadcast my network info. So, it's unlikely that other nodes would try to connect to my local network. Correct me if I'm wrong. And, below are the commands I used to launch the nodes: serv1$ geth --datadir node1 init bisminet.json serv1$ geth --datadir node1 --port 3000 serv2$ geth --datadir node2 init bisminet.json serv2$ geth --datadir node2 --port 3002 Should I relaunch with --noDiscover flag? – RafiAlhamd Jan 11 '18 at 10:16
  • @Andromelus, (Sorry, I deleted and re-added my comment with the 'markdown format'. But, failed again though! So, your answer appears above my comment. Just for the clarity of honoring your response). – RafiAlhamd Jan 11 '18 at 10:28
  • Glad it worked, I added an answer. – Florian Castelain Jan 11 '18 at 10:30
0

Your node is receiving connection attempts from other nodes but get rejected because the genesis block/file is different.

Launch your node(s) with --nodiscover flag, this way they won't accept "random" connection from other nodes.

  • 1
    RELAUNCHED my nodes, as per your suggestion, and I'm getting 'net.peerCount' as 1, as expected! Though, one correction in your comment: --noDiscover flag must be in lower case: --nodiscover. Thanks! – RafiAlhamd Jan 11 '18 at 10:34

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.