<!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->
I'm using the -torcontrol and -torpassword directives to let bitcoind set up a tor onion service.
<!-- Describe the issue -->
Expected behavior
Bitcoind sets up an onion service and incoming connections will be received via tor.
Actual behavior
In the tor log, I see:
Application asked to connect to port 0. Refusing.
Bitcoind doesn't receive any incoming connections via tor.
<!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->
System information
Bitcoin Core 23.0 on signet or testnet chains, self-compiled Alpine based image, running in Docker 20.10.12 on Ubuntu 22.04 LTS.
tor 0.4.6.10, self-compiled image, running in Docker 20.10.12 on Ubuntu 22.04 LTS.
Both are composed via docker-compose 1.29.2.
<!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->
<!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->
<!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->
<!-- Any extra information that might be useful in the debugging process. -->
<!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->
tor.log:
tor_1 | Apr 25 18:22:13.607 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
tor_1 | Apr 25 18:22:13.607 [notice] Read configuration file "/etc/tor/torrc".
tor_1 | Apr 25 18:22:13.609 [warn] You have a ControlPort set to accept connections from a non-local address. This means that programs not running on your computer can reconfigure your Tor. That's pretty bad, since the controller protocol isn't encrypted! Maybe you should just listen on 127.0.0.1 and use a tool like stunnel or ssh to encrypt remote connections to your control port.
tor_1 | Apr 25 18:22:13.631 [warn] You specified a public address '0.0.0.0:9050' for SocksPort. Other people on the Internet might find your computer and use it as an open proxy. Please don't allow this unless you have a good reason.
tor_1 | Apr 25 18:22:13.631 [warn] You have a ControlPort set to accept connections from a non-local address. This means that programs not running on your computer can reconfigure your Tor. That's pretty bad, since the controller protocol isn't encrypted! Maybe you should just listen on 127.0.0.1 and use a tool like stunnel or ssh to encrypt remote connections to your control port.
tor_1 | Apr 25 18:22:13.631 [notice] Opening Socks listener on 0.0.0.0:9050
tor_1 | Apr 25 18:22:13.631 [notice] Opened Socks listener connection (ready) on 0.0.0.0:9050
tor_1 | Apr 25 18:22:13.631 [notice] Opening Control listener on 0.0.0.0:9051
tor_1 | Apr 25 18:22:13.631 [notice] Opened Control listener connection (ready) on 0.0.0.0:9051
tor_1 | Apr 25 18:22:13.000 [notice] Parsing GEOIP IPv4 file /usr/local/share/tor/geoip.
tor_1 | Apr 25 18:22:13.000 [notice] Parsing GEOIP IPv6 file /usr/local/share/tor/geoip6.
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 0% (starting): Starting
tor_1 | Apr 25 18:22:14.000 [notice] Starting with guard context "default"
tor_1 | Apr 25 18:22:14.000 [notice] New control connection opened from 192.168.32.4.
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 5% (conn): Connecting to a relay
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 10% (conn_done): Connected to a relay
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 14% (handshake): Handshaking with a relay
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 15% (handshake_done): Handshake with a relay done
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 20% (onehop_create): Establishing an encrypted directory connection
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 25% (requesting_status): Asking for networkstatus consensus
tor_1 | Apr 25 18:22:14.000 [notice] Bootstrapped 30% (loading_status): Loading networkstatus consensus
tor_1 | Apr 25 18:22:15.000 [notice] I learned some more directory information, but not enough to build a circuit: We have no usable consensus.
tor_1 | Apr 25 18:22:15.000 [notice] Bootstrapped 40% (loading_keys): Loading authority key certs
tor_1 | Apr 25 18:22:15.000 [notice] The current consensus has no exit nodes. Tor can only build internal paths, such as paths to onion services.
tor_1 | Apr 25 18:22:15.000 [notice] Bootstrapped 45% (requesting_descriptors): Asking for relay descriptors
tor_1 | Apr 25 18:22:15.000 [notice] I learned some more directory information, but not enough to build a circuit: We need more microdescriptors: we have 0/6906, and can only build 0% of likely paths. (We have 0% of guards bw, 0% of midpoint bw, and 0% of end bw (no exits in consensus, using mid) = 0% of path bw.)
tor_1 | Apr 25 18:22:16.000 [notice] Bootstrapped 50% (loading_descriptors): Loading relay descriptors
tor_1 | Apr 25 18:22:17.000 [notice] The current consensus contains exit nodes. Tor can build exit and internal paths.
tor_1 | Apr 25 18:22:18.000 [notice] Bootstrapped 55% (loading_descriptors): Loading relay descriptors
tor_1 | Apr 25 18:22:19.000 [notice] Bootstrapped 61% (loading_descriptors): Loading relay descriptors
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 69% (loading_descriptors): Loading relay descriptors
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 75% (enough_dirinfo): Loaded enough directory info to build circuits
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 80% (ap_conn): Connecting to a relay to build circuits
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 85% (ap_conn_done): Connected to a relay to build circuits
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 89% (ap_handshake): Finishing handshake with a relay to build circuits
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 90% (ap_handshake_done): Handshake finished with a relay to build circuits
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 95% (circuit_create): Establishing a Tor circuit
tor_1 | Apr 25 18:22:21.000 [notice] Bootstrapped 100% (done): Done
tor_1 | Apr 25 18:23:17.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:24:10.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:24:25.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:25:31.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:26:11.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:26:22.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:26:42.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:28:11.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:30:11.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:32:11.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:34:11.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:34:36.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:35:25.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
tor_1 | Apr 25 18:36:11.000 [notice] Application asked to connect to port 0. Refusing.
tor_1 | Apr 25 18:36:30.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.
As you can see, there is an incoming control connection: New control connection opened from 192.168.32.4. (that's my bitcoind container)
Then: Application asked to connect to port 0. Refusing.
bitcoind.log, just in case:
bitcoind_1 | /entrypoint.sh: assuming arguments for bitcoind
bitcoind_1 | /entrypoint.sh: setting data directory to /home/bitcoin/.bitcoin
bitcoind_1 |
bitcoind_1 | Bitcoin Core version v23.0.0 (release build)
bitcoind_1 | Signet derived magic (message start): 0a03cf40
bitcoind_1 | Assuming ancestors of block 00000112852484b5fe3451572368f93cfd2723279af3464e478aee35115256ef have valid signatures.
bitcoind_1 | Setting nMinimumChainWork=000000000000000000000000000000000000000000000000000000de26b0e471
bitcoind_1 | Using the 'x86_shani(1way,2way)' SHA256 implementation
bitcoind_1 | Using RdSeed as additional entropy source
bitcoind_1 | Using RdRand as an additional entropy source
bitcoind_1 | Startup time: 2022-04-25T18:22:12Z
bitcoind_1 | Default data directory /home/bitcoin/.bitcoin
bitcoind_1 | Using data directory /home/bitcoin/.bitcoin/signet
bitcoind_1 | Config file: /home/bitcoin/.bitcoin/bitcoin.conf (not found, skipping)
bitcoind_1 | Command-line arg: blockfilterindex="basic"
bitcoind_1 | Command-line arg: datadir="/home/bitcoin/.bitcoin"
bitcoind_1 | Command-line arg: disablewallet="1"
bitcoind_1 | Command-line arg: discover="1"
bitcoind_1 | Command-line arg: dnsseed="0"
bitcoind_1 | Command-line arg: i2pacceptincoming="1"
bitcoind_1 | Command-line arg: i2psam="i2pd:7656"
bitcoind_1 | Command-line arg: listen="1"
bitcoind_1 | Command-line arg: logtimestamps="0"
bitcoind_1 | Command-line arg: maxconnections="32"
bitcoind_1 | Command-line arg: onion="tor:9050"
bitcoind_1 | Command-line arg: onlynet="i2p"
bitcoind_1 | Command-line arg: onlynet="onion"
bitcoind_1 | Command-line arg: par="2"
bitcoind_1 | Command-line arg: peerblockfilters="1"
bitcoind_1 | Command-line arg: peerbloomfilters="1"
bitcoind_1 | Command-line arg: rpcallowip="0.0.0.0/0"
bitcoind_1 | Command-line arg: rpcauth=****
bitcoind_1 | Command-line arg: rpcbind=****
bitcoind_1 | Command-line arg: rpcthreads="2"
bitcoind_1 | Command-line arg: signet="1"
bitcoind_1 | Command-line arg: torcontrol="tor:9051"
bitcoind_1 | Command-line arg: torpassword=****
bitcoind_1 | Command-line arg: txindex="1"
bitcoind_1 | Using at most 32 automatic connections (1048576 file descriptors available)
bitcoind_1 | Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
bitcoind_1 | Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
bitcoind_1 | Script verification uses 1 additional threads
bitcoind_1 | Wallet disabled!
bitcoind_1 | scheduler thread start
bitcoind_1 | WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet
bitcoind_1 | HTTP: creating work queue of depth 16
bitcoind_1 | Using random cookie authentication.
bitcoind_1 | Generated RPC authentication cookie /home/bitcoin/.bitcoin/signet/.cookie
bitcoind_1 | Using rpcauth authentication.
bitcoind_1 | HTTP: starting 2 worker threads
bitcoind_1 | Using /16 prefix for IP bucketing
bitcoind_1 | init message: Loading P2P addresses…
bitcoind_1 | Loaded 59 addresses from peers.dat 1ms
bitcoind_1 | init message: Loading banlist…
bitcoind_1 | SetNetworkActive: true
bitcoind_1 | Cache configuration:
bitcoind_1 | * Using 2.0 MiB for block index database
bitcoind_1 | * Using 56.0 MiB for transaction index database
bitcoind_1 | * Using 49.0 MiB for basic block filter index database
bitcoind_1 | * Using 8.0 MiB for chain state database
bitcoind_1 | * Using 335.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
bitcoind_1 | init message: Loading block index…
bitcoind_1 | Switching active chainstate to Chainstate [ibd] @ height -1 (null)
bitcoind_1 | Opening LevelDB in /home/bitcoin/.bitcoin/signet/blocks/index
bitcoind_1 | Opened LevelDB successfully
bitcoind_1 | Using obfuscation key for /home/bitcoin/.bitcoin/signet/blocks/index: 0000000000000000
bitcoind_1 | LoadBlockIndexDB: last block file = 3
bitcoind_1 | LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=2325, size=13230151, heights=85238...87562, time=2022-04-10...2022-04-25)
bitcoind_1 | Checking all blk files are present...
bitcoind_1 | Opening LevelDB in /home/bitcoin/.bitcoin/signet/chainstate
bitcoind_1 | Opened LevelDB successfully
bitcoind_1 | Using obfuscation key for /home/bitcoin/.bitcoin/signet/chainstate: 5f5400e5be1d375a
bitcoind_1 | Loaded best chain: hashBestChain=00000158896b9a56d815300f485b244d183936eb787c88eab0ba1cf3e2d8fcaf height=87562 date=2022-04-25T18:01:20Z progress=0.999890
bitcoind_1 | init message: Verifying blocks…
bitcoind_1 | Verifying last 6 blocks at level 3
bitcoind_1 | [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
bitcoind_1 | No coin database inconsistencies in last 6 blocks (139 transactions)
bitcoind_1 | block index 1038ms
bitcoind_1 | Opening LevelDB in /home/bitcoin/.bitcoin/signet/indexes/txindex
bitcoind_1 | Opened LevelDB successfully
bitcoind_1 | Using obfuscation key for /home/bitcoin/.bitcoin/signet/indexes/txindex: 0000000000000000
bitcoind_1 | txindex thread start
bitcoind_1 | Opening LevelDB in /home/bitcoin/.bitcoin/signet/indexes/blockfilter/basic/db
bitcoind_1 | txindex is enabled at height 87562
bitcoind_1 | txindex thread exit
bitcoind_1 | Opened LevelDB successfully
bitcoind_1 | Using obfuscation key for /home/bitcoin/.bitcoin/signet/indexes/blockfilter/basic/db: 0000000000000000
bitcoind_1 | basic block filter index thread start
bitcoind_1 | basic block filter index is enabled at height 87562
bitcoind_1 | basic block filter index thread exit
bitcoind_1 | loadblk thread start
bitcoind_1 | block tree size = 87568
bitcoind_1 | nBestHeight = 87562
bitcoind_1 | torcontrol thread start
bitcoind_1 | Leaving InitialBlockDownload (latching to false)
bitcoind_1 | Bound to 127.0.0.1:38334
bitcoind_1 | Bound to [::]:38333
bitcoind_1 | Bound to 0.0.0.0:38333
bitcoind_1 | Loaded 0 addresses from "anchors.dat"
bitcoind_1 | 0 block-relay-only anchors will be tried for connections.
bitcoind_1 | init message: Starting network threads…
bitcoind_1 | DNS seeding disabled
bitcoind_1 | net thread start
bitcoind_1 | msghand thread start
bitcoind_1 | i2paccept thread start
bitcoind_1 | opencon thread start
bitcoind_1 | addcon thread start
bitcoind_1 | init message: Done loading
bitcoind_1 | Imported mempool transactions from disk: 47 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
bitcoind_1 | loadblk thread exit
bitcoind_1 | tor: Got service ID xxx, advertising service xxx.onion:38333
bitcoind_1 | AddLocal(xxx.onion:38333,4)
bitcoind_1 | I2P: SAM session created: session id=eeb28ebf5c, my address=xxx.b32.i2p:0
bitcoind_1 | AddLocal(xxx.b32.i2p:0,4)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=1 (outbound-full-relay)
bitcoind_1 | UpdateTip: new best=000000dd9afeb8d7a6e63dbf99aac137e38dc73d9acd6f58de0a0366c388681d height=87563 version=0x20000000 log2_work=39.945971 tx=1584892 date='2022-04-25T18:22:58Z' progress=0.999999 cache=0.0MiB(115txo)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=2 (outbound-full-relay)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=3 (outbound-full-relay)
bitcoind_1 | Socks5() connect to m42cdyruu4g4mcrbku4q5faklcr6wa3yq2syu4f6ga634nc2uc5w5vad.onion:38333 failed: host unreachable
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=4 (outbound-full-relay)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=5 (outbound-full-relay)
bitcoind_1 | Socks5() connect to cr423k6sqllxbvtd4nvriy5dvqijly2eaxewjjvxxqjzjba2p2ggqdid.onion:38333 failed: host unreachable
bitcoind_1 | Socks5() connect to qscbjfqbglaoge2juooutgliw7uipjoyrs2puy5key23vcpl3j3eirqd.onion:38333 failed: host unreachable
bitcoind_1 | Socks5() connect to qb77j7stj2sq3ags3nn4gmfs3ts6k7xwyc5sxows7k5ugn36a3cljyyd.onion:38333 failed: host unreachable
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=7 (outbound-full-relay)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=8 (outbound-full-relay)
bitcoind_1 | Socks5() connect to d27tvdmi6wjjlffjyhm5mogwsw3433jxkaiwhti32eagvljdzseilqqd.onion:38333 failed: host unreachable
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=9 (outbound-full-relay)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=10 (block-relay-only)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87563, peer=11 (block-relay-only)
bitcoind_1 | Socks5() connect to okdqiz5nlhsoofaorxgjbrmqnywkxvlr3eswytjdtyx5ktljnfwc3lid.onion:38333 failed: host unreachable
bitcoind_1 | Socks5() connect to tm7eh4voltdm25wexfsyh6hzvdvmhgjjj4jbdr7lzaihb5ejivkcakqd.onion:38333 failed: host unreachable
bitcoind_1 | Socks5() connect to 3ysg6mt5toaa4pfg2onva2pmoyo7swxkziv6i3bjuejp7qg5etz6m5id.onion:38333 failed: host unreachable
bitcoind_1 | Socks5() connect to m42cdyruu4g4mcrbku4q5faklcr6wa3yq2syu4f6ga634nc2uc5w5vad.onion:38333 failed: host unreachable
bitcoind_1 | UpdateTip: new best=0000015583b391d8b8017d50356ad231fd60d97d5b6974a1a4a42bcdb386d6bc height=87564 version=0x20000000 log2_work=39.945988 tx=1584908 date='2022-04-25T18:37:20Z' progress=1.000000 cache=0.0MiB(131txo)
bitcoind_1 | New outbound peer connected: version: 70016, blocks=87564, peer=12 (block-relay-only)
bitcoind_1 | Socks5() connect to cr423k6sqllxbvtd4nvriy5dvqijly2eaxewjjvxxqjzjba2p2ggqdid.onion:38333 failed: host unreachable
bitcoind_1 | Socks5() connect to okdqiz5nlhsoofaorxgjbrmqnywkxvlr3eswytjdtyx5ktljnfwc3lid.onion:38333 failed: host unreachable