I would like to get Bitcoind to advertise that it is listening on an onion address. However, I do not want to have Bitcoind use a tor socks proxy to connect. I have a special router for tor connections and the Bitcoind server uses that as its network gateway. How do I get bitcoind to advertise an onion address without setting a socks proxy?
1 Answer
You need a way for an onion service to be created, connected to and advertised. Usually, with Tor running on the same machine, just start bitcoind with the following option should do it depending if your installed versions of Tor and Bitcoin Core are new enough:
>bitcoind -listenonion
You may also need to override -bind=
, -discover=
, listen=
and -externalip=
after that to suit your exact configuration.
Of course, the setup in your question is a little different to standard. What you will need to do is:
- Bind your bitcoind to the network IP of the machine it is running on. It probably is already but, you can use
-bind=
if necessary. - Ensure the firewall on your bitcoind machine will allow incoming connections to the bitcoind service from your Tor router. With firewall configuration, it is always best to be specific.
Setup the onion service on your Tor router and point it to your bitcoind machine. Make a note of your onion service name.
Ordinarily, you should be able to add the following lines to the
/etc/tor/torrc
file:HiddenServiceDir /var/lib/tor/bitcoin-service/ HiddenServicePort 8333 {machine IP of bitcoind}:{mainnet port} HiddenServicePort 18333 {machine IP of bitcoind}:{testnet port}
*Note that I have not tested this setup and presume Tor will allow you to specify the IP of your network machine running bitcoind
- You may consider adding 8333 to the
LongLivedPorts
parameter in your permanent Tor config and restart Tor unless you have a live configuration editor like nyx to also change it on the hop. - Configure bitcoind to use and advertise the onion address for incoming connections. You can use
-externalip={onion}
. I am not sure if you can or if you need to specify this multiple times, for any standard IPv4/IPv6 external incoming addresses also. - You may also consider using
-discover=1
since you are not trying to hide your standard external IP addresses I presume.
In bitcoin-qt, you can see the command line options and their descriptions in the help menu.
-
tor is running on a separate machine. So I cannot do this. Commented Feb 10, 2018 at 8:27
-