You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Bitcoin in combination with Tor, to generate a hidden service to allow for inbound connections, it is needed to add torcontrol like this:
proxy=1.2.3.4:9050
torcontrol=1.2.3.4:29501
The problem is that adding torcontrol results in overriding the proxy address with 127.0.0.1 and the end-result is that Bitcoin cannot connect to Tor any longer:
connect() to 127.0.0.1:9050 failed after wait: Connection refused (111)
It should have connected to 1.2.3.4 instead.
So why does adding torcontrol overrides the configured address for proxy?
If you want to override -torcontrol, you should be using -onion. Overriding -proxy is expected behaviour (otherwise why use -torcontrol at all?).
To me, this doesn't make sense. -onion is the more specific version of -proxy, so it makes sense that -onion overrides -proxy. But the interactions with any other parameter should be consistent between the two. Everything else is very confusing.
IMO it is ok that the auto-discovered Tor proxy overrides the generic one from -proxy because -proxy could be just an ordinary SOCKS5 proxy unrelated to the Tor network. If that is not ok, then the user has the option to override the auto-discovered one by using -onion. That is, -proxy < -torcontrol (auto-discover) < -onion
looks reasonable to me.
If it is changed to -torcontrol (auto-discover) < -proxy < -onion
then there is no way for the user to setup a configuration that uses auto-discovery + a manually specified non-Tor-related SOCKS5 proxy (with -proxy). The auto-discovery is nice because it returns a correct location, even after configuration changes in the network or the Tor daemon, without user interaction.
According to my understanding bitcoin core designed automatically to configure tor when using torcontrol, when torcontrol is active the device automatically manages the tor instance making it override the manual proxy configuration
According to my understanding bitcoin core designed automatically to configure tor when using torcontrol,
It automatically configures the location of the Tor proxy, used for outgoing connections to Tor. Don't confuse this with the creation of the Tor hidden service for accepting incoming connections from Tor, that is controlled by -listenonion=0|1.
@kroese, it is a bit unclear from the OP, did it connect to torcontrol and retrieve an invalid proxy from there? That is, 127.0.0.1:9050 instead of 1.2.3.4:9050? That would be odd. I think the torcontrol reports the value of SOCKSPort from torrc and if you are using some tunneling that could probably confuse it. If you know better, you can set the correct value of the Tor proxy with -onion:
I think that the current priority of -proxy < -torcontrol (auto-discover) < -onion is correct, as elaborated above, so I guess this issue can be closed as "not a bug, will not fix".
Activity
[-]Setting torcontrol overrides proxy[/-][+]Setting torcontrol overrides proxy address[/+]fjahr commentedon Jun 19, 2022
@kroese can you share any relevant logs outputs and also what other settings you are using that are networking related?
laanwj commentedon Jun 20, 2022
To be precise, it overrides the specific proxy for
NET_ONION, e.g.-onion.See https://github.com/bitcoin/bitcoin/blob/master/src/torcontrol.cpp#L385
I guess it shouldn't be doing so if an explicit one was provided on the command line.
fjahr commentedon Jun 20, 2022
That's a good hint! I will look into it unless you have already started working on it.
laanwj commentedon Jun 21, 2022
No I haven't, feel free to pick it up!
luke-jr commentedon Jul 26, 2022
If you want to override
-torcontrol, you should be using-onion. Overriding-proxyis expected behaviour (otherwise why use-torcontrolat all?).fjahr commentedon Jul 26, 2022
To me, this doesn't make sense.
-onionis the more specific version of-proxy, so it makes sense that-onionoverrides-proxy. But the interactions with any other parameter should be consistent between the two. Everything else is very confusing.vasild commentedon Aug 18, 2022
This was briefly discussed in #15423 (comment).
Related PR: #22830.
IMO it is ok that the auto-discovered Tor proxy overrides the generic one from
-proxybecause-proxycould be just an ordinary SOCKS5 proxy unrelated to the Tor network. If that is not ok, then the user has the option to override the auto-discovered one by using-onion. That is,-proxy < -torcontrol (auto-discover) < -onionlooks reasonable to me.
If it is changed to
-torcontrol (auto-discover) < -proxy < -onionthen there is no way for the user to setup a configuration that uses auto-discovery + a manually specified non-Tor-related SOCKS5 proxy (with
-proxy). The auto-discovery is nice because it returns a correct location, even after configuration changes in the network or the Tor daemon, without user interaction.Fidel76y commentedon Oct 14, 2024
According to my understanding bitcoin core designed automatically to configure tor when using
torcontrol,whentorcontrolis active the device automatically manages the tor instance making it override the manual proxy configurationvasild commentedon Nov 5, 2024
It automatically configures the location of the Tor proxy, used for outgoing connections to Tor. Don't confuse this with the creation of the Tor hidden service for accepting incoming connections from Tor, that is controlled by
-listenonion=0|1.@kroese, it is a bit unclear from the OP, did it connect to torcontrol and retrieve an invalid proxy from there? That is,
127.0.0.1:9050instead of1.2.3.4:9050? That would be odd. I think the torcontrol reports the value ofSOCKSPortfromtorrcand if you are using some tunneling that could probably confuse it. If you know better, you can set the correct value of the Tor proxy with-onion:I think that the current priority of
-proxy < -torcontrol (auto-discover) < -onionis correct, as elaborated above, so I guess this issue can be closed as "not a bug, will not fix".kroese commentedon Nov 5, 2024
@vasild I cannot remember anymore, it was two years ago that I ran into this behaviour. So feel free to close it.