doc: create initial doc/cjdns.md for CJDNS how-to documentation #24555

pull jonatack wants to merge 3 commits into bitcoin:master from jonatack:cjdns-doc changing 3 files +107 −9
  1. jonatack commented at 10:19 am on March 14, 2022: member

    and update and improve doc/tor.md and doc/i2p.md.

    Adapted in part from the CJDNS description in #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 vd@FreeBSD.org

  2. fanquake added the label Docs on Mar 14, 2022
  3. jonatack force-pushed on Mar 14, 2022
  4. jonatack commented at 8:21 pm on March 16, 2022: member
    Pinging people who have installed CJDNS and run bitcoind with it per #23077 reviews and or/have a CJDNS node up: @dunxen @vasild @jamesob @cjdelisle
  5. in doc/cjdns.md:38 in 3fde801d3f outdated
    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 with `./cjdroute < cjdroute.conf >
    


    cjdelisle commented at 10:08 pm on March 16, 2022:
    You may consider mentioning sudo or CAP_NET_ADMIN to allow it to spawn a tun device.

    jonatack commented at 10:25 pm on March 16, 2022:
    Sure. How would you suggest phrasing it here?

    cjdelisle commented at 0:33 am on March 17, 2022:

    Maybe:

    Typically, CJDNS might be launched with sudo ./cjdroute < cjdroute.conf and it sheds permissions after setting up the TUN device. You may also launch it as an unprivileged user with some additional setup.


    jonatack commented at 1:09 am on March 17, 2022:
    Done. Thanks!

    jonatack commented at 8:58 am on March 17, 2022:
    Good that you mentioned the sudo and “running it as non-root” page, I had forgotten about those since setting it up.
  6. in doc/cjdns.md:39 in 3fde801d3f outdated
    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 with `./cjdroute < cjdroute.conf >
    39+cjdroute.log` and the network connection checked with `./tools/peerStats`.
    


    cjdelisle commented at 10:09 pm on March 16, 2022:
    > cjdroute.log is not particularly useful in the default mode, it just prints a few lines of startup stuff. And if you set it to log to stdout, it will fill your harddrive quickly, so that’s a bad idea. I would recommend no >

    jonatack commented at 10:24 pm on March 16, 2022:
    Thanks, dropped.
  7. cjdelisle commented at 10:14 pm on March 16, 2022: none
    ACK on the content of cjdns.md, other files I am not qualified.
  8. jonatack force-pushed on Mar 17, 2022
  9. jonatack commented at 1:12 am on March 17, 2022: member

    Updated with feedback from @cjdelisle (thanks!)

     0diff --git a/doc/cjdns.md b/doc/cjdns.md
     1index 5b4e112b90..482d861af6 100644
     2--- a/doc/cjdns.md
     3+++ b/doc/cjdns.md
     4@@ -16,7 +16,7 @@ Compared to IPv4/IPv6, CJDNS provides end-to-end encryption and protects nodes
     5 from traffic analysis and filtering.
     6 
     7 Used with Tor and I2P, CJDNS is a complementary option that can enhance network
     8-redundancy and robustness for both the Bitcoin network and the individual node.
     9+redundancy and robustness for both the Bitcoin network and individual nodes.
    10 
    11 Each network has different characteristics. For instance, Tor is widely used but
    12 somewhat centralized. I2P connections have a source address and I2P is slow.
    13@@ -35,8 +35,13 @@ node"](https://github.com/cjdelisle/cjdns#3-connect-your-node-to-your-friends-no
    14 You need to be connected to the CJDNS network before it will work with your
    15 Bitcoin Core node.
    16 
    17-Typically, CJDNS might be launched with `./cjdroute < cjdroute.conf >
    18-cjdroute.log` and the network connection checked with `./tools/peerStats`.
    19+Typically, CJDNS might be launched with `sudo ./cjdroute < cjdroute.conf` and it
    20+sheds permissions after setting up the [TUN](https://en.wikipedia.org/wiki/TUN/TAP)
    21+device. You may also [launch it as an unprivileged
    22+user](https://github.com/cjdelisle/cjdns/blob/master/doc/non-root-user.md) with
    23+some additional setup.
    24+
    25+The network connection can be checked with `./tools/peerStats`.
    
  10. cjdelisle commented at 1:12 am on March 17, 2022: none
    ACK without reservation on cjdns.md
  11. dunxen commented at 5:31 am on March 17, 2022: contributor

    ACK a69ef4b

    Looks good to me! And thanks for mentioning the “don’t skip these steps” part. I think one of those was mostly the trouble people had because we skipped it 😅

  12. jonatack commented at 8:56 am on March 17, 2022: member

    Looks good to me! And thanks for mentioning the “don’t skip these steps” part. I think one of those was mostly the trouble people had because we skipped it 😅

    Yes! I skipped those and so did a couple others 🙂

  13. laanwj added this to the "Blockers" column in a project

  14. in doc/cjdns.md:40 in a69ef4be5a outdated
    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 with `sudo ./cjdroute < cjdroute.conf` and it
    39+sheds permissions after setting up the [TUN](https://en.wikipedia.org/wiki/TUN/TAP)
    40+device. You may also [launch it as an unprivileged
    


    vasild commented at 11:07 am on March 18, 2022:
    nit: I think “TUN interface” is more widely used than “TUN device”

    jonatack commented at 12:47 pm on March 18, 2022:
    done
  15. in doc/cjdns.md:44 in a69ef4be5a outdated
    39+sheds permissions after setting up the [TUN](https://en.wikipedia.org/wiki/TUN/TAP)
    40+device. You may also [launch it as an unprivileged
    41+user](https://github.com/cjdelisle/cjdns/blob/master/doc/non-root-user.md) with
    42+some additional setup.
    43+
    44+The network connection can be checked with `./tools/peerStats`.
    


    vasild commented at 11:10 am on March 18, 2022:
    nit: here and above in ./cjdroute command - could that be misinterpreted as tools/peerStats being in the Bitcoin Core source repository? Maybe something like $CJDNS/tools/peerStats would be more clear?

    jonatack commented at 12:58 pm on March 18, 2022:
    updated, thanks
  16. in doc/cjdns.md:58 in a69ef4be5a outdated
    53+```
    54+
    55+With this option enabled, if your node connects to `fc00::/8` addresses, they
    56+will lead to the CJDNS network. Without the option and by default, they will
    57+lead to an IPv6 local network as defined in
    58+[RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193).
    


    vasild commented at 11:15 am on March 18, 2022:

    This gives the wrong impression that Bitcoin Core will decide to connect to CJDNS instead of the private IPv6 network based on -cjdnsreachable. That is not the case. This option merely tells Bitcoin Core that it is running in such an environment that connecting to a fc00::/8 address will result in connecting to the CJDNS network, not the IPv6 private network. Given a peer like [fc12::34]:8333 Bitcoin Core cannot choose between CJDNS vs IPv6-private. I am not sure how to make this more explicit in the text above.

    The -cjdnsreachable option helps Bitcoin Core do better address management. Like, if one of its local addresses is fc00::/8 and -cjdnsreachable is set, then it may choose to gossip that address to others. Also, making it possible to distinguish whether an incoming connection from fc00::/8 comes from the CJDNS network or from a IPv6-private one.


    jonatack commented at 1:28 pm on March 18, 2022:
    Great feedback. I’ll try to improve it.

    jonatack commented at 4:54 pm on March 21, 2022:
    Done
  17. in doc/cjdns.md:75 in a69ef4be5a outdated
    70+CJDNS support was added to Bitcoin Core in version 23.0 and there may be fewer
    71+CJDNS peers than Tor or IP ones. You can use `bitcoin-cli -addrinfo` to see the
    72+number of CJDNS addresses known to your node.
    73+
    74+Another consideration with `onlynet=cjdns` is that the initial blocks download
    75+phase when syncing up a new node can be slow. This phase can be sped up by using
    


    jonatack commented at 11:20 am on March 18, 2022:
    Thinking of rephrasing this sentence, as no one has reported slow IBD with -onlynet=cjdns yet, but perhaps no one has tried.

    jonatack commented at 12:47 pm on March 18, 2022:
    dropped
  18. in doc/cjdns.md:76 in a69ef4be5a outdated
    71+CJDNS peers than Tor or IP ones. You can use `bitcoin-cli -addrinfo` to see the
    72+number of CJDNS addresses known to your node.
    73+
    74+Another consideration with `onlynet=cjdns` is that the initial blocks download
    75+phase when syncing up a new node can be slow. This phase can be sped up by using
    76+other networks, for instance `onlynet=onion`, at the same time.
    


    vasild commented at 11:33 am on March 18, 2022:
    CJDNS definitely does not have the “slow” issue like I2P. I would assume that the bottleneck in IBD is the same as with IPv4 / IPv6. I may be wrong. But in any case, I think that if we have not confirmed that it is slow, then better not to mention that it is slow. If we have not confirmed that it is fast, then better not to mention that it is fast. I think it is ok not to mention anything about speed here.

    jonatack commented at 12:46 pm on March 18, 2022:
    done
  19. in doc/cjdns.md:78 in a69ef4be5a outdated
    73+
    74+Another consideration with `onlynet=cjdns` is that the initial blocks download
    75+phase when syncing up a new node can be slow. This phase can be sped up by using
    76+other networks, for instance `onlynet=onion`, at the same time.
    77+
    78+In general, a node can be run with both onion and CJDNS hidden services (or
    


    vasild commented at 11:35 am on March 18, 2022:

    CJDNS does not have hidden services:

    0In general, a node can be run with both onion hidden services and CJDNS (or
    

    jonatack commented at 12:40 pm on March 18, 2022:
    good catch, done
  20. in doc/cjdns.md:91 in a69ef4be5a outdated
    86+- in the "localaddresses" output of RPC `getnetworkinfo`
    87+
    88+To see which CJDNS peers your node is connected to, use `bitcoin-cli -netinfo 4`
    89+or the `getpeerinfo` RPC (i.e. `bitcoin-cli getpeerinfo`).
    90+
    91+To see which CJDNS addresses your node knows, use the `getnodeaddresses 0 "cjdns"`
    


    vasild commented at 11:38 am on March 18, 2022:
    nit: may drop the quotes around "cjdns" (same in tor and i2p docs).

    jonatack commented at 11:51 am on March 18, 2022:
    Yes, we don’t need the quotes for linux/freebsd AFAIK, and I don’t use them, but I seem to recall in other pulls that someone using macOS (maybe with an older or different shell) needed them.

    jonatack commented at 12:37 pm on March 18, 2022:
    Dropped them as you suggest.
  21. vasild commented at 11:43 am on March 18, 2022: member
    Thank you!
  22. jonatack force-pushed on Mar 21, 2022
  23. jonatack commented at 5:00 pm on March 21, 2022: member

    Thanks for the excellent feedback @vasild; updated.

     0diff --git a/doc/cjdns.md b/doc/cjdns.md
     1index 482d861af6..220a95e742 100644
     2--- a/doc/cjdns.md
     3+++ b/doc/cjdns.md
     4@@ -35,13 +35,14 @@ node"](https://github.com/cjdelisle/cjdns#3-connect-your-node-to-your-friends-no
     5 You need to be connected to the CJDNS network before it will work with your
     6 Bitcoin Core node.
     7 
     8-Typically, CJDNS might be launched with `sudo ./cjdroute < cjdroute.conf` and it
     9-sheds permissions after setting up the [TUN](https://en.wikipedia.org/wiki/TUN/TAP)
    10-device. You may also [launch it as an unprivileged
    11-user](https://github.com/cjdelisle/cjdns/blob/master/doc/non-root-user.md) with
    12-some additional setup.
    13+Typically, CJDNS might be launched from its directory with
    14+`sudo ./cjdroute < cjdroute.conf` and it sheds permissions after setting up the
    15+[TUN](https://en.wikipedia.org/wiki/TUN/TAP) interface. You may also [launch it as an
    16+unprivileged user](https://github.com/cjdelisle/cjdns/blob/master/doc/non-root-user.md)
    17+with some additional setup.
    18 
    19-The network connection can be checked with `./tools/peerStats`.
    20+The network connection can be checked by running `./tools/peerStats` from the
    21+CJDNS directory.
    22 
    23 ## Run Bitcoin Core with CJDNS
    24 
    25@@ -52,10 +53,14 @@ configuration option makes CJDNS peers automatically reachable:
    26 
    27-With this option enabled, if your node connects to `fc00::/8` addresses, they
    28-will lead to the CJDNS network. Without the option and by default, they will
    29-lead to an IPv6 local network as defined in
    30-[RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193).
    31+When enabled, this option tells Bitcoin Core that it is running in an
    32+environment where a connection to an `fc00::/8` address will be to the CJDNS
    33+network instead of to an [RFC4193](https://datatracker.ietf.org/doc/html/rfc4193)
    34+IPv6 local network. This helps Bitcoin Core perform better address management:
    35+  - Your node can consider incoming `fc00::/8` connections to be from the CJDNS
    36+    network rather than from an IPv6 private one.
    37+  - If one of your node's local addresses is `fc00::/8`, then it can choose to
    38+    gossip that address to peers.
    39 
    40 ## Additional configuration options related to CJDNS
    41 
    42@@ -71,11 +76,7 @@ CJDNS support was added to Bitcoin Core in version 23.0 and there may be fewer
    43 CJDNS peers than Tor or IP ones. You can use `bitcoin-cli -addrinfo` to see the
    44 number of CJDNS addresses known to your node.
    45 
    46-Another consideration with `onlynet=cjdns` is that the initial blocks download
    47-phase when syncing up a new node can be slow. This phase can be sped up by using
    48-other networks, for instance `onlynet=onion`, at the same time.
    49-
    50-In general, a node can be run with both onion and CJDNS hidden services (or
    51+In general, a node can be run with both an onion hidden service and CJDNS (or
    52 any/all of IPv4/IPv6/onion/I2P/CJDNS), which can provide a potential fallback if
    53 one of the networks has issues.
    54 
    55@@ -88,5 +89,5 @@ There are several ways to see your CJDNS address in Bitcoin Core:
    56 To see which CJDNS peers your node is connected to, use `bitcoin-cli -netinfo 4`
    57 or the `getpeerinfo` RPC (i.e. `bitcoin-cli getpeerinfo`).
    58 
    59-To see which CJDNS addresses your node knows, use the `getnodeaddresses 0 "cjdns"`
    60+To see which CJDNS addresses your node knows, use the `getnodeaddresses 0 cjdns`
    61 RPC.
    62diff --git a/doc/i2p.md b/doc/i2p.md
    63index 6b440f43a6..39f65c4e5f 100644
    64--- a/doc/i2p.md
    65+++ b/doc/i2p.md
    66@@ -93,7 +93,7 @@ There are several ways to see your I2P address in Bitcoin Core:
    67 To see which I2P peers your node is connected to, use `bitcoin-cli -netinfo 4`
    68 or the `getpeerinfo` RPC (e.g. `bitcoin-cli getpeerinfo`).
    69 
    70-To see which I2P addresses your node knows, use the `getnodeaddresses 0 "i2p"`
    71+To see which I2P addresses your node knows, use the `getnodeaddresses 0 i2p`
    72 RPC.
    73 
    74 ## Compatibility
    75diff --git a/doc/tor.md b/doc/tor.md
    76index b8876b9825..08d031d084 100644
    77--- a/doc/tor.md
    78+++ b/doc/tor.md
    79@@ -28,7 +28,7 @@ network. This can be useful to see how many onion peers your node knows,
    80 e.g. for `-onlynet=onion`.
    81 
    82 To fetch a number of onion addresses that your node knows, for example seven
    83-addresses, use the `getnodeaddresses 7 "onion"` RPC.
    84+addresses, use the `getnodeaddresses 7 onion` RPC.
    85 </p></details>
    
  24. lsilva01 approved
  25. lsilva01 commented at 11:48 pm on March 21, 2022: contributor

    ACK 1e95550

    nit: According to this comment, if the node is proxying IPv6 over Tor, CJDNS will not work.

    As doc/tor.md suggests using ./bitcoind -proxy=127.0.0.1:9050 to run Tor and it will prevent CJDNS from working, maybe it would be interesting to add a setting that allows Tor + CJDNS to work together.

  26. doc: create initial doc/cjdns.md for cjdns how-to documentation
    Adapted in part from the CJDNS description in #23077 by Vasil Dimov
    and from CJDNS documentation and feedback by Caleb James DeLisle.
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    ed15848475
  27. doc: update tor.md with cjdns and getnodeaddresses, fix tor grep,
    and improve local addresses section
    3bf6f0cf2c
  28. doc: update i2p.md with cjdns, improve local addresses section f44efc3e2c
  29. jonatack force-pushed on Mar 22, 2022
  30. jonatack commented at 11:57 am on March 22, 2022: member

    Thanks for the review and feedback @lsilva01. Without going into specific configuration suggestions, I’ve re-pushed with the following update. What do you think? Do we need to provide specific Tor + CJDNS configurations?

     0--- a/doc/cjdns.md
     1+++ b/doc/cjdns.md
     2@@ -76,9 +76,11 @@ CJDNS support was added to Bitcoin Core in version 23.0 and there may be fewer
     3 CJDNS peers than Tor or IP ones. You can use `bitcoin-cli -addrinfo` to see the
     4 number of CJDNS addresses known to your node.
     5 
     6-In general, a node can be run with both an onion hidden service and CJDNS (or
     7-any/all of IPv4/IPv6/onion/I2P/CJDNS), which can provide a potential fallback if
     8-one of the networks has issues.
     9+In general, a node can be run with both an onion service and CJDNS (or any/all
    10+of IPv4/IPv6/onion/I2P/CJDNS), which can provide a potential fallback if one of
    11+the networks has issues. There are a number of ways to configure this; see
    12+[doc/tor.md](https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md) for
    13+details.
    14 
    15 ## CJDNS-related information in Bitcoin Core
    
  31. vasild approved
  32. vasild commented at 12:46 pm on March 22, 2022: member
    ACK f44efc3e2c5664825d7bd071f9dc38b5b9111ae1
  33. lsilva01 approved
  34. lsilva01 commented at 6:12 pm on March 23, 2022: contributor

    I think it’s good. The user has a reference to the Tor documentation for configuring both networks.

    ACK f44efc3

  35. laanwj merged this on Mar 24, 2022
  36. laanwj closed this on Mar 24, 2022

  37. jonatack deleted the branch on Mar 24, 2022
  38. stickies-v commented at 6:14 pm on March 24, 2022: member
    Post-merge ACK f44efc3 . This is my first time hearing about CJDNS and having this documentation is very helpful. I wanted to suggest if it would be helpful to add some hints as per e.g. this IRC discussion on using the public nodes, but maybe that is too specific for this documentation.
  39. jonatack commented at 6:27 pm on March 24, 2022: member

    I wanted to suggest if it would be helpful to add some hints as per e.g. this IRC discussion on using the public nodes

    Thanks! For now, I didn’t want to replicate or enhance the CJDNS installation docs (i.e. https://github.com/cjdelisle/cjdns#2-find-a-friend), but this can evolve based on feedback.

  40. MarcoFalke commented at 7:00 pm on March 24, 2022: member
    Shouldn’t docs be linked from the root doc.md?
  41. laanwj removed this from the "Blockers" column in a project

  42. jonatack commented at 7:16 pm on March 24, 2022: member

    Shouldn’t docs be linked from the root doc.md?

    I overlooked that. Done in #24663 along with a link in -cjdnsreachable.

  43. MarcoFalke referenced this in commit 56c8658700 on Mar 25, 2022
  44. jonatack referenced this in commit 6c7a3b68a9 on Mar 28, 2022
  45. hebasto referenced this in commit 866b13fa53 on Mar 31, 2022
  46. hebasto referenced this in commit 3b0dd55fd0 on Mar 31, 2022
  47. hebasto referenced this in commit a628f5377d on Mar 31, 2022
  48. jonatack referenced this in commit 4690e8af13 on Mar 31, 2022
  49. jonatack referenced this in commit 4148396229 on Mar 31, 2022
  50. jonatack referenced this in commit 7a553d4e65 on Mar 31, 2022
  51. fanquake referenced this in commit c243e08351 on Mar 31, 2022
  52. sidhujag referenced this in commit 58ad38d9eb on Apr 2, 2022
  53. DrahtBot locked this on Mar 24, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-19 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me