I am working on a private blockchain that consists of 4 nodes running on different ports.
I am trying to get each node to communicate its connections to its peers, so the network would be fully-connected (each Node has each other Node as its peer). However, nodes are not discovering the peers of their peers.
Node 1 is designated as the bootstrap node
, and Nodes 2 & 3 connect to it upon starting. However, Node 1 will have Nodes 2 & 3 as its peers while they will each only have Node 1 as its own peer. I want Nodes 2 & 3 to discover each other.
Additionally, when I run admin.addPeer(node4's enode)
, from Node 1, it is not broadcasted to its peers.
My question: How can I enable a peer-discovery protocol wherein every Node communicates all of its peers to each of its peers?
I understand that there are some hacks to get around this. Per instance, I can simply pass in each of the 3 other nodes' enode
address to every node's --bootnodes
in Geth. Or I can just use admin.addPeer()
on each of its peer's admin.peers
. But I think Geth has this automated somehow and I'd like to use their solution.
StartNode Script:
geth --networkid 63261 --mine --minerthreads 1 --datadir . --rpc --rpcport "8547" --port "30305" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --unlock 0 --password "./node3password.sec" --ipcdisable --bootnodes "node1enode" console 2>> geth.log
[Edit]:
I had already initialized each of my nodes to point at my Private Network's Genesis JSON (./BCNetworkName.json
) before running the StartNode script. geth --datadir ./NodeN init BCNetworkName.json