fort-nix / nix-bitcoin

A collection of Nix packages and NixOS modules for easily installing full-featured Bitcoin nodes with an emphasis on security.
https://nixbitcoin.org
MIT License
513 stars 107 forks source link

Add `getnodeaddresses` to public bitcoind RPC whitelist? #721

Closed erikarvstedt closed 3 months ago

erikarvstedt commented 4 months ago

We recently added getpeerinfo to the public whitelist. If we also added getnodeaddresses, lnd could use the public whitelist instead of defining a custom whitelist (src).

In my view, RPC calls should not be added to the public whitelist if they

getnodeaddresses (https://chainquery.com/bitcoin-cli/getnodeaddresses) doesn't match these criteria and thus can be added to the public whitelist.

Was there a reason for not adding these calls in the first place?

cc @jonasnick

jonasnick commented 4 months ago

The reason for not adding these calls may have been privacy. I don't see a way to get the node's address other than getnodeaddress. But I'm not sure if there's actually no other way and there's no guarantee that it will stay like this in the future. On the other hand, it's not very costly to keep the custom whitelist.

erikarvstedt commented 4 months ago

getnodeaddresses returns addresses of peers the bitcoind instance has seen over its lifetime.

bitcoin-cli getnodeaddresses 0 | jq length
#=> 58390

It doesn't contain the node's own address (only relevant in case of Tor).

So I think we should either whitelist getnodeaddresses along with getpeerinfo or remove getpeerinfo from the whitelist. @jonasnick, what do you think?

jonasnick commented 4 months ago

getnodeaddresses returns addresses of peers the bitcoind instance has seen over its lifetime.

Oh, right! I'd be fine with whitelisting it then.