Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: apogio on April 21, 2023, 05:38:24 PM



Title: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: apogio on April 21, 2023, 05:38:24 PM
Hello! I am running bitcoind using my terminal. I am on a windows machine.

When I run
Code:
bitcoin-cli -netinfo
I get the following response:

Code:
        ipv4    ipv6   onion   total   block
in         0       0       0       0
out        8       2       0      10       2
total      8       2       0      10

I know that in order to get incoming connections I need to do portforwarding and allow connections on my firewall. So, let me say in advance that I can't do this!

Could you help me allow anonymous connections? I suppose that in this manner, I won't have to care about port forwarding.

Thanks in advance!


Title: Re: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: SamReomo on April 22, 2023, 02:00:38 AM

I know that in order to get incoming connections I need to do portforwarding and allow connections on my firewall. So, let me say in advance that I can't do this!

Could you help me allow anonymous connections? I suppose that in this manner, I won't have to care about port forwarding.

Thanks in advance!

In that case the most suitable option for you is to use tor and run your node on it because it doesn't require port forwarding to allow the connections. You can also run the node on a VPS server where you won't need to forward the ports. You will only need to allow the connections through the firewall of the VPS and that's accessible to you.



Title: Re: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: nc50lc on April 22, 2023, 06:54:09 AM
When I run
Code:
bitcoin-cli -netinfo
I get the following response:
There's an "onion" column in the result of -netinfo so I guess you're already running with -proxy=127.0.0.1:9050 and a Tor onion service...
If so, just follow the third option in this article about connecting via Tor: https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md (https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md#3-manually-create-a-bitcoin-core-onion-service)

I recommend that manual setup since it's the most simple, just add line to your "torrc" file, start Tor, get your external IP from the "HiddenServiceDir" that you've set
and start Bitcoin Core with your correct -externalip and suggested command line options and your node will be reachable via Tor.

You can use: bitnodes.io (http://bitnodes.io) to see if your node is reachable. (paste your -externalip)


Title: Re: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: apogio on April 22, 2023, 07:34:21 AM
There's an "onion" column in the result of -netinfo so I guess you're already running with -proxy=127.0.0.1:9050 and a Tor onion service...
If so, just follow the third option in this article about connecting via Tor: https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md (https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md#3-manually-create-a-bitcoin-core-onion-service)

At the moment my -netinfo is as follows:

Code:
Bitcoin Core v22.0.0 - 70016/Satoshi:22.0.0/

        ipv4    ipv6   onion   total   block
in         0       0       0       0
out        9       1       0      10       2
total      9       1       0      10

Local addresses
<my onion address>     port   8333    score      4

I have run bitcoin core using:

Code:
 .\bitcoind.exe -datadir=<bitcoin core path> -externalip=<my onion address> -proxy="127.0.0.1:9050" -debug="tor" 


Tor is running as a service on my system.


Title: Re: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: Cricktor on April 22, 2023, 02:37:56 PM
To force bitcoind to use only Tor I've the following in my bitcoin.conf file:
Code:
listenonion=1
onlynet=onion

And bitcoin-cli -netinfo yields only incoming and outgoing connections via Tor onion addresses.


Title: Re: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: nc50lc on April 22, 2023, 02:44:08 PM
Code:
 .\bitcoind.exe -datadir=<bitcoin core path> -externalip=<my onion address> -proxy="127.0.0.1:9050" -debug="tor" 

If you need inbound connections, add -listen=1 command line option or follow the suggestion above, in your "bitcoin.conf" file.
You'll need it since -proxy disabled listen.

Take note that onlynet=onion will prevent you from connecting to nodes on clearnet.

Have you tried in bitnodes if your node is reachable?
If it is now, you'll eventually get inbound connections after a while.


Title: Re: Bitcoin Core - Help allowing TOR (anonymous) connections
Post by: apogio on April 22, 2023, 03:34:37 PM
To force bitcoind to use only Tor I've the following in my bitcoin.conf file:
Code:
listenonion=1
onlynet=onion

And bitcoin-cli -netinfo yields only incoming and outgoing connections via Tor onion addresses.

If you need inbound connections, add -listen=1 command line option or follow the suggestion above, in your "bitcoin.conf" file.
You'll need it since -proxy disabled listen.

Take note that onlynet=onion will prevent you from connecting to nodes on clearnet.

Have you tried in bitnodes if your node is reachable?
If it is now, you'll eventually get inbound connections after a while.

Thank you both! I have added -listen=1 option. I haven't added the onlynet=onion option because I want to receive and send all kind of connections.

However, it looks like I still don't get incoming transactions. BUT in bitnodes it looks like my onion address is discoverable.

----EDIT----
I am so happy! Thank you! Look:

Code:
Bitcoin Core v22.0.0 - 70016/Satoshi:22.0.0/

        ipv4    ipv6   onion   total   block
in         0         0       4       4
out       10       0       0      10       2
total     10       0       4      14

Local addresses
<my onion address>.onion     port   8333    score      5