doc: Extend `onion` option's description #16940

pull roshii wants to merge 1 commits into bitcoin:master from roshii:tor-usage changing 1 files +3 −2
  1. roshii commented at 12:43 PM on September 23, 2019: none

    Since bitcoind default to localhost, onion=ip:port needs to be set when tor is running on a remote server, even if it is the same as proxy

  2. Extend `onion` option's description 9cb149cc59
  3. fanquake added the label Docs on Sep 23, 2019
  4. fanquake requested review from laanwj on Sep 23, 2019
  5. sipa commented at 1:58 PM on September 23, 2019: member

    I think this is wrong, localhost is not special here.

  6. DrahtBot commented at 4:23 PM on September 23, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16901 (doc: Add markdownlint rules & apply formatting by ch4ot1c)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  7. roshii commented at 8:32 PM on September 23, 2019: none

    Thanks for the prompt feedback. I realize my pull request may be lacking some background information, which I'll correct here after.

    Details

    The present documentation mentions that the onion option doesn't need to be setup (to set the proxy server to use for Tor hidden services) if its ip:port is equal to the one set in proxy. That considered, I did originally setup torrc and bitcoin.conf as follows. Note that both service are running in their own docker container, within the same user-defined docker network.

    torrc

    RunAsDaemon 0
    SocksPort 192.168.247.2:9050
    ControlPort 192.168.247.2:9051
    HashedControlPassword 16:HASHEDBLABLA...
    BridgeRelay 1
    Log notice file /var/log/tor/log
    ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy
    ExtORPort auto
    ORPort 54321
    ServerTransportListenAddr obfs4 0.0.0.0:45321
    

    bitcoin.conf

    proxy=192.168.247.2:9050
    txindex=1
    disablewallet=1
    printtoconsole=1
    rpcuser=user
    rpcpassword=password
    rpcbind=192.168.247.3
    server=1
    listen=1
    torcontrol=192.168.247.2:9051
    torpassword=blabla
    

    What I get

    bitcoind tries to connect to the tor hidden service proxy at 127.0.0.1:9050 (for the record, it is 127.0.0.1 that I did "translate" to localhost).
    See relevant log here after.

    date stream content
    2019-09-23 12:03:54 stdout 2019-09-23T12:03:54Z connect() to 127.0.0.1:9050 failed after select(): Connection refused (111)
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z AddLocal(xyz.onion:8333,4)
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Cached service private key to /bitcoin/.bitcoin/onion_private_key
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Got service ID xyz, advertising service xyz.onion:8333
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: ADD_ONION successful
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Authentication successful
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Using HASHEDPASSWORD authentication
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Supported authentication method: HASHEDPASSWORD
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Connected to Tor version 0.3.5.8
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z tor: Successfully connected!
    2019-09-23 12:03:53 stdout 2019-09-23T12:03:53Z torcontrol thread start

    What I expect

    Following onion option description, I expect bitcoind to connect to the very same ip:host set in proxy, i.e. 192.168.247.2:9050 in the above example.

    Fix

    Adding onion=192.168.247.2:9050 to bitcoin.conf does resolve the issue and result in the very same log without the following error line.

    connect() to 127.0.0.1:9050 failed after select(): Connection refused (111)

    Conclusion

    Obviously, it is not working as described. And so either the description isn't correct - which my little contribution should fix, either the implementation should be corrected to reflect wanted behaviour.

    I hope this clarifies the reason of my pull request. Looking forward at your comments.

  8. qubenix commented at 10:01 PM on September 23, 2019: contributor
  9. laanwj commented at 8:19 AM on September 25, 2019: member

    I think this is wrong, localhost is not special here.

    Yes, this is wrong. Even if tor is running on a different host, -proxy=<host>:<ip> will set both the onion and normal proxy to that.

    If this is somehow not working in your case, that's a bug and please create an issue about that.

  10. laanwj closed this on Sep 25, 2019

  11. DrahtBot locked this on Dec 16, 2021


laanwj

Labels

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: 2026-04-17 09:14 UTC

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