Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# I2P support in Bitcoin Core3It is possible to run Bitcoin Core as an4[I2P (Invisible Internet Project)](https://en.wikipedia.org/wiki/I2P)5service and connect to such services.7This [glossary](https://i2p.net/en/docs/overview/glossary) may be useful to get8started with I2P terminology.10## Run Bitcoin Core with an I2P router (proxy)12A running I2P router (proxy) is required with the [SAM](https://i2p.net/en/docs/api/samv3)13application bridge enabled. The following routers are recommended for use with Bitcoin Core:15- [i2prouter (I2P Router)](https://i2p.net), the official implementation in16Java. The SAM bridge is not enabled by default; it must be started manually,17or configured to start automatically, in the Clients page in the18router console (`http://127.0.0.1:7657/configclients`) or in the `clients.config` file.19- [i2pd (I2P Daemon)](https://github.com/PurpleI2P/i2pd)20([documentation](https://docs.i2pd.website/en/latest)), a lighter21alternative in C++. It enables the SAM bridge by default.23Note the IP address and port the SAM proxy is listening to; usually, it is24`127.0.0.1:7656`.26Once an I2P router with SAM enabled is up and running, use the following Bitcoin27Core configuration options:29```30-i2psam=<ip:port>31I2P SAM proxy to reach I2P peers and accept I2P connections (default:32none)34-i2pacceptincoming35Whether to accept inbound I2P connections (default: 1). Ignored if36-i2psam is not set. Listening for inbound I2P connections is37done through the SAM proxy, not by binding to a local address and38port.39```41In a typical situation, this suffices:43```44bitcoind -i2psam=127.0.0.1:765645```47## Additional configuration options related to I2P49```50-debug=i2p51```53Set the `debug=i2p` config logging option to see additional information in the54debug log about your I2P configuration and connections. Run `bitcoin-cli help55logging` for more information.57```58-onlynet=i2p59```61Make automatic outbound connections only to I2P addresses. Inbound and manual62connections are not affected by this option. It can be specified multiple times63to allow multiple networks, e.g. onlynet=onion, onlynet=i2p.65I2P support was added to Bitcoin Core in version 22.0 and there may be fewer I2P66peers than Tor or IP ones. Therefore, using I2P alone without other networks may67make a node more susceptible to [Sybil68attacks](https://en.bitcoin.it/wiki/Weaknesses#Sybil_attack). You can use69`bitcoin-cli -addrinfo` to see the number of I2P addresses known to your node.71Another consideration with `onlynet=i2p` is that the initial blocks download72phase when syncing up a new node can be very slow. This phase can be sped up by73using other networks, for instance `onlynet=onion`, at the same time.75In general, a node can be run with both onion and I2P hidden services (or76any/all of IPv4/IPv6/onion/I2P/CJDNS), which can provide a potential fallback if77one of the networks has issues.79## Persistent vs transient I2P addresses81The first time Bitcoin Core connects to the I2P router, it automatically82generates a persistent I2P address and its corresponding private key by default,83unless `-i2pacceptincoming=0` is set. The private key is saved in a file named84`i2p_private_key` in the Bitcoin Core data directory. The persistent I2P85address is used for making outbound connections and accepting inbound86connections.88In the I2P network, the receiver of an inbound connection sees the address of89the initiator. This is unlike the Tor network, where the recipient does not90know who is connecting to it.92If your node is configured by setting `-i2pacceptincoming=0` to not accept93inbound I2P connections, then it will use a random transient I2P address for94itself on each outbound connection to make it harder to discriminate,95fingerprint or analyze it based on its I2P address.97I2P addresses are designed to be long-lived. Waiting for tunnels to be built98for every peer connection adds delay to connection setup time. Therefore, I2P99listening should only be turned off if really needed.101## Fetching I2P-related information from Bitcoin Core103There are several ways to see your I2P address in Bitcoin Core if accepting104incoming I2P connections (`-i2pacceptincoming`):105- in the "Local addresses" output of CLI `-netinfo`106- in the "localaddresses" output of RPC `getnetworkinfo`107- in the debug log (grep for `AddLocal`; the I2P address ends in `.b32.i2p`)109To see which I2P peers your node is connected to, use `bitcoin-cli -netinfo 4`110or the `getpeerinfo` RPC (e.g. `bitcoin-cli getpeerinfo`).112You can use the `getnodeaddresses` RPC to fetch a number of I2P peers known to your node; run `bitcoin-cli help getnodeaddresses` for details.114## Compatibility116Bitcoin Core uses the [SAM v3.1](https://i2p.net/en/docs/api/samv3) protocol117to connect to the I2P network. Any I2P router that supports it can be used.119## Ports in I2P and Bitcoin Core121One particularity of SAM v3.1 is that it does not support ports,122unlike newer versions of SAM (v3.2 and up) that do support them and default the123port numbers to 0. From the point of view of peers that use newer versions of124SAM or other protocols that support ports, a SAM v3.1 peer is connecting to them125on port 0, from source port 0.127To allow future upgrades to newer versions of SAM, Bitcoin Core sets its128listening port to 0 when listening for incoming I2P connections and advertises129its own I2P address with port 0. Furthermore, it will not attempt to connect to130I2P addresses with a non-zero port number because with SAM v3.1 the destination131port (`TO_PORT`) is always set to 0 and is not in the control of Bitcoin Core.133## Bandwidth135By default, your node shares bandwidth and transit tunnels with the I2P network136in order to increase your anonymity with cover traffic, help the I2P router used137by your node integrate optimally with the network, and give back to the network.138It's important that the nodes of a popular application like Bitcoin contribute139as much to the I2P network as they consume.141It is possible, though strongly discouraged, to change your I2P router142configuration to limit the amount of I2P traffic relayed by your node.144With `i2pd`, this can be done by adjusting the `bandwidth`, `share` and145`transittunnels` options in your `i2pd.conf` file. For example, to limit total146I2P traffic to 256KB/s and share 50% of this limit for a maximum of 20 transit147tunnels:149```150bandwidth = 256151share = 50153[limits]154transittunnels = 20155```157Similar bandwidth configuration options for the Java I2P router can be found in158`http://127.0.0.1:7657/config` under the "Bandwidth" tab.160Before doing this, please see the "Participating Traffic Considerations" section161in [Embedding I2P in your Application](https://i2p.net/en/docs/applications/embedding).163In most cases, the default router settings should work fine.165## Bundling I2P in a Bitcoin application167Please see the "General Guidance for Developers" section in https://i2p.net/en/docs/api/samv3168if you are developing a downstream application that may be bundling I2P with Bitcoin.170## Privacy recommendations172- Operating a node that listens on multiple networks (e.g. IPv4 and I2P) can help173strengthen the Bitcoin network, as nodes in this configuration (i.e. bridge nodes) increase174the cost and complexity of launching eclipse and partition attacks. However, under certain175conditions, an adversary that can connect to your node on multiple networks may be176able to correlate those identities by observing shared runtime characteristics. It177is not recommended to expose your node over multiple networks if you require178unlinkability across those identities.
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.