doc, test: improve i2p/tor docs and i2p reachable unit tests #22648

pull jonatack wants to merge 3 commits into bitcoin:master from jonatack:i2p-doc-updates-august-2021 changing 3 files +68 −37
  1. jonatack commented at 9:48 am on August 6, 2021: member

    This pull addresses #22634 (comment) and various user feedback/questions, updates the -onlynet documentation in doc/i2p.md and doc/tor.md per #22651 (src/init.cpp is already fine) and fills in some missing I2P unit test coverage.

    Note: this PR depends in part on whether #22651 is merged in order to propose the correct -onlynet documentation (it is currently aligned with the change in #22651), so that PR should be decided or merged first.

  2. in doc/i2p.md:26 in 79164095ae outdated
    26+
    27+Note the IP address and port the SAM proxy is listening to; usually, it is
    28+`127.0.0.1:7656`.
    29+
    30+Once it is up and running with SAM enabled, use the following Bitcoin Core
    31+configuration options:
    


    jonatack commented at 9:56 am on August 6, 2021:
    0-Once it is up and running with SAM enabled, use the following Bitcoin Core
    1-configuration options:
    2+Once an I2P router with SAM enabled is up and running, use the following Bitcoin
    3+Core configuration options:
    
  3. in doc/i2p.md:60 in 79164095ae outdated
    55@@ -47,10 +56,13 @@ information in the debug log about your I2P configuration and connections. Run
    56 `bitcoin-cli help logging` for more information.
    57 
    58 It is possible to restrict outgoing connections in the usual way with
    59-`onlynet=i2p`. I2P support was added to Bitcoin Core in version 22.0 (mid-2021)
    60-and there may be fewer I2P peers than Tor or IP ones. Therefore, using
    61-`onlynet=i2p` alone (without other `onlynet=`) may make a node more susceptible
    62-to [Sybil attacks](https://en.bitcoin.it/wiki/Weaknesses#Sybil_attack). Use
    63+`onlynet=i2p`, combined with `-onion=0` if disabling outbound onion connections
    64+is desired, see [doc/tor.md](/tor.md).
    


    jonatack commented at 9:56 am on August 6, 2021:
    0is desired, see [doc/tor.md](doc/tor.md).
    
  4. jonatack force-pushed on Aug 6, 2021
  5. jonatack force-pushed on Aug 6, 2021
  6. fanquake added the label Docs on Aug 6, 2021
  7. in doc/i2p.md:17 in 8d51dd93d2 outdated
    17-Bitcoin Core options:
    18+enabled is required. Options include:
    19+
    20+- [i2p-router](https://geti2p.net), the official implementation in Java
    21+- [i2pd (I2P Daemon)](https://i2pd.readthedocs.io/en/latest), a lighter
    22+  alternative in C++ (version 2.23 in Debian stable will not work; version 2.35
    


    jonatack commented at 3:39 pm on August 6, 2021:

    I’ve tested 2.23 with both 22.0rc2 and master and it still manages to work, albeit with a few more warnings, some of which seemed to be false negatives before managing to connect, and the warnings when a peer isn’t online are verbose and a bit less helpful:

    02021-08-06T15:37:05Z I2P: Error connecting to zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p:0:
    1Unexpected reply to "NAMING LOOKUP NAME=zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p":
    2"NAMING REPLY RESULT=INVALID_KEY NAME=zsxwyo6qcn3chqzwxnseusqgsnuw3maqnztkiypyfxtya4snkoka.b32.i2p"
    

    Still testing but may just warn here instead.


    jonatack commented at 10:50 pm on August 6, 2021:
    done
  8. in doc/i2p.md:62 in 8d51dd93d2 outdated
    61-`onlynet=i2p` alone (without other `onlynet=`) may make a node more susceptible
    62-to [Sybil attacks](https://en.bitcoin.it/wiki/Weaknesses#Sybil_attack). Use
    63+`onlynet=i2p` (combined with `-onion=0` if disabling outbound onion connections
    64+is desired; see [doc/tor.md](tor.md)).
    65+
    66+I2P support was added to Bitcoin Core in version 22.0 (mid-2021) and there may
    


    kristapsk commented at 3:55 pm on August 6, 2021:
    Mid-2021? 22.0 is not released yet.

    jonatack commented at 3:57 pm on August 6, 2021:
    22.0 is the first release that doc/i2p.md will be in.

    jonatack commented at 4:02 pm on August 6, 2021:
    If the release takes place in August or early September, “mid-2021” seems ok to me but can change or remove if controverserial. It wasn’t added by this PR.

    kristapsk commented at 4:19 pm on August 6, 2021:
    Yes, I would not call September mid-2021, more like “autumn 2021”, but OTOH I also not use where “mid-year” begins or ends (June or July would be definitely mid-2021 I think). Original schedule for 22.0 final release was August 1, but we are already past that.

    jonatack commented at 10:50 pm on August 6, 2021:
    Removed (mid-2021)
  9. Update i2p.md and tor.md regarding -onlynet config option bebcf785c0
  10. jonatack renamed this:
    doc: improve i2p.md about router options/versions and -onlynet
    doc, test: improve i2p/tor docs and i2p reachable unit tests
    on Aug 6, 2021
  11. jonatack force-pushed on Aug 6, 2021
  12. jonatack marked this as ready for review on Aug 6, 2021
  13. ghost commented at 11:35 am on August 8, 2021: none
    Concept ACK on improving the doc.
  14. in doc/i2p.md:61 in bebcf785c0 outdated
    65+
    66+Make outgoing connections only to I2P addresses. Incoming connections are not
    67+affected by this option. It can be specified multiple times to allow multiple
    68+network types, e.g. onlynet=ipv4, onlynet=ipv6, onlynet=onion, onlynet=i2p.
    69+
    70+Warning: if you use -onlynet with values other than onion, and the -onion or
    


    unknown commented at 11:36 am on August 8, 2021:
    Warning looks okay or maybe we can wait for #22651 to get merged and update this accordingly

    jonatack commented at 12:00 pm on August 8, 2021:
    My goal was to write this to be compatible with that PR. Please let me know if it isn’t correct.

    unknown commented at 12:12 pm on August 8, 2021:
    It looks correct but we can add/remove information based on how issue in other PR is resolved and merged.

    jonatack commented at 10:25 am on August 9, 2021:
    Ok. Resolving for now.
  15. in doc/i2p.md:16 in 45026921a4 outdated
    16-`127.0.0.1:7656`. Once it is up and running with SAM enabled, use the following
    17-Bitcoin Core options:
    18+
    19+enabled is required. Options include:
    20+
    21+- [i2p-router](https://geti2p.net), the official implementation in Java
    


    unknown commented at 11:38 am on August 8, 2021:
    Not sure if this implementation in Java should be mentioned because it doesn’t help with Bitcoin Core setup

    jonatack commented at 11:58 am on August 8, 2021:
    I’m not sure what you mean. This was already in the doc, and I’ve heard from people who are using it with Bitcoin Core.

    unknown commented at 12:09 pm on August 8, 2021:

    jonatack commented at 12:21 pm on August 8, 2021:
    Thanks for the info! ISTM the link should still be provided.

    Rspigler commented at 9:56 pm on August 8, 2021:
    I tested v22.0rc2 with the official Java i2prouter with no issues on Debian. You have to follow the instructions at their download link, and then visit 127.0.0.1:7657 to start SAM. You also need to type i2prouter start in terminal.

    Rspigler commented at 9:59 pm on August 8, 2021:
    127.0.0.1:7657 -> ConfigureHomepage -> Clients then hit the Play Button next to “SAM application Bridge”. On the left side of the page, there should be a green light next to “Shared Clients”.

    jonatack commented at 10:18 am on August 9, 2021:
    Thanks for the info, @Rspigler. Resolving here for now.
  16. ghost commented at 12:13 pm on August 8, 2021: none
    Should we add information about ports in this doc? #22634 (comment)
  17. jonatack commented at 12:35 pm on August 8, 2021: member
    Your suggestion? Feel free to propose a text.
  18. ghost commented at 8:50 pm on August 8, 2021: none

    Looks like we need all ports open for outbound: https://www.reddit.com/r/i2p/comments/fzwwd0/confused_on_what_ports_to_open/fn76ly9

    And for inbound users can follow everything mentioned here: https://geti2p.net/en/faq#ports

  19. in doc/i2p.md:23 in e3a58140dc outdated
    23+  ([documentation](https://i2pd.readthedocs.io/en/latest)), a lighter
    24+  alternative in C++ (successfully tested with version 2.23 and up; version 2.36
    25+  or later recommended)
    26+- [i2p-zero](https://github.com/i2p-zero/i2p-zero)
    27+- [other alternatives](https://en.wikipedia.org/wiki/I2P#Routers)
    28+
    


    Rspigler commented at 10:09 pm on August 8, 2021:

    For the official i2prouter implementation in Java, visit their download page and follow the instructions for your Operating System.

    Once installed, open a terminal window and type i2prouter start. Then visit http://127.0.0.1:7657/configclients in your browser to enable SAM. On the left side of the page, there should be a green light next to “Shared Clients”.

    Edit: Fixed with @RandyMcMillan suggestions


    RandyMcMillan commented at 8:33 pm on August 9, 2021:

    If the user has successfully config’d to this point - a link will take the user to the correct page.

    Maybe add a link for convenience?

    Then visit 127.0.0.1:7657/configclients


    josedanielrojaspixel commented at 12:52 pm on August 10, 2021:
    L09

    jonatack commented at 8:34 pm on August 11, 2021:
    It’s not clear to me if a change is being requested here, and what, precisely. Install how-to seems a bit redundant with the existing docs of the various implementations.

    Rspigler commented at 8:56 pm on August 12, 2021:
    I think adding the above at Line 23 (insert new line first) would be helpful. I agree instructions for every implementation would be overkill, but I was completely new to i2p, and I had to do a bit of digging to figure out how to set it up. I found the wording a bit confusing (I thought I had to install a router and install SAM). The documentation on the website is mostly about setting up a browser. I think adding instructions for users for the reference implementation could be helpful in increasing i2p nodes. The tor docs include a bit of instructions as well

    jonatack commented at 10:04 am on August 17, 2021:

    Thanks. I agree it might be helpful, but I don’t know if those instructions are platform agnostic. We would also need to maintain it / keep it up to date. Most people I talk to are using i2pd (admittedly perhaps because it is very easy to install), so if we explain how to install i2p-router, we should probably also do it for i2pd. Sounds like a dedicated “How to Install an I2P Router” section.

    In any case, feel free to propose this separately. I would rather not make this pull larger.

  20. Rspigler commented at 10:55 pm on August 8, 2021: contributor

    @prayank23 I don’t believe that is correct. I am behind a router/firewall I don’t control right now (haven’t forwarded any ports) and I am able to successfully create an i2p address (ugmw4zuyhmrm7anfctjamcjgi32daor4ulqdrxtn66owgn2oyebq.b32.i2p:0) and connect out to other i2p nodes (although they are not very long lasting connections, and I have no inbound connections despite setting i2pacceptincoming=1).

    That being said, I also have no incoming tor connections to my HS (kwn76yxlsaucsbywm5sy4q5ebo6atao5escejchwjkzu2l5lwkkkzdqd.onion:8333) which I know doesn’t require any port forwarding, so I’m not sure what’s going on. I have been running my node for many hours.

    bitcoin.conf:

    listen=1 assumevalid=0 dbcache=1000 addresstype=bech32 avoidpartialspends=1 changetype=bech32 maxapsfee=0.01 i2psam=127.0.0.1:7656 debug=tor debug=i2p i2pacceptincoming=1

    In my debug file, I see that my node is trying to connect to lots of i2p nodes, but I have tons of connection timeout errors.

    Edit: Maybe you could try to connect to me?

  21. ghost commented at 11:14 pm on August 8, 2021: none

    Edit: Maybe you could try to connect to me?

    Sure. Will experiment tomorrow. Will ping you in IRC. It’s 4 AM here right now 😴

  22. jonatack commented at 10:21 am on August 9, 2021: member

    @Rspigler I manually connected successfully to both of your addresses.

    Edit: still connected but they both have really high ping times of 11 to 60 seconds versus under 1.5 seconds for all the others.

  23. Rspigler commented at 7:23 pm on August 9, 2021: contributor

    I see your inbound for both i2p and tor, so I think we should be good, unless other users start reporting high ping times for these networks with v22.0.

    Thanks for helping!

  24. ghost commented at 8:16 pm on August 9, 2021: none

    I see your inbound for both i2p and tor, so I think we should be good, unless other users start reporting high ping times for these networks with v22.0.

    Things that you should try:

    1. Check firewall status: sudo ufw status verbose
    2. Deny incoming traffic, restart and see if i2p works fine in Core for incoming peers
    3. Block some ports for outgoing and see if i2p works for outbound peers in Core
    4. Results for ss nlt and nmap
  25. fanquake deleted a comment on Aug 10, 2021
  26. unknown approved
  27. unknown commented at 10:18 am on August 12, 2021: none

    ACK https://github.com/bitcoin/bitcoin/pull/22648/commits/e3a58140dc8fe20b76d5ef38074e37bca7111b79

    nit:

    1. Would be great if we can add things suggested by @Rspigler in https://github.com/bitcoin/bitcoin/pull/22648/#discussion_r684835687

    2. And information about ports or at least this link: https://geti2p.net/en/faq#ports

    I have added both things in https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/pull/408

    For ports I tried experimenting with allow/deny in ufw and see if it affects outgoing and incoming connections in Bitcoin Core.

    TL;DR:

    0Ports required by i2p:
    1
    21. Outbound (Internet facing): a random port between 9000 and 31000 is selected however its better if all ports are open and it doesn't affect your security. You can check firewall status using `sudo ufw status verbose` which shouldn't deny outgoing by default.
    3
    42. Inbound (Internet facing): Optional
    5
    6Local ports: https://geti2p.net/en/faq#ports
    

    If something looks incorrect feel free to comment :)

  28. Rspigler commented at 8:58 pm on August 12, 2021: contributor

    a random port between 9000 and 31000

    I can confirm this

  29. jonatack commented at 10:06 am on August 17, 2021: member
    Thanks @prayank23! And thanks for the suggestions. I’d rather not copy information here that is already in https://geti2p.net/en/faq#ports, as it would add maintainance here and could go out of date.
  30. in src/test/net_tests.cpp:789 in e3a58140dc outdated
    784+    SetReachable(NET_I2P, true);
    785 
    786     BOOST_CHECK_EQUAL(IsReachable(NET_IPV4), true);
    787     BOOST_CHECK_EQUAL(IsReachable(NET_IPV6), true);
    788     BOOST_CHECK_EQUAL(IsReachable(NET_ONION), true);
    789+    BOOST_CHECK_EQUAL(IsReachable(NET_I2P), true);
    


    vasild commented at 3:02 pm on August 17, 2021:

    nit:

    0BOOST_CHECK_EQUAL(foo, true);
    1BOOST_CHECK_EQUAL(bar, false);
    2// vs
    3BOOST_CHECK(foo);
    4BOOST_CHECK(!bar);
    

    but the surrounding code is already using the former, so it is ok to leave it as it is.


    jonatack commented at 1:58 pm on August 19, 2021:
    Updated, along with the surrounding ones (and saw a missing NET_I2P assertion, added). Thanks!
  31. vasild approved
  32. vasild commented at 3:04 pm on August 17, 2021: member
    ACK e3a58140dc8fe20b76d5ef38074e37bca7111b79
  33. Rspigler commented at 9:08 pm on August 17, 2021: contributor
    ACK e3a58140dc8fe20b76d5ef38074e37bca7111b79
  34. Improve doc/i2p.md regarding I2P router options/versions b87a9c4d13
  35. Add I2P network SetReachable/IsReachable unit test assertions
    and simplify similar neighboring assertions.
    017597767b
  36. in doc/i2p.md:13 in e3a58140dc outdated
     9@@ -10,11 +10,22 @@ started with I2P terminology.
    10 ## Run Bitcoin Core with an I2P router (proxy)
    11 
    12 A running I2P router (proxy) with [SAM](https://geti2p.net/en/docs/api/samv3)
    13-enabled is required (there is an [official one](https://geti2p.net) and
    14-[a few alternatives](https://en.wikipedia.org/wiki/I2P#Routers)). Notice the IP
    15-address and port the SAM proxy is listening to; usually, it is
    16-`127.0.0.1:7656`. Once it is up and running with SAM enabled, use the following
    17-Bitcoin Core options:
    18+
    


    laanwj commented at 12:42 pm on August 19, 2021:
    extra newline? (this causes weirdness in the rendered document)

    jonatack commented at 1:39 pm on August 19, 2021:
    oops

    jonatack commented at 1:59 pm on August 19, 2021:
    removed extra newline, good catch!
  37. jonatack force-pushed on Aug 19, 2021
  38. jonatack commented at 2:30 pm on August 19, 2021: member
    Updated git diff e3a5814 0175977 per review feedback (thanks!) and corrected the name of the first I2P router from i2p-router to i2prouter (I2P Router), which is also more similar to the second router i2pd (I2P Daemon).
  39. Rspigler commented at 10:40 pm on August 19, 2021: contributor
    Re-ACK 017597767b977bb8fe11be8e2012130df1dffd30
  40. vasild approved
  41. vasild commented at 6:06 am on August 20, 2021: member
    ACK 017597767b977bb8fe11be8e2012130df1dffd30
  42. ghost commented at 4:12 pm on August 20, 2021: none
  43. laanwj merged this on Aug 26, 2021
  44. laanwj closed this on Aug 26, 2021

  45. laanwj commented at 11:14 am on August 26, 2021: member
    Sorry for merging this before #22651, -onlynet edge-case behavior is not personally clear to me and it wasn’t clear to me that the documentation here depends on code that isn’t merged yet. The other documentation changes looked sane to me and all the ACKs here were kind of confusing me that it was ready for merge.
  46. in doc/tor.md:64 in 017597767b
    64-                    onion connections over the default proxy or your defined -proxy.
    65+                    onlynet=ipv4, onlynet=ipv6, onlynet=onion, onlynet=i2p.
    66+                    Warning: if you use -onlynet with values other than onion, and
    67+                    the -onion or -proxy option is set, then outgoing onion
    68+                    connections will still be made; use -noonion or -onion=0 to
    69+                    disable outbound onion connections in this case.
    


    laanwj commented at 11:21 am on August 26, 2021:
    I think I would personally prefer #22651 to fix this behavior instead of having to describe this long special case exception at all. Can’t we make -onlynet=ipv4 (or any onlynet not involving -onlynet=onion) do as one would expect, ignore onions, even if there happens to be a proxy for them? I think this is the most expected behavior, to have proxy setting be orthogonal to what networks to connect out on.

    fanquake commented at 11:27 am on August 26, 2021:

    laanwj commented at 11:40 am on August 26, 2021:
    A counter-example: if I specify -onlynet=onion (with the intent of only connecting to onions), I’d be bummed if it still connected to ipv4 and ipv6 nodes because a proxy is specified for them indirectly through -proxy=127.0.0.1:9050.

    unknown commented at 11:44 am on August 26, 2021:

    I think I would personally prefer #22651 to fix this behavior

    It can be done in a follow up PR. Will be great if we can do it in the same PR.

    Would also need to fix port used for Windows by default: #22651 (review)

    Can’t we make -onlynet=ipv4 (or any onlynet not involving -onlynet=onion) do as one would expect, ignore onions, even if there happens to be a proxy for them?

    Yes. According to my understanding this is how things would work: Consider Alice wants to use Tor proxy for outbound connections, however connect only with ipv4 nodes. Bob wants to use Tor proxy for outbound connections, he is okay with connecting to any nodes (onion, ipv4 etc.)

    So Alice can use onlynet=ipv4 and proxy=127.0.0.1:9050. Bob will use proxy=127.0.0.1:9050


    jonatack commented at 12:23 pm on August 26, 2021:
    At least the onlynet docs in src/init.cpp, doc/tor.md and doc/i2p.md are now all aligned.

    vasild commented at 2:26 pm on August 30, 2021:

    Can’t we make -onlynet=ipv4 … do as one would expect …

    Done in #22834.

  47. laanwj referenced this in commit f95b655ba9 on Aug 26, 2021
  48. fujicoin referenced this in commit 67bcfc6c30 on Aug 27, 2021
  49. sidhujag referenced this in commit 77ec400610 on Aug 28, 2021
  50. gwillen referenced this in commit c971e25802 on Jul 27, 2022
  51. gwillen referenced this in commit 4df7e88f6f on Aug 1, 2022
  52. DrahtBot locked this on Aug 30, 2022

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-07-05 19:13 UTC

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