cjdns.md
1 # CJDNS support in Bitcoin Core 2 3 It is possible to run Bitcoin Core over CJDNS, an encrypted IPv6 network that 4 uses public-key cryptography for address allocation and a distributed hash table 5 for routing. 6 7 ## What is CJDNS? 8 9 CJDNS is like a distributed, shared VPN with multiple entry points where every 10 participant can reach any other participant. All participants use addresses from 11 the `fc00::/8` network (reserved IPv6 range). Installation and configuration is 12 done outside of Bitcoin Core, similarly to a VPN (either in the host/OS or on 13 the network router). See https://github.com/cjdelisle/cjdns#readme for more 14 information. 15 16 Compared to IPv4/IPv6, CJDNS provides end-to-end encryption and protects nodes 17 from traffic analysis and filtering. 18 19 Used with Tor and I2P, CJDNS is a complementary option that can enhance network 20 redundancy and robustness for both the Bitcoin network and individual nodes. 21 22 Each network has different characteristics. For instance, Tor is widely used but 23 somewhat centralized. I2P connections have a source address and I2P is slow. 24 CJDNS is fast but does not hide the sender and the recipient from intermediate 25 routers. 26 27 ## Installing CJDNS 28 29 To install and set up CJDNS, follow the instructions at 30 https://github.com/cjdelisle/cjdns#how-to-install-cjdns. 31 32 ## Connecting to the CJDNS network 33 34 As of CJDNS v22, nodes automatically discover and connect to peers via DNS 35 seeding. After installation, you can verify that your node has peers: 36 37 cjdnstool peers show 38 39 If you see peers with status `ESTABLISHED`, your node is connected and no 40 further peering setup is needed. 41 42 Manual peering may be useful if you want to guarantee a connection to a 43 specific node, or if you have disabled DNS seeding for privacy reasons. See 44 [doc/peering.md](https://github.com/cjdelisle/cjdns/blob/master/doc/peering.md) 45 in the CJDNS repository for details. 46 47 ## Run Bitcoin Core with CJDNS 48 49 Once you are connected to the CJDNS network, the following Bitcoin Core 50 configuration option makes CJDNS peers automatically reachable: 51 52 ``` 53 -cjdnsreachable 54 ``` 55 56 When enabled, this option tells Bitcoin Core that it is running in an 57 environment where a connection to an `fc00::/8` address will be to the CJDNS 58 network instead of to an [RFC4193](https://datatracker.ietf.org/doc/html/rfc4193) 59 IPv6 local network. This helps Bitcoin Core perform better address management: 60 - Your node can consider incoming `fc00::/8` connections to be from the CJDNS 61 network rather than from an IPv6 private one. 62 - If one of your node's local addresses is `fc00::/8`, then it can choose to 63 gossip that address to peers. 64 65 ## Additional configuration options related to CJDNS 66 67 ``` 68 -onlynet=cjdns 69 ``` 70 71 Make automatic outbound connections only to CJDNS addresses. Inbound and manual 72 connections are not affected by this option. It can be specified multiple times 73 to allow multiple networks, e.g. onlynet=cjdns, onlynet=i2p, onlynet=onion. 74 75 CJDNS support was added to Bitcoin Core in version 23.0 and there may be fewer 76 CJDNS peers than Tor or IP ones. You can use `bitcoin-cli -addrinfo` to see the 77 number of CJDNS addresses known to your node. 78 79 In general, a node can be run with both an onion service and CJDNS (or any/all 80 of IPv4/IPv6/onion/I2P/CJDNS), which can provide a potential fallback if one of 81 the networks has issues. There are a number of ways to configure this; see 82 [doc/tor.md](/doc/tor.md) for 83 details. 84 85 ## CJDNS-related information in Bitcoin Core 86 87 There are several ways to see your CJDNS address in Bitcoin Core: 88 - in the "Local addresses" output of CLI `-netinfo` 89 - in the "localaddresses" output of RPC `getnetworkinfo` 90 91 To see which CJDNS peers your node is connected to, use `bitcoin-cli -netinfo 4` 92 or the `getpeerinfo` RPC (i.e. `bitcoin-cli getpeerinfo`). 93 94 You can use the `getnodeaddresses` RPC to fetch a number of CJDNS peers known to your node; run `bitcoin-cli help getnodeaddresses` for details. 95 96 `bitcoin rpc` can also be substituted for `bitcoin-cli`.