8

I have 2 nodes running on private network under the same network id connecting through

sudo geth --identity "testpython manage.py runserver  0.0.0.0:8001" --networkid 1100 --mine --nodiscover --rpc --rpcport 8544 --rpccorsdomain "*" --rpcapi "eth,web3" --port 30304 --ipcpath ~/.ethereum/geth.ipc --genesis /home/user/genesis.json --datadir /home/user/genesis console privatenet 2>/home/user/genesis/log_output5 

In one node and in other with different ports. It has same genesis.json and connected to the same network. When i connect via,

admin.addPeer(nodeUrl)

It will show the connection in admin.peers and in few seconds it will go off in both the nodes. it keep connecting and disconnecting between the nodes. and in admin.peers remoteAddress port is coming as 59823 though I have given 30305 port.

localAddress: "192.168.15.69:30304",
remoteAddress: "192.168.15.71:59823"

I felt this is causing me not to do node to node ether transaction. once node to node transaction has happened. after that i couldnot.

I read in other links that static-nodes.json / trusted-nodes.json may help in having stable connection. please help me

  1. How to have stable connection
  2. If we use static-nodes.json / trusted-nodes.json , how to use and which one to use. syntax please
  3. How to do transactions in one node and mining from another node?

Losing connection between nodes on private network

2 Answers 2

8

Data format

[
      "enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303",
      "enode://pubkey@ip:port"
]

You can configure permanent static nodes by putting something like the following into <datadir>/static-nodes.json

Common problems with connectivity

Sometimes you just can't get connected. The most common reasons are:

  1. Your local time might be incorrect. An accurate clock is required to participate in the Ethereum network. Check your OS for how to resync your clock (example sudo ntpdate -s time.nist.gov) because even 12 seconds too fast can lead to 0 peers.
  2. Some firewall configurations can prevent UDP traffic from flowing. You can use the static nodes feature or admin.addPeer() on the console to configure connections by hand.

Sources:
1. https://github.com/ethereum/homestead-guide/blob/master/source/network/connecting-to-the-network.rst#static-nodes-trusted-nodes-and-boot-nodes

0

Geth also supports a feature called static nodes if you have certain peers you always want to connect to. Static nodes are re-connected on disconnects. You can configure permanent static nodes by putting something like the following into <datadir>/geth/static-nodes.json:

[
  "enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303",
  "enode://pubkey@ip:port"
]

https://geth.ethereum.org/docs/interface/peer-to-peer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.