Mirobit / bitcoin-node-manager

:bar_chart: Lightweight dashboard and control system for bitcoin nodes
MIT License
122 stars 62 forks source link

IP address: Unknown #20

Closed mcjoshea closed 3 years ago

mcjoshea commented 4 years ago

Bitcoin Node Manager shows the IP address of my node as unknown.

ip

It seems to only show an IP address when I manually set it in Bitcoin Core using -externalip.

The node is set up on a Raspberry Pi 3 Model B+ using the packaged Snap version with port forwarding configured at the router.

I think it would be nice to show the external IP address in BNM instead of reporting it as unknown.

Here is a useful API https://www.ipify.org that can be used to grab the external IP address.

Mirobit commented 4 years ago

Do you have incoming and outgoing connections?

mcjoshea commented 4 years ago

Yes. Got both. Currently I've got six research peers with 58 peers connected in total. Latest peer ID is 116337. Picked up by Bitnodes and sitting mid ranking in their node table.

When I added externalip= into my Bitcoin Core config the IP address showed up in BNM but when my ISP refreshes my IP address, all the nodes fall off so I removed it from the config.

I'm port forwarding 8333 to the Pi, nothing else. Using standard broadband connection for this.

When I run getnetworkinfo I get this:

{ "version": 200000, "subversion": "/Satoshi:0.20.0/", "protocolversion": 70015, "localservices": "000000000000040d", "localservicesnames": [ "NETWORK", "BLOOM", "WITNESS", "NETWORK_LIMITED" ], "localrelay": true, "timeoffset": 0, "networkactive": true, "connections": 58, "networks": [ { "name": "ipv4", "limited": false, "reachable": true, "proxy": "", "proxy_randomize_credentials": false }, { "name": "ipv6", "limited": false, "reachable": true, "proxy": "", "proxy_randomize_credentials": false }, { "name": "onion", "limited": true, "reachable": false, "proxy": "", "proxy_randomize_credentials": false } ], "relayfee": 0.00001000, "incrementalfee": 0.00001000, "localaddresses": [ ], "warnings": "" }

When I run that from a Windows node, on same internal network, without any port forwarding as that is pointing at the Pi, I get this:

{ "version": 200000, "subversion": "/Satoshi:0.20.0/", "protocolversion": 70015, "localservices": "0000000000000409", "localservicesnames": [ "NETWORK", "WITNESS", "NETWORK_LIMITED" ], "localrelay": true, "timeoffset": -3, "networkactive": true, "connections": 7, "networks": [ { "name": "ipv4", "limited": false, "reachable": true, "proxy": "", "proxy_randomize_credentials": false }, { "name": "ipv6", "limited": false, "reachable": true, "proxy": "", "proxy_randomize_credentials": false }, { "name": "onion", "limited": true, "reachable": false, "proxy": "", "proxy_randomize_credentials": false } ], "relayfee": 0.00001000, "incrementalfee": 0.00001000, "localaddresses": [ ], "warnings": "" }

So neither of them give any IP address details from the node.

How do you get the IP address for BNM?

Mirobit commented 4 years ago

That is strange. Usually the ips are listed in the localaddresses array.

mcjoshea commented 4 years ago

Here are the active lines from both my bitcoin.conf files.

Windows 7

txindex=1 prune=0 server=1 rpcauth=(hidden) dbcache=4000 addnode=192.168.1.5

The addnode address above is that of the Pi node below.

Raspberry Pi

txindex=1 prune=0 server=1 rpcauth=(hidden) dbcache=100 maxmempool=50 maxorphantx=10 peerbloomfilters=1

Could anything have changed with the v0.20.0 version of Bitcoin Core? That's what they are both running.

Mirobit commented 3 years ago

Nothing changed with 0.20.0 for my nodes. So I don't think bitcoin core changed anything. I will look into to this more detailed when I have some extra time.

Mirobit commented 3 years ago

I am closing this issue since there is currently no other way to get the correct IP addresses. If localaddresses is empty there is no other way of getting them from Bitcoin Core.

Here is a useful API https://www.ipify.org that can be used to grab the external IP address.

This would only provide the IP the Web Server is bound to. Bitcoin Core could be bound to a different IP.