0

I've followed all these steps How can I setup Bitcoin to be anonymous with Tor?

I've added onlynet line in my conf file, but all my peers come with ipv4 connection. When I run getnetworkinfo I get ipv4, ipv6 and onion all as reachable. Only unreachable is i2p. How do I force my node to use tor and not ipv4 and ipv6.

UPDATE After deleting peers.dat file, ipv4 and ipv6 would become unreachable under getnetworkinfo. However after some time, not sure if caused by reboot or smth else, it would turn back to reachable and in peerinfo half of the peers would be through ipv4.

Conf file

datadir=/mnt/blockchain/.bitcoin/
txindex=1
server=1
daemon=1
rpcport=8332
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
rpcallowip=10.0.0.0/8
rpcallowip=172.0.0.0/8
rpcallowip=192.0.0.0/8
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
zmqpubhashblock=tcp://0.0.0.0:28334
whitelist=127.0.0.1
rpcauth=bitcoin:#########hashed_out_for_security_reasons##########
proxy=127.0.0.1:9050
listen=1
bind=127.0.0.1
onlynet=onion
Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308
  • Can you paste your exact bitcoin.conf file into your question? – Pieter Wuille Dec 01 '22 at 18:58
  • Hey Pieter, thanks for quick reply. I think I solved it tho. I've tried lots of things. Seems like deleting peers.dat file helped. Currently have 8 peers, all onion.https://media.tenor.com/d-51Xsn5N3AAAAAd/oignon-onion.gif – son_of_satoshi Dec 01 '22 at 19:07
  • onlynet=... only controls outbound connections. Are you just seeing inbound connections through IPv4 and IPv6? – Pieter Wuille Dec 02 '22 at 14:09
  • At the moment I have 9 onion connections, from which 8 are "outbound full relay" and 1 is "block relay only", and 1 ipv4 connection that is "block relay only". I'm not sure if that describes inbound and outbound connections. If not can you please point me to how to check that. Thanks – son_of_satoshi Dec 02 '22 at 14:17
  • Can you paste the output of getpeerinfo in your answer? – Pieter Wuille Dec 02 '22 at 14:21
  • Actually, "block relay only" implies it's outbound, so no need. – Pieter Wuille Dec 02 '22 at 14:30
  • Try deleting anchors.dat ? – Pieter Wuille Dec 02 '22 at 14:31
  • So full relay is both in and out, and block relay is outbound? Is there any benefit from security perspective to have all your connections through tor, or it is important to have just outbound through tor? Do not have {anchors.dat} in my .bitcoin. – son_of_satoshi Dec 02 '22 at 14:36
  • All connections are bidirectional in terms of communication. "inbound" and "outbound" just refers to which node initiated the connection. From a security perspective, it's much better to have a mix of Tor and non-Tor connections, especially for outbound. Tor-only is mostly something you'd want for privacy reasons. – Pieter Wuille Dec 02 '22 at 15:48
  • Thanks for explaining. So how would I make all the connections over Tor, if that is possible? I don't seem to have that anchors file. – son_of_satoshi Dec 02 '22 at 16:08
  • Perhaps can you still provide the output of getpeerinfo? – Pieter Wuille Dec 02 '22 at 16:16
  • https://pastebin.com/srmZ6M6w Seems all of them are onion now. Haven't done anything. – son_of_satoshi Dec 02 '22 at 16:28
  • https://pastebin.com/2a8p5gCx This is getnetworkinfo Seems ipv4 and ipv6 are unreachable again. – son_of_satoshi Dec 02 '22 at 16:31

1 Answers1

1

There have been recently some improvements to make sure onlynet is respected, most importantly https://github.com/bitcoin/bitcoin/pull/22834 which has been part of bitcoin core since v23.1.

It has been reported before that older versions of Bitcoin Core would in some situations not respect -onlynet=onion, see e.g. the discussion in https://github.com/bitcoin/bitcoin/issues/22647.

Another issue, that sometimes during initial peer bootstrap (empty peers.dat) DNS seeds would be queried violating the -onlynet option, was fixed in https://github.com/bitcoin/bitcoin/pull/25678 (which will be contained in v 24.x).

Lightlike
  • 636
  • 3
  • 13
  • So it would help to know which version of Bitcoin core you are using? – Lightlike Dec 02 '22 at 18:36
  • So, after upgrading to 23, was using 22, all my connections are now onion. I've also noticed there is 14 connections now in comparison to 10 in previous versions and "cjdns" as new type. Gonna explore that more. Thanks to Pieter for explaining stuff and Lightlike for upgrade idea. I'm not sure how to close this request or if it needs closing. Seems I can't cast vote yet, however thanks for your time guys. – son_of_satoshi Dec 03 '22 at 14:52