|
| 1 | +# I2P support in Bitcoin Core |
| 2 | + |
| 3 | +It is possible to run Bitcoin Core as an |
| 4 | +[I2P (Invisible Internet Project)](https://en.wikipedia.org/wiki/I2P) |
| 5 | +service and connect to such services. |
| 6 | + |
| 7 | +This [glossary](https://geti2p.net/en/about/glossary) may be useful to get |
| 8 | +started with I2P terminology. |
| 9 | + |
| 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 | + |
| 19 | +``` |
| 20 | +-i2psam=<ip:port> |
| 21 | + I2P SAM proxy to reach I2P peers and accept I2P connections (default: |
| 22 | + none) |
| 23 | +
|
| 24 | +-i2pacceptincoming |
| 25 | + If set and -i2psam is also set then incoming I2P connections are |
| 26 | + accepted via the SAM proxy. If this is not set but -i2psam is set |
| 27 | + then only outgoing connections will be made to the I2P network. |
| 28 | + Ignored if -i2psam is not set. Listening for incoming I2P |
| 29 | + connections is done through the SAM proxy, not by binding to a |
| 30 | + local address and port (default: 1) |
| 31 | +``` |
| 32 | + |
| 33 | +In a typical situation, this suffices: |
| 34 | + |
| 35 | +``` |
| 36 | +bitcoind -i2psam=127.0.0.1:7656 |
| 37 | +``` |
| 38 | + |
| 39 | +The first time Bitcoin Core connects to the I2P router, its I2P address (and |
| 40 | +corresponding private key) will be automatically generated and saved in a file |
| 41 | +named `i2p_private_key` in the Bitcoin Core data directory. |
| 42 | + |
| 43 | +## Additional configuration options related to I2P |
| 44 | + |
| 45 | +You may set the `debug=i2p` config logging option to have additional |
| 46 | +information in the debug log about your I2P configuration and connections. Run |
| 47 | +`bitcoin-cli help logging` for more information. |
| 48 | + |
| 49 | +It is possible to restrict outgoing connections in the usual way with |
| 50 | +`onlynet=i2p`. I2P support was added to Bitcoin Core in version 22.0 (mid 2021) |
| 51 | +and there may be fewer I2P peers than Tor or IP ones. Therefore, using |
| 52 | +`onlynet=i2p` alone (without other `onlynet=`) may make a node more susceptible |
| 53 | +to [Sybil attacks](https://en.bitcoin.it/wiki/Weaknesses#Sybil_attack). Use |
| 54 | +`bitcoin-cli -addrinfo` to see the number of I2P addresses known to your node. |
| 55 | + |
| 56 | +## I2P related information in Bitcoin Core |
| 57 | + |
| 58 | +There are several ways to see your I2P address in Bitcoin Core: |
| 59 | +- in the debug log (grep for `AddLocal`, the I2P address ends in `.b32.i2p`) |
| 60 | +- in the output of the `getnetworkinfo` RPC in the "localaddresses" section |
| 61 | +- in the output of `bitcoin-cli -netinfo` peer connections dashboard |
| 62 | + |
| 63 | +To see which I2P peers your node is connected to, use `bitcoin-cli -netinfo 4` |
| 64 | +or the `getpeerinfo` RPC (e.g. `bitcoin-cli getpeerinfo`). |
| 65 | + |
| 66 | +To see which I2P addresses your node knows, use the `getnodeaddresses 0 i2p` |
| 67 | +RPC. |
| 68 | + |
| 69 | +## Compatibility |
| 70 | + |
| 71 | +Bitcoin Core uses the [SAM v3.1](https://geti2p.net/en/docs/api/samv3) protocol |
| 72 | +to connect to the I2P network. Any I2P router that supports it can be used. |
0 commit comments