Learning-Bitcoin-from-the-C.../15_1_i2p_service.md
Prayank 1bb7c04818 Add i2p
+ Rename Tor section to Privacy
+ Add i2p chapter in Privacy section
+ Change chapter numbers accordingly
+ Create `i2p_service.md`
+ Table for basic differences between Tor and i2p
+ Follow the same format for `15_0_Using_i2p.md` as used in Tor chapter
+ Add details in the steps used to create Bitcoin Core i2p service
2021-06-30 10:35:30 +05:30

3.5 KiB
Raw Blame History

15.1: Bitcoin Core as an I2P (Invisible Internet Project) service

Users should consider different trade-offs involved in using i2p with other networks in Bitcoin Core for better privacy:

  • Sybil Attacks and Network Partitioning is possible with onlynet=i2p
  • Running Onion service with i2p service is experimental for now.
  • For maximum privacy, it is preferable to disable accepting incoming connections.

Read more: https://bitcoin.stackexchange.com/questions/107060/tor-and-i2p-tradeoffs-in-bitcoin-core

Follow the below steps to run Bitcoin Core i2p service:

  1. You can install i2pd on Ubuntu with below commands:

    sudo add-apt-repository ppa:purplei2p/i2pd
    sudo apt-get update
    sudo apt-get install i2pd
    

    For installing on other OS: https://i2pd.readthedocs.io/en/latest/user-guide/install/

  2. Then run it and check if its running:

    $ sudo systemctl start i2pd.service
    

    You should see it running on port 7656:

    $ ss -nlt
    
    State   Recv-Q   Send-Q     Local Address:Port      Peer Address:Port  Process
    
    LISTEN  0        4096           127.0.0.1:7656           0.0.0.0:*
    
  3. Add the following lines in bitcoin.conf. Config logging option debug=i2p is used to have additional information in the debug log about your I2P configuration and connections (Default location on Linux: ~/.bitcoin/bitcoin.conf):

    i2psam=127.0.0.1:7656
    debug=i2p
    
  4. Restart bitcoind

    $ bitcoind
    
  5. Check debug.logif i2p was setup correctly or any errors printed in logs. I2P address is mentioned in the logs and ends with b32.i2p:

    2021-06-15T20:36:16Z i2paccept thread start
    2021-06-15T20:36:16Z I2P: Creating SAM session with 127.0.0.1:7656
    
    2021-06-15T20:36:56Z I2P: SAM session created: session id=3e0f35228b, my address=bmwyyuzyqdc5dcx27s4baltbu6zw7rbqfl2nmclt45i7ng3ul4pa.b32.i2p:18333
    2021-06-15T20:36:56Z AddLocal(bmwyyuzyqdc5dcx27s4baltbu6zw7rbqfl2nmclt45i7ng3ul4pa.b32.i2p:18333,4)
    
  6. Confirm i2p_private_key was created in Bitcoin Core data directory. The first time Bitcoin Core connects to the I2P router, its I2P address (and corresponding private key) will be automatically generated and saved in a file named i2p_private_key:

    ~/.bitcoin/testnet3$ ls
    
    anchors.dat  chainstate         i2p_private_key  settings.json
    banlist.dat  debug.log          mempool.dat      wallets
    blocks       fee_estimates.dat  peers.dat
    
  7. bitcoin-cli -netinfo or bitcoin-cli getnetworkinforeturns i2p address:

    Local addresses
    bmwyyuzyqdc5dcx27s4baltbu6zw7rbqfl2nmclt45i7ng3ul4pa.b32.i2p     port  18333    score      4
    

Summary: Bitcoin Core as an I2P (Invisible Internet Project) service

It is always good to have alternatives for privacy and not depend only on Tor to run Bitcoin Core as hidden service. Since i2p was recently added in Bitcoin Core, less people use it, experiment with it and report bugs if you find any issues.

NOTE: i2pd (C++) is different from i2prouter (Java), you will need i2pd for Bitcoin Core.

Move on to "Programming with RPC" with Chapter Sixteen: Talking to Bitcoind with C.

Or, if you're not a programmer, you can skip to Chapter Nineteen: Understanding Your Lightning Seutp to continue your command-line education with the Lightning Network.