bitcoin: Error: Cannot resolve -bind address: 'bitcoind:8334=onion'

In my quest to finally fix #25094, I figured I need to bind the onion listen port explicitly to the external interface (bitcoind), not to “all interfaces” ([::]). So I’m using the argument

-bind=bitcoind:${BITCOIND_TOR_PORT}=onion

/etc/hostname is set to bitcoind and the hostname command yields the expected result. Also, both nslookup and ping can resolve the hostname to the external IP.

Note: I cannot use the numerical IP, because Docker assigns IP addresses dynamically on each invocation.

Expected behavior

I’d expect bitcoind to also resolve the hostname to my external IP, just like ping and nslookup do.

Actual behavior

In short, it dies.

bitcoind_1          | Error: Cannot resolve -bind address: 'bitcoind:8334=onion'
bitcoind_1          | Shutdown: In progress...
bitcoind_1          | Error: Cannot resolve -bind address: 'bitcoind:8334=onion'
bitcoind_1          | Shutdown: done

System information

bitcoind 24.0rc4 (self built), Docker+Compose from Ubuntu 22.04.1.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

To summarize, @schildbach, correct me if I am wrong - there are two issues:

  1. bitcoind does not resolve the argument to -bind=..., so an IP address must be provided by the user. It is a feature request to change the behavior.
  2. If bitcoind listens on 0.0.0.0 or :: for incoming tor connections, then it would tell the tor daemon to connect to that address. This is a bug that could be resolved by https://github.com/bitcoin/bitcoin/pull/22729#issuecomment-927802257.

It has been like this since the start and is not a regression from a previous version. There is no patch for either one at the moment.