Post
Topic
Board Bitcoin Technical Support
Re: What's the current best way to run Bitcoin throught Tor?
by
takuma sato
on 13/09/2025, 18:57:56 UTC
I installed it from the Tor repository and got it working. I was able to run bitcoin-qt with Tor since it has the P on the GUI and im only connecting to .onion addresses in the Peers window. However, some things still not fully working it seems.

1) The RPC does not work when I use Tor for some reason. I try ./bitcoin-cli -datadir=path getnetworkinfo and it says:
Quote
error: timeout on transient error: Could not connect to the server 127.0.0.1:18332

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

There is no cookie so maybe I have the wrong settings on bitcoin.conf
TOR should not affect your connection to the RPC unless there a bug present. Can you please clarify whether you are trying to do this on testnet or mainnet? Just to make sure that there is no basic error or confusion here. 18332 is the RPC port for testnet. The mainnet port is 8332. A small reminder about .conf and CLI, do not update the .conf while the daemon is running. This may give you issues relating to configuration changes and may cause unnecessary confusion.



I will try to reproduce everything that you are doing. Can you please post complete configuration files (omit the passwords and such obviously)?

Using rpcbind=127.0.0.1 works for clearnet, but does not work with tor, because it does not create the .cookie file. For it to work I had to comment #rpcbind=127.0.0.1 and add a line that is bind=127.0.0.1 otherwise it does not create the .cookie

Btw I tried again and now I see the onion_v3_private_key and I get the onion address on localaddresses so I believe tor is working properly now, im not sure what I was doing yesterday but I didn't see that file but I was seeing onion peers so not sure about that. Anyway looks like it's working now. Just wanted to see why you have to use bind and not rpcbind with tor.

And another question I have is about the "discover=0/1" option. Should you use this enabled or disabled when clearnet or with Tor? I asked AI and said


Quote
discover=1 (the default) enables local network peer discovery. Specifically:

    Bitcoin Core will query your machine's network interfaces to learn local IP addresses.
    It announces those addresses to peers (via peer-to-peer messages) so other nodes can attempt inbound connections to your node.
    It helps populate the node's address manager (addr) with reachable local addresses for NAT traversal and peer selection.

If you set discover=0, Core will not auto-detect or advertise your machine's local IPs — useful when you are behind Tor, NAT, or want to avoid leaking local network addresses.

I have tried with 0 and with 1 and I don't see a difference. It finds new peers either way. Im not sure what is doing. I just would like to know the ideal bitcoin.conf for maximun privacy.