Skip to content

Commit 65e9ca2

Browse files
committed
Merge bitcoin/bitcoin#24555: doc: create initial doc/cjdns.md for CJDNS how-to documentation
f44efc3 doc: update i2p.md with cjdns, improve local addresses section (Jon Atack) 3bf6f0c doc: update tor.md with cjdns and getnodeaddresses, fix tor grep, (Jon Atack) ed15848 doc: create initial doc/cjdns.md for cjdns how-to documentation (Jon Atack) Pull request description: and update and improve doc/tor.md and doc/i2p.md. Adapted in part from the CJDNS description in bitcoin/bitcoin#23077 and feedback by Vasil Dimov and from the CJDNS documentation and feedback by Caleb James DeLisle. Targets backport to v23.x. Co-authored-by: Vasil Dimov <[email protected]> ACKs for top commit: vasild: ACK f44efc3 lsilva01: ACK f44efc3 Tree-SHA512: 7b7c69f76bc8a5705d324892f32bfe0eb21bcf048054748053eca167c65a2121f6332f40ac6ff98c955e6e8b53233c74c365d887c364ef1d5944f1c49675a6b4
2 parents 0a14a16 + f44efc3 commit 65e9ca2

File tree

3 files changed

+107
-9
lines changed

3 files changed

+107
-9
lines changed

doc/cjdns.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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).
14+
15+
Compared to IPv4/IPv6, CJDNS provides end-to-end encryption and protects nodes
16+
from traffic analysis and filtering.
17+
18+
Used with Tor and I2P, CJDNS is a complementary option that can enhance network
19+
redundancy and robustness for both the Bitcoin network and individual nodes.
20+
21+
Each network has different characteristics. For instance, Tor is widely used but
22+
somewhat centralized. I2P connections have a source address and I2P is slow.
23+
CJDNS is fast but does not hide the sender and the recipient from intermediate
24+
routers.
25+
26+
## Installing CJDNS and connecting to the network
27+
28+
To install and set up CJDNS, follow the instructions at
29+
https://github.com/cjdelisle/cjdns#cjdns.
30+
31+
Don't skip steps
32+
["2. Find a friend"](https://github.com/cjdelisle/cjdns#2-find-a-friend) and
33+
["3. Connect your node to your friend's
34+
node"](https://github.com/cjdelisle/cjdns#3-connect-your-node-to-your-friends-node).
35+
You need to be connected to the CJDNS network before it will work with your
36+
Bitcoin Core node.
37+
38+
Typically, CJDNS might be launched from its directory with
39+
`sudo ./cjdroute < cjdroute.conf` and it sheds permissions after setting up the
40+
[TUN](https://en.wikipedia.org/wiki/TUN/TAP) interface. You may also [launch it as an
41+
unprivileged user](https://github.com/cjdelisle/cjdns/blob/master/doc/non-root-user.md)
42+
with some additional setup.
43+
44+
The network connection can be checked by running `./tools/peerStats` from the
45+
CJDNS directory.
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](https://github.com/bitcoin/bitcoin/blob/master/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+
To see which CJDNS addresses your node knows, use the `getnodeaddresses 0 cjdns`
95+
RPC.

doc/i2p.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ phase when syncing up a new node can be very slow. This phase can be sped up by
8080
using other networks, for instance `onlynet=onion`, at the same time.
8181

8282
In general, a node can be run with both onion and I2P hidden services (or
83-
any/all of IPv4/IPv6/onion/I2P), which can provide a potential fallback if one
84-
of the networks has issues.
83+
any/all of IPv4/IPv6/onion/I2P/CJDNS), which can provide a potential fallback if
84+
one of the networks has issues.
8585

8686
## I2P-related information in Bitcoin Core
8787

8888
There are several ways to see your I2P address in Bitcoin Core:
89-
- in the debug log (grep for `AddLocal`, the I2P address ends in `.b32.i2p`)
90-
- in the output of the `getnetworkinfo` RPC in the "localaddresses" section
91-
- in the output of `bitcoin-cli -netinfo` peer connections dashboard
89+
- in the "Local addresses" output of CLI `-netinfo`
90+
- in the "localaddresses" output of RPC `getnetworkinfo`
91+
- in the debug log (grep for `AddLocal`; the I2P address ends in `.b32.i2p`)
9292

9393
To see which I2P peers your node is connected to, use `bitcoin-cli -netinfo 4`
9494
or the `getpeerinfo` RPC (e.g. `bitcoin-cli getpeerinfo`).

doc/tor.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ configure Tor.
1616
## How to see information about your Tor configuration via Bitcoin Core
1717

1818
There are several ways to see your local onion address in Bitcoin Core:
19-
- in the debug log (grep for "tor:" or "AddLocal")
20-
- in the output of RPC `getnetworkinfo` in the "localaddresses" section
21-
- in the output of the CLI `-netinfo` peer connections dashboard
19+
- in the "Local addresses" output of CLI `-netinfo`
20+
- in the "localaddresses" output of RPC `getnetworkinfo`
21+
- in the debug log (grep for "AddLocal"; the Tor address ends in `.onion`)
2222

2323
You may set the `-debug=tor` config logging option to have additional
2424
information in the debug log about your Tor configuration.
@@ -27,6 +27,9 @@ CLI `-addrinfo` returns the number of addresses known to your node per
2727
network. This can be useful to see how many onion peers your node knows,
2828
e.g. for `-onlynet=onion`.
2929

30+
To fetch a number of onion addresses that your node knows, for example seven
31+
addresses, use the `getnodeaddresses 7 onion` RPC.
32+
3033
## 1. Run Bitcoin Core behind a Tor proxy
3134

3235
The first step is running Bitcoin Core behind a Tor proxy. This will already anonymize all
@@ -58,7 +61,7 @@ outgoing connections, but more is possible.
5861
-onlynet=onion Make automatic outbound connections only to .onion addresses.
5962
Inbound and manual connections are not affected by this option.
6063
It can be specified multiple times to allow multiple networks,
61-
e.g. onlynet=onion, onlynet=i2p.
64+
e.g. onlynet=onion, onlynet=i2p, onlynet=cjdns.
6265

6366
In a typical situation, this suffices to run behind a Tor proxy:
6467

0 commit comments

Comments
 (0)