This issue is either a bug, or a feature request to improve the documentation for using I2P. Currently, I have been unable to get I2P working based on the documentation so far. The I2P server is running, but the logs say that it is unable to create a SAM session.
I2P: Creating SAM session with 127.0.0.1:7656 #22759
issue rebroad opened this issue on August 21, 2021-
rebroad commented at 8:52 AM on August 21, 2021: contributor
- rebroad added the label Bug on Aug 21, 2021
-
jonatack commented at 9:48 AM on August 21, 2021: contributor
There's been some work on
doc/i2p.md(#22250, #22589, now #22648, with some ideas for future documentation).There is also
- https://bitcoin.stackexchange.com/questions/103402/how-can-i-use-bitcoin-core-with-the-anonymous-network-protocol-i2p
- https://bitcoin.stackexchange.com/questions/107060/tor-and-i2p-tradeoffs-in-bitcoin-core
What platform and I2P router/version are you using (I presume you are using a Bitcoin Core 22.0 release candidate or recent master)?
-
rebroad commented at 11:05 AM on August 22, 2021: contributor
Thanks @jonatack I'll check out those stackexchange articles and see if the info therein helps. I'm using 22.99 (recent master), using i2p versions:-
i2p/bionic,now 0.9.34-1ubuntu3 all [installed] i2p-doc/bionic 0.9.34-1ubuntu3 all i2p-router/bionic,now 0.9.34-1ubuntu3 all [installed,automatic] i2pd/bionic 2.17.0-3build1 amd64on Ubuntu 18.04.5 LTS on WSL:-
PS C:\Users\rebroad> wsl --status Default Distribution: Ubuntu-18.04 Default Version: 2 Windows Subsystem for Linux was last updated on 09/07/2021 WSL automatic updates are on. Kernel version: 5.10.43 PS C:\Users\rebroad> wsl -l -v NAME STATE VERSION * Ubuntu-18.04 Running 1 -
jonatack commented at 12:36 PM on August 22, 2021: contributor
Ok, if you're using i2p-router, this comment by @Rspigler might be helpful: #22648 (review). Let me know.
-
jonatack commented at 12:38 PM on August 22, 2021: contributor
(I plan to post a twitter thread soon to help people get started, so any feedback at the moment is useful.)
-
rebroad commented at 3:29 PM on August 22, 2021: contributor
@jonatack I think i've fixed it by downloading the latest version using the dedicated repository:-
sudo apt-add-repository ppa:i2p-maintainers/i2pNope, bitcoin is still not connecting to the port. It's not listening on 7656, but there is now a web interface that works on port 7657.
-
Rspigler commented at 12:49 AM on August 23, 2021: contributor
Did you enable SAM? Do you see the green light? Did you run
i2prouter start?Can you post your
bitcoin.confcontents and your debug you have withdebug=i2p?You shouldn't have to open any ports.
-
xanoni commented at 4:52 AM on August 23, 2021: none
For
i2p(Java implementation):See: https://geti2p.net/en/docs/api/samv3 (scroll to very bottom)
Default SAM Setup The default SAM port is 7656. SAM is not enabled by default in the Java I2P Router; it must be started manually, or configured to start automatically, on the configure clients page in the router console, or in the clients.config file. The default SAM UDP port is 7655, listening on 127.0.0.1. These may be changed by adding the arguments sam.udp.port=nnnnn and/or sam.udp.host=w.x.y.z to the invocation.
Configuration in other routers is implementation-specific.
For
i2pd(C++ implementation):See: https://i2pd.readthedocs.io/en/latest/user-guide/configuration/
# i2pd.conf [sam] enabled = true address = 127.0.0.1 port = 7656 -
rebroad commented at 9:47 AM on August 23, 2021: contributor
ok, I have enabled the SAM port in i2p now, but now I have different errors in bitcoin's debug.log:-
2021-08-23T09:44:13.535 AddLocal(7n57kytmqbay42cwdofju37cn3fuykdutoqdmfdrzrc37dlrzblq.b32.i2p:0,4) 2021-08-23T09:44:13.535 I2P: Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2021-08-23T09:45:14.006 I2P: Error listening: Unexpected reply to "HELLO VERSION MIN=3.1 MAX=3.1": "HELLO REPLY RESULT=I2P_ERROR MESSAGE="Timeout waiting for HELLO VERSION"" 2021-08-23T09:45:14.007 RemoveLocal(7n57kytmqbay42cwdofju37cn3fuykdutoqdmfdrzrc37dlrzblq.b32.i2p:0)The "cannot decode" message above repeats every 0.002 seconds, so ends up flooding the log file.
-
xanoni commented at 11:48 PM on August 23, 2021: none
"HELLO VERSION MIN=3.1 MAX=3.1"
Do you have that ? ;-)
Here is some info: https://geti2p.net/en/docs/api/samv3
To implement a basic TCP-only, peer-to-peer application, the client must support the following commands. HELLO VERSION MIN=3.1 MAX=3.1 Needed for all of the remaining ones DEST GENERATE SIGNATURE_TYPE=7 To generate our private key and destination NAMING LOOKUP NAME=... To convert .i2p addresses to destinations SESSION CREATE STYLE=STREAM ID=... DESTINATION=... Needed for STREAM CONNECT and STREAM ACCEPT STREAM CONNECT ID=... DESTINATION=... To make outgoing connections STREAM ACCEPT ID=... To accept incoming connectionsEDIT: You likely do ...
Version 3.1 was introduced in I2P release 0.9.14 (July 2014).I would double check whether you specified the correct ports both on the Bitcoin and on the I2P side.
-
Rspigler commented at 12:47 AM on August 24, 2021: contributor
Can you post your bitcoin.conf
-
vasild commented at 7:05 AM on August 24, 2021: contributor
2021-08-23T09:44:13.535 I2P: Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed""
Uh, oh, so that I2P implementation is not confirming to the spec - it should reply with a base64 string, from https://geti2p.net/en/docs/api/samv3:
If SILENT=false was passed, which is the default value, the SAM bridge sends the client a ASCII line containing the base64 public destination key of the requesting peer
I cannot reproduce this with I2P router 0.9.50:
terminal1> # create a new session terminal1> telnet 127.0.0.1 7656 terminal1> HELLO VERSION MIN=3.1 MAX=3.1 terminal1> # receives response: HELLO REPLY RESULT=OK VERSION=3.1 terminal1> SESSION CREATE STYLE=STREAM ID=123 DESTINATION=TRANSIENT terminal1> # receives response: SESSION STATUS RESULT=OK DESTINATION=... terminal1> # hangs/waits... terminal2> # wait for an incoming connection on the created session terminal2> telnet 127.0.0.1 7656 terminal2> HELLO VERSION MIN=3.1 MAX=3.1 terminal2> # receives response: HELLO REPLY RESULT=OK VERSION=3.1 terminal2> STREAM ACCEPT ID=123 SILENT=false terminal2> # receives response: STREAM STATUS RESULT=OK terminal1> # hangs/waits... terminal1> # close the socket, thus destroying the session terminal1> ^] terminal1> telnet> q terminal1> Connection closed. terminal2> # telnet reports that the socket is closed without any messages, as expected terminal2> Connection closed by foreign host. -
vasild commented at 7:12 AM on August 24, 2021: contributor
Anyway, that does not explain what's wrong with your I2P router and why it errors. Do you see just
2021-08-23T09:44:13.535 I2P: Error accepting: Cannot decode Base64:... 2021-08-23T09:44:13.535 I2P: Error accepting: Cannot decode Base64:... ...
repeated every 0.002 seconds or are there other repeating messages?
-
rebroad commented at 12:35 PM on August 24, 2021: contributor
Anyway, that does not explain what's wrong with your I2P router and why it errors. Do you see just
2021-08-23T09:44:13.535 I2P: Error accepting: Cannot decode Base64:... 2021-08-23T09:44:13.535 I2P: Error accepting: Cannot decode Base64:... ...
repeated every 0.002 seconds or are there other repeating messages?
these are the only messages that are repeated.
-
xanoni commented at 3:57 PM on August 24, 2021: none
And you are sure it's connecting to the correct port? Lots of ports used by I2P so it's easy to get confused ..
-
fanquake commented at 4:36 PM on August 8, 2022: member
Going to close for now until some new / actionable information is available. This does not seem like a bug in Bitcoin Core.
- fanquake closed this on Aug 8, 2022
-
Sataur commented at 7:35 PM on June 20, 2023: none
definitely should be improved on return from system sleep
Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed""and repeat same message hundreds time per second! Version: 2.2.1-0 Core 25 / MintCRIT [acket pusher] net.i2p.util.Clock : Large clock shift forward by __m -
jonatack commented at 8:17 PM on June 20, 2023: contributor
The "cannot decode" message above repeats every 0.002 seconds, so ends up flooding the log file.
"Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" and repeat same message hundreds time per second!
Indeed, I have a few instances in my mainnet debug log when this occurred, and like these reports, in high-frequency bursts (unsure, but they seem to have only happened when using the Java I2P router, not i2pd). Will look more into it.
-
jonatack commented at 8:26 PM on June 20, 2023: contributor
For
i2p(Java implementation):See: geti2p.net/en/docs/api/samv3 (scroll to very bottom)
SAM is not enabled by default in the Java I2P Router; it must be started manually, or configured to start automatically, on the configure clients page in the router console, or in the clients.config file.
Good point. People ask often enough about starting the SAM bridge in the Java I2P router, and the info is fairly hard to find for someone just looking to get started with I2P for their node.
Will propose to update
doc/i2p.mdto clarify it. Edit: done in #27937. -
jonatack commented at 5:01 PM on June 27, 2023: contributor
The "cannot decode" message above repeats every 0.002 seconds, so ends up flooding the log file.
"Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" and repeat same message hundreds time per second!
Indeed, I have a few instances in my mainnet debug log when this occurred, and like these reports, in high-frequency bursts (unsure, but they seem to have only happened when using the Java I2P router, not i2pd). Will look more into it.
I've seen this a couple more times lately, including this morning, with I2P router v1.9.0 on macOS 13.4.1.
It can occur, for instance, on awaking the laptop after it auto-shutdown due to low battery, and the SAM bridge is down and needs a restart, whereas bitcoind/tor/cjdns continue running.
2023-06-27T12:19:35.638318Z [scheduler] [net_processing.cpp:5212] [CheckForStaleTipAndEvictPeers] Potential stale tip detected, will try using extra outbound peer (last tip update: 18927 seconds ago) 2023-06-27T12:19:35.751795Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR" 2023-06-27T12:19:35.754129Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2023-06-27T12:19:35.756923Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2023-06-27T12:19:35.758073Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" .../... 2023-06-27T12:25:10.481379Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2023-06-27T12:25:10.481731Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2023-06-27T12:25:10.482109Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2023-06-27T12:25:10.482484Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error accepting: Cannot decode Base64: "STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"" 2023-06-27T12:25:15.487624Z [i2paccept] [i2p.cpp:257] [Log] [i2p] Error listening: Cannot connect to 127.0.0.1:7656 2023-06-27T12:25:15.487658Z [i2paccept] [net.cpp:318] [RemoveLocal] RemoveLocal(<redacted>.b32.i2p:0) .../... 2023-06-27T12:26:07.328142Z [opencon] [i2p.cpp:257] [Log] [i2p] Creating persistent SAM session ea8f7bdf7c with 127.0.0.1:7656 2023-06-27T12:26:09.776993Z [opencon] [i2p.cpp:257] [Log] [i2p] Persistent SAM session ea8f7bdf7c created, my address=<redacted>.b32.i2p:0 - fanquake referenced this in commit 2cd71d3a13 on Jun 30, 2023
-
jonatack commented at 1:22 PM on July 7, 2023: contributor
IRC discussion today about this issue: https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2023-07-07#941511
- vasild referenced this in commit 849355f850 on Jul 7, 2023
- vasild referenced this in commit 01719bb98b on Jul 10, 2023
- vasild referenced this in commit ad7c11d9c5 on Jul 14, 2023
- vasild referenced this in commit 3870734270 on Jul 14, 2023
- luke-jr referenced this in commit 9d5afbdc36 on Sep 16, 2023
- vasild referenced this in commit 762404a68c on Oct 5, 2023
- luke-jr referenced this in commit 3e316169e2 on Oct 19, 2023
- achow101 referenced this in commit 77f0ceb717 on Oct 19, 2023
- Frank-GER referenced this in commit 2389eef67a on Oct 21, 2023
- janus referenced this in commit af68f3b4c3 on Apr 1, 2024
- bitcoin locked this on Jul 13, 2024