Is it possible to disable bind on onion network listening port? #22668

issue josef-v openend this issue on August 9, 2021
  1. josef-v commented at 9:16 am on August 9, 2021: none

    This may also be a bug depending on understanding of listenonion option.

    What is happening: We have upgraded bitcoin node from v0.19 to v0.21, bitcoind tries to bind to port 8334 (tor listening), which we use for another service.

    Possible solution: Move the port using bind option to some unused port.

    Preferred solution: Disable listening on this particular port.

    I have tried using listenonion=0 but the only effect is that the tor service is not started, the port is however still used. Can binding of this port be disabled? And is listenonion working correctly?

  2. hebasto commented at 10:30 am on August 9, 2021: member

    @josef-v

     0$ ./bitcoind -version
     1Bitcoin Core version v0.21.1
     2Copyright (C) 2009-2020 The Bitcoin Core developers
     3
     4Please contribute if you find Bitcoin Core useful. Visit
     5<https://bitcoincore.org/> for further information about the software.
     6The source code is available from <https://github.com/bitcoin/bitcoin>.
     7
     8This is experimental software.
     9Distributed under the MIT software license, see the accompanying file COPYING
    10or <https://opensource.org/licenses/MIT>
    11
    12$ ./bitcoind -help | grep -A 6 -e '-bind'
    13  -bind=<addr>[:<port>][=onion]
    14       Bind to given address and always listen on it (default: 0.0.0.0). Use
    15       [host]:port notation for IPv6. Append =onion to tag any incoming
    16       connections to that address and port as incoming Tor connections
    17       (default: 127.0.0.1:8334=onion, testnet: 127.0.0.1:18334=onion,
    18       signet: 127.0.0.1:38334=onion, regtest: 127.0.0.1:18445=onion)
    

    Does this work for you:

    0$ ./bitcoind -bind=127.0.0.1:"${YOUR_PORT}"=onion
    

    ?

  3. hebasto added the label Questions and Help on Aug 9, 2021
  4. josef-v commented at 11:06 am on August 9, 2021: none
    @hebasto Thanks for your response! Yes, this works, we have already tried it and have as a backup solution. My goal was to find out if it is possible to disable this port at all. listenonion option looks like the way to go but it unfortunately only disables the service in the background and the port itself is still open.
  5. hebasto commented at 11:15 am on August 9, 2021: member
    0$ ./bitcoind -bind=127.0.0.1:8333 -bind=127.0.0.1:8333=onion
    

    ?

  6. hebasto commented at 11:17 am on August 9, 2021: member

    listenonion option looks like the way to go but it unfortunately only disables the service in the background…

    Yes, it is documented:

    0$ ./bitcoind -help | grep -A 2 -e '-listenonion'
    1  -listenonion
    2       Automatically create Tor onion service (default: 1)
    
  7. josef-v commented at 9:20 am on August 11, 2021: none

    ./bitcoind -bind=127.0.0.1:8333 -bind=127.0.0.1:8333=onion

    Thanks, that’s what we needed. I didn’t realize I can reuse the same port.

    listenonion option looks like the way to go but it unfortunately only disables the service in the background…

    Yes, it is documented:

    0$ ./bitcoind -help | grep -A 2 -e '-listenonion'
    1  -listenonion
    2       Automatically create Tor onion service (default: 1)
    

    I know, but I have expected that turning this off will also turn off the listening port. And I am not the only one, two developers from my team suggested this option after reading the docs. The name is a little misleading.

    Anyway, thanks for your help, I am closing this issue.

  8. josef-v closed this on Aug 11, 2021

  9. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me