Can bitcoind listen on both ipv4 and ipv6? I know it can make outbound connections on both (onion and i2p) but can it also advertise multiple public hosts if available?
This question was asked by pinheadmz on IRC.
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.Sign up to join this community
Yes you can specify
-externalip multiple times.
The config option
-externalip allows you to specify your own public reachable address. This can also be an onion address.
From the Bitcoin Core Tor documentation:
The one that will be rumoured to a particular peer is the most compatible one and also using heuristics, e.g. the address with the most incoming connections, etc.
Additional context from IRC: Bitcoin Core listens on ipv6, but as the ipv4 address space is embedded in ipv6, that means you can also accept ipv4 connections that way (they'll look like they come from the ipv4-embedded in-ipv6 address). That happens automatically unless you use
-nolisten or specifically set a bind address with
-bind. Advertizing addresses is completely independent from listening on them. Pre-BIP155 addr rumouring used a flat ipv6 namespace with ipv4 and Tor v2 addresses embedded in subranges of that space. Since BIP155 with addrv2 every address has an explicit network identifier.