CJDNS overview
CJDNS is like a distributed, shared VPN with multiple entry points where every participant can reach any other participant. All participants use addresses from the fc00::/8
network (reserved IPv6 range). Installation and configuration is done outside of applications, similarly to VPN (either in the host/OS or on the network router).
Motivation
Even without this PR it is possible to connect two Bitcoin Core nodes through CJDNS manually by using e.g. -addnode
in environments where CJDNS is set up. However, this PR is necessary for address relay to work properly and automatic connections to be made to CJDNS peers. I.e. to make CJDNS a first class citizen network like IPv4, IPv6, Tor and I2P.
Considerations
An address from the fc00::/8
network, could mean two things:
- Part of a local network, as defined in RFC 4193. Like
10.0.0.0/8
. Bitcoin Core could be running on a machine with such address and have peers with those (e.g. in a local network), but those addresses are not relayed to other peers because they are not globally routable on the internet. - Part of the CJDNS network. This is like Tor or I2P - if we have connectivity to that network then we could reach such peers and we do relay them to other peers.
So, Bitcoin Core needs to be able to tell which one is it when it encounters a bare fc00::/8
address, e.g. from -externalip=
or by looking up the machine’s own addresses. Thus a new config option is introduced -cjdnsreachable
:
-cjdnsreachable=0
: it is assumed afc00::/8
address is a private IPv6 (1.)-cjdnsreachable=1
: it is assumed afc00::/8
address is a CJDNS one (2.)
After setting up CJDNS outside of Bitcoin Core, a node operator only needs to enable this option. Addresses from P2P relay/gossip don’t need that because they are properly tagged as IPv6 or as CJDNS.
For testing
0[fc32:17ea:e415:c3bf:9808:149d:b5a2:c9aa]:8333
1[fc68:7026:cb27:b014:5910:e609:dcdb:22a2]:8333
2[fcb3:dc50:e1ae:7998:7dc0:7fa6:4582:8e46]:8333
3[fcc7:be49:ccd1:dc91:3125:f0da:457d:8ce]:8333
4[fcf2:d9e:3a25:4eef:8f84:251b:1b4d:c596]:8333