16

I am trying to setup a private network and trying to connect peers. Currently I'm trying it on my laptop and desktop (both of them are connected to different internet).

I run the below command in first terminal(in both systems (data dir is different in both systems)):

geth --rpc --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "http://localhost:5000, http://localhost:6000" --port "2403" --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --networkid 1001201 --datadir "E:\User\priv\data" init "E:\User\priv\genesis.json"

then I run:

geth --datadir "E:\User\priv\data"

Now, in the second terminal:

geth attach ipc:\\.\pipe\geth.ipc

then on 1st PC,

admin.addPeer("enode://e0c4960659b6ce4eda71c67b337055636f67660a711d157a81572b5eff1ed1b77931bef4bd079e2660baa661ac16d696b831e9394cb619378071a2593ecdf17a@[192.168.1.2]:30301");

on 2nd PC,

admin.addPeer("enode://5512657323add8ceafddb4fc64426b99b58473bfdfab795fe3847fdd6a09c25667d57c5c187d2d48de4ae63d02ce1e221a068dfe5e0476fe21d8aaa8a57d3356@[13.75.117.156]:30302");

both of them return true.
But admin.peerCount returns 0.

Can somebody please help me to setup a private geth network?

Diwaker Singh
  • 161
  • 1
  • 1
  • 4
  • I see this 192.168.1.2]:30301 Maybe we remove that ending bracket. 2. It happened to me often that the node has the port firewalled, check that. and 3. make sure to tell geth using the --port option your listening port.
  • – Herman Junge Mar 26 '17 at 13:41
  • admin.addPeer("enode://e0c4960659b6ce4eda71c67b337055636f67660a711d157a81572b5eff1ed1b77931bef4bd079e2660baa661ac16d696b831e9394cb619378071a2593ecdf17a@[192.168.1.2]:30301"); you should remove the Square braces after the @ symbol.after that u get the peers count . – Vijju Oct 09 '17 at 01:22