Skip to content

Documentation trap when using -bind in conjunction with (automatically configured) Tor hidden services #33458

Open

Description

@ArmchairCryptologist

To start with the conclusion: everything appears to work as intended, so this should probably not be considered a bug as such, but some logging and telemetry output could be improved to make things clearer.

If you use -bind to manually specify which (public) IPs to listen to, Bitcoin Core will also no longer create the (local) default socket for incoming Tor connections at 127.0.01:8334 unless you specify it manually in your list - this is probably working as intended. When automatically creating a Tor hidden service, it will instead be routed to the public IPv4 port, and incoming Tor connections still work just fine.

However, without the dedicated Tor socket, Bitcoin Core is unable to distinguish between regular IPv4 connections and Tor connections, so all of the latter will be counted as the former.

The specific case that had me scratching my head for a bit: -netinfo reported zero incoming Tor connections

         ipv4    ipv6   onion   total   block
in        291      28       0     319
out         5       3       2      10       2
total     296      31       2     329

while the true number of incoming Tor connections was 29.

ss -tupan | grep tor | grep 8333 | wc -l
29

As expected, removing the -bind statements from the config and restarting fixed it.

         ipv4    ipv6   onion   total   block
in         25       4       5      34
out         4       1       5      10       2
total      29       5      10      44

While the documentation for -bind hints towards why this is the case, Bitcoin Core gives no indication in the logs or the -netinfo output that the configuration is suboptimal, and I feel like maybe it should do that just to save people (like me) from getting confused.

Maybe during startup, if no Tor socket is created and a Tor hidden service is created, it should add something like "Warning: -bind was specified but lacks a dedicated Tor socket; incoming Tor connections will be counted as regular connections", and when using -netinfo it should show a "?" or "-" instead of "0".

Activity

  1. ArmchairCryptologist commented on Jan 21, 2026

    @ArmchairCryptologist
    Author

    I haven't heard otherwise so I believe it's up for grabs, thanks!

  2. naiyoma commented on Mar 27, 2026

    @naiyoma
    Contributor

    I think the right approach might not be a warning. Since-listenoniondefaults to true, we start StartTorControl
    by default. If we are still accepting incoming Tor connections, my suggestion is that we should try to make the count correct for -netinfo.

    Two possible solutions come to mind(I have not tested any, so I don't know if they are accurate)
    Option 1
    Override -listenonion If -bind is specified and no =onion is in the bind list, automatically set listenonion=0:
    No Tor hidden service created
    User gets exactly what their -bind implies
    -netinfo gets correct count

    Option 2
    Enforce =onion binding If -bind is specified and listenonion=true, and no =onion is in the bind list, automatically add 127.0.0.1:8334=onion:
    Tor socket created
    inbound_onion=true
    -netinfo Count is accurate

  3. naiyoma commented on Mar 30, 2026

    @naiyoma
    Contributor

    I think the right approach might not be a warning. Since-listenoniondefaults to true, we start StartTorControl by default. If we are still accepting incoming Tor connections, my suggestion is that we should try to make the count correct for -netinfo.

    Two possible solutions come to mind(I have not tested any, so I don't know if they are accurate) Option 1 Override -listenonion If -bind is specified and no =onion is in the bind list, automatically set listenonion=0: No Tor hidden service created User gets exactly what their -bind implies -netinfo gets correct count

    Option 2 Enforce =onion binding If -bind is specified and listenonion=true, and no =onion is in the bind list, automatically add 127.0.0.1:8334=onion: Tor socket created inbound_onion=true -netinfo Count is accurate

    On second thought, this suggestions would not work. listenonion and -bind should not be coupled.

  4. added a commit that references this issue on Jul 27, 2026
    4736431
  5. added a commit that references this issue on Sep 3, 2026
    bfd6da5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions