- Geth version: v1.6.0-unstable-1018bf6a/linux/go1.7.3
- OS & Version: Linux/Ubuntu 16.04.1 LTS (x86_64)
I want to set up a private distributed blockchain network. I am failing to make nodes (running on different machines) recognize each other.
Both nodes have the same genesis file and are connected to the same networkId.
INFO Successfully wrote genesis state hash=X (hash equal on both nodes)
The UDP Port 30301 of the bootnode is open
> netcat -u -z -v <PUB-IP> 30301
Connection to <PUB-IP> 30301 port [udp/*] succeeded!
When I start the bootnote I pass the following arguments:
--nodekey <FILE> —addr :30301 --nat extip:<PUB-IP> --verbosity 9
The logs confirm that it is successfully created and listening:
INFO Mapped network port proto=udp extport=30301 intport=30301 interface=ExtIP(<PUB-IP>)
DEBUG UDP listener up self=enode://<PUB-ID>@<PUB-IP>:30301
When I start the node I pass the following arguments:
--cache=512 --verbosity=6 --datadir <DIR> --nat extip:<PUB-IP> --networkid=<VAL*> --rpc --rpcaddr=0.0.0.0 --rpcapi=eth,net,web3,personal,db --rpccorsdomain '*' --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --bootnodes enode://<PUB-ID>@<PUB-IP>:30301 --identity node1
*(I am using a big networkId but it is inside the BigInteger range)
The logs on the node confirm that the bootnode is well identified
INFO Starting P2P networking
# >> Info about the current node:
DEBUG UDP listener up self=enode://<PUB-ID>@<PUB-IP>:30303
INFO Mapped network port proto=udp extport=30303 intport=30303 interface=ExtIP(<PUB-IP>)
# >> Info about the bootnode:
TRACE Starting bonding ping/pong id=<PUB-ID-SHORT> known=false failcount=0 age=XmXs
But connection fails and admin.peers
shows no peers
TRACE >> PING/v4 addr=<PUB-IP>:30301 err=nil
TRACE Starting bonding ping/pong id=<PUB-ID-SHORT> known=false failcount=0 age=XmXs
TRACE >> PING/v4 addr=<PUB-IP>:30301 err=nil
When I try adding the bootnode manually, admin.addPeer("enode://..")
returns true but the logs show:
DEBUG Adding static node node=enode://<PUB-ID>@<PUB-IP>:30301
TRACE New dial task task="staticdial <PUB-ID-SHORT> <PUB-IP>:30301"
TRACE Dial error task="staticdial <PUB-ID-SHORT> <PUB-IP>:30301" err="dial tcp <PUB-IP>:30301: getsockopt: connection refused"
DEBUG Resolving node failed id=<PUB-ID-SHORT> newdelay=2m0s
TRACE Dial task done task="staticdial <PUB-ID-SHORT> <PUB-IP>:30301"
TRACE New dial task task="staticdial <PUB-ID-SHORT> <PUB-IP>:30301"
TRACE Dial error task="staticdial <PUB-ID-SHORT> <PUB-IP>:30301" err="dial tcp <PUB-IP>:30301: getsockopt: connection refused"
TRACE Dial task done task="staticdial <PUB-ID-SHORT> <PUB-IP>:30301"
I have tried as well to connect via static-nodes.json
, where I indicate the bootnode's address in all nodes; and also without the --bootnodes
flag, where somehow my nodes are not being recognized either, yet there are some random external nodes that are displayed as peers sporadically. I have tried specifying --maxpeers
(following BokkyPooBah's advice) as well and seems to make no difference.
Please, help me.
30303
, and not change the listening (UDP) port to30301
. (It looks like one of your nodes has UDP30303
and the other UDP30301
, which might not matter as you've specified the ports in the passed-in options. Personally I'd have everything as port30303
... )