6

How can I use Bitcoin Core with the I2P anonymous network protocol?

10

Jon Atack answered this on Twitter.

Configuration and setup

First install and start I2P (version 2.35 or above).

$ apt install i2pd
$ systemctl enable i2pd.service
$ systemctl start i2pd.service

In your bitcoin.conf file add (I will assume you run Bitcoin Core v22+ and want to use both Tor and I2P but remove debug=tor and onlynet=onion if not interested in Tor):

debug=tor
debug=i2p
onlynet=onion
onlynet=i2p
i2psam=127.0.0.1:7656

There are 2 config options for I2P. Only the second one is required to be set for I2P to work.

  -i2pacceptincoming
       If set and -i2psam is also set then incoming I2P connections are
       accepted via the SAM proxy. If this is not set but -i2psam is set
       then only outgoing connections will be made to the I2P network.
       Ignored if -i2psam is not set. Listening for incoming I2P
       connections is done through the SAM proxy, not by binding to a
       local address and port (default: 1)

  -i2psam=<ip:port>
       I2P SAM proxy to reach I2P peers and accept I2P connections (default:
       none)

Connecting to I2P peers

There are some hardcoded I2P seeds at the bottom of this file to get started with connections. Scroll down to # manually added 2021-05 for minimal i2p bootstrap support

You can connect to these seeds with -addnode or -seednode in your configuration file (bitcoin.conf).

(If your peers.dat is empty and you start up with -dnsseed=0 then your node will only know the hardcoded seeds.)

Once you have connections you can view your I2P peers:

watch -t ./src/bitcoin-cli -netinfo 4

(For more information on -netinfo see the help documentation using bitcoin-cli -netinfo help or this StackExchange question)

enter image description here

This was enabled by Vasil Dimov's Bitcoin Core PR 20685 merged in March 2021 and BIP 155 for addrv2 messages

Historical discussion of supporting I2P back in 2012 is here. (Thanks to Adam Jonas for finding this)

7
  • 1
    Thanks for sharing this. It will be helpful if you could review a PR which has a part that may include few things about i2p: github.com/bitcoin/bitcoin/pull/21157 – Prayank Mar 9 at 0:07
  • when I try to start the service, I get "System has not been booted with systemd as init system (PID 1). Can't operate." – Rebroad May 3 at 10:57
  • 1
    @Rebroad: See Jon Atack's pull github.com/bitcoin/bitcoin/pull/20829 "4 - Like 1 but with both address and version columns". Basically 4 provides the most information that is possible for netinfo whilst 0 provides the least. – Michael Folkson May 3 at 11:45
  • 1
    @Rebroad: Re your error message. Are you running bitcoind before you run the watch command? If you are I don't know why you are getting that error message. Feel free to ask about it on Freenode #bitcoin-core-pr-reviews – Michael Folkson May 3 at 11:58
  • 1
    @nisc: It hasn't been released yet as part of v22.0 of Bitcoin Core and thus far these are the only instructions to do it so it is still early :) I think the nodes should get picked up by Bitnodes but I'll check – Michael Folkson Jun 9 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.