With getpeerinfo command I can get all directly connected peers ip addresses, how to know mine in the bitcoin network?


getnetworkinfo will tell you the IP address of your node if it knows what it actually is (or thinks it knows). It will be in the localaddresses field. Note that it may not contain your IP address or have the right IP addresses as it is difficult to know what your IP address is unless someone external tells you what it is.

  • What I am trying to do is to connect to other node with -addnode, or -connect options, but the question is how to know other nodes address. Both nodes are mine. – Ashot Khachatryan Sep 30 '17 at 19:34
  • 2
    The node's IP address is the IP address of the machine it is running on. On that machine, you can go to a website like whatismyip.com to find your IP address. – Andrew Chow Sep 30 '17 at 19:38
  • So if I have two different bitcoin nodes running in different networks I can use their external ip-s to connect them? – Ashot Khachatryan Sep 30 '17 at 19:45
  • Yes, you use their external IP addresses. Connecting them works in the same way that other nodes connect to your nodes. – Andrew Chow Sep 30 '17 at 19:46
  • Strange thing is that after addnode I am checking the status with getaddednodeinfo but 'connected' is always false. – Ashot Khachatryan Sep 30 '17 at 19:52

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.