Merge branch 'prayank23-i2p'

This commit is contained in:
Shannon Appelcline 2021-06-30 14:20:06 -10:00
commit 2d1aab54e8
No known key found for this signature in database
GPG Key ID: 7EC6B928606F27AD
32 changed files with 165 additions and 46 deletions

31
15_0_Using_i2p.md Normal file
View File

@ -0,0 +1,31 @@
# Chapter 15: Using i2p
The Invisible Internet Project (I2P) is a fully encrypted private network layer. It uses a distributed [network database](https://geti2p.net/en/docs/how/network-database) and encrypted unidirectional tunnels between your and your peers.
Basic differences between Tor and i2p:
| | Tor | i2p |
| :--- | :---: | ---: |
| Routing | [Onion](https://www.onion-router.net/) | [Garlic](https://geti2p.net/en/docs/how/garlic-routing) |
| Network Database | Trusted [Directory Servers](https://blog.torproject.org/possible-upcoming-attempts-disable-tor-network) | [Distributed network database](https://geti2p.net/en/docs/how/network-database) |
| Relay | **Two-way** encrypted connections between each Relay | **One-way** connections between every server in its tunnels |
| Hidden services | Slow | Fast |
Read more: https://geti2p.net/en/comparison/tor
It is not installed by [Bitcoin Standup](https://github.com/BlockchainCommons/Bitcoin-Standup-Scripts) right now as i2p support was recently added in Bitcoin core. However, you can try it manually by following the steps mentioned in [Section One](15_1_i2p_service.md).
## Objectives for This Chapter
After working through this chapter, a developer will be able to:
* Run Bitcoin Core as an I2P (Invisible Internet Project) service
Supporting objectives include the ability to:
* Understand the i2p Network
* Learn difference between Tor and i2p
## Table of Contents
* [Section One: Bitcoin Core as an I2P (Invisible Internet Project) service](15_1_i2p_service.md)

85
15_1_i2p_service.md Normal file
View File

@ -0,0 +1,85 @@
# 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](https://i2pd.readthedocs.io/en/latest/user-guide/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
```
5. Restart `bitcoind`
```
$ bitcoind
```
6. Check `debug.log`if 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)
```
7. 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
```
8. `bitcoin-cli -netinfo` or `bitcoin-cli getnetworkinfo`returns 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.
> :information_source: **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](16_0_Talking_to_Bitcoind.md).
Or, if you're not a programmer, you can skip to [Chapter Nineteen: Understanding Your Lightning Seutp](https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/19_0_Understanding_Your_Lightning_Setup.md) to continue your command-line education with the Lightning Network.

View File

@ -93,7 +93,7 @@ If you'd like to make your own translation, please see [Contributing](https://gi
* [13.2: Writing Complex Multisig Scripts](13_2_Writing_Complex_Multisig_Scripts.md) * [13.2: Writing Complex Multisig Scripts](13_2_Writing_Complex_Multisig_Scripts.md)
* [13.3: Empowering Bitcoin with Scripts](13_3_Empowering_Bitcoin_with_Scripts.md) * [13.3: Empowering Bitcoin with Scripts](13_3_Empowering_Bitcoin_with_Scripts.md)
### PART FOUR: USING TOR ### PART FOUR: PRIVACY
**Status:** Finished. **Status:** Finished.
@ -102,44 +102,47 @@ If you'd like to make your own translation, please see [Contributing](https://gi
* [14.2: Changing Your Bitcoin Hidden Services](14_2_Changing_Your_Bitcoin_Hidden_Services.md) * [14.2: Changing Your Bitcoin Hidden Services](14_2_Changing_Your_Bitcoin_Hidden_Services.md)
* [14.3: Adding SSH Hidden Services](14_3_Adding_SSH_Hidden_Services.md) * [14.3: Adding SSH Hidden Services](14_3_Adding_SSH_Hidden_Services.md)
* [15.0: Using i2p](15_0_Using_i2p.md)
* [15.1: Bitcoin Core as an I2P (Invisible Internet Project) service](15_1_i2p_service.md)
### PART FIVE: PROGRAMMING WITH RPC ### PART FIVE: PROGRAMMING WITH RPC
**Status:** Finished. **Status:** Finished.
* [15.0: Talking to Bitcoind with C](15_0_Talking_to_Bitcoind.md) * [16.0: Talking to Bitcoind with C](15_0_Talking_to_Bitcoind.md)
* [15.1: Accessing Bitcoind in C with RPC Libraries](15_1_Accessing_Bitcoind_with_C.md) * [16.1: Accessing Bitcoind in C with RPC Libraries](15_1_Accessing_Bitcoind_with_C.md)
* [15.2: Programming Bitcoind in C with RPC Libraries](15_2_Programming_Bitcoind_with_C.md) * [16.2: Programming Bitcoind in C with RPC Libraries](15_2_Programming_Bitcoind_with_C.md)
* [15.3: Receiving Notifications in C with ZMQ Libraries](15_3_Receiving_Bitcoind_Notifications_with_C.md) * [16.3: Receiving Notifications in C with ZMQ Libraries](16_3_Receiving_Bitcoind_Notifications_with_C.md)
* [16.0: Programming Bitcoin with Libwally](16_0_Programming_with_Libwally.md) * [17.0: Programming Bitcoin with Libwally](17_0_Programming_with_Libwally.md)
* [16.1: Setting Up Libwally](16_1_Setting_Up_Libwally.md) * [17.1: Setting Up Libwally](17_1_Setting_Up_Libwally.md)
* [16.2: Using BIP39 in Libwally](16_2_Using_BIP39_in_Libwally.md) * [17.2: Using BIP39 in Libwally](17_2_Using_BIP39_in_Libwally.md)
* [16.3: Using BIP32 in Libwally](16_3_Using_BIP32_in_Libwally.md) * [17.3: Using BIP32 in Libwally](17_3_Using_BIP32_in_Libwally.md)
* [16.4: Using PSBTs in Libwally](16_4_Using_PSBTs_in_Libwally.md) * [17.4: Using PSBTs in Libwally](17_4_Using_PSBTs_in_Libwally.md)
* [16.5: Using Scripts in Libwally](16_5_Using_Scripts_in_Libwally.md) * [17.5: Using Scripts in Libwally](17_5_Using_Scripts_in_Libwally.md)
* [16.6: Using Other Functions in Libwally](16_6_Using_Other_Functions_in_Libwally.md) * [17.6: Using Other Functions in Libwally](17_6_Using_Other_Functions_in_Libwally.md)
* [16.7: Integrating Libwally and Bitcoin-CLI](16_7_Integrating_Libwally_and_Bitcoin-CLI.md) * [17.7: Integrating Libwally and Bitcoin-CLI](17_7_Integrating_Libwally_and_Bitcoin-CLI.md)
* [17.0: Talking to Bitcoind with Other Languages](17_0_Talking_to_Bitcoind_Other.md) * [18.0: Talking to Bitcoind with Other Languages](18_0_Talking_to_Bitcoind_Other.md)
* [17.1: Accessing Bitcoind with Go](17_1_Accessing_Bitcoind_with_Go.md) * [18.1: Accessing Bitcoind with Go](18_1_Accessing_Bitcoind_with_Go.md)
* [17.2: Accessing Bitcoind with Java](17_2_Accessing_Bitcoind_with_Java.md) * [18.2: Accessing Bitcoind with Java](18_2_Accessing_Bitcoind_with_Java.md)
* [17.3: Accessing Bitcoind with Node JS](17_3_Accessing_Bitcoind_with_NodeJS.md) * [18.3: Accessing Bitcoind with Node JS](18_3_Accessing_Bitcoind_with_NodeJS.md)
* [17.4: Accessing Bitcoind with Python](17_4_Accessing_Bitcoind_with_Python.md) * [18.4: Accessing Bitcoind with Python](18_4_Accessing_Bitcoind_with_Python.md)
* [17.5: Accessing Bitcoind with Rust](17_5_Accessing_Bitcoind_with_Rust.md) * [18.5: Accessing Bitcoind with Rust](18_5_Accessing_Bitcoind_with_Rust.md)
* [17.6: Accessing Bitcoind with Swift](17_6_Accessing_Bitcoind_with_Swift.md) * [18.6: Accessing Bitcoind with Swift](18_6_Accessing_Bitcoind_with_Swift.md)
### PART SIX: USING LIGHTNING-CLI ### PART SIX: USING LIGHTNING-CLI
**Status:** Finished. **Status:** Finished.
* [18.0: Understanding Your Lightning Setup](18_0_Understanding_Your_Lightning_Setup.md) * [19.0: Understanding Your Lightning Setup](19_0_Understanding_Your_Lightning_Setup.md)
* [18.1: Verifying Your c-lightning Setup](18_1_Verifying_Your_Lightning_Setup.md) * [19.1: Verifying Your c-lightning Setup](19_1_Verifying_Your_Lightning_Setup.md)
* [18.2: Knowing Your c-lightning Setup](18_2_Knowing_Your_lightning_Setup.md) * [19.2: Knowing Your c-lightning Setup](19_2_Knowing_Your_lightning_Setup.md)
* [Interlude: Accessing a Second Lightning Node](18_2__Interlude_Accessing_a_Second_Lightning_Node.md) * [Interlude: Accessing a Second Lightning Node](19_2__Interlude_Accessing_a_Second_Lightning_Node.md)
* [18.3: Creating a Lightning Channel](18_3_Setting_Up_a_Channel.md) * [19.3: Creating a Lightning Channel](19_3_Setting_Up_a_Channel.md)
* [19.0: Using Lightning](19_0_Using_Lightning.md) * [20.0: Using Lightning](20_0_Using_Lightning.md)
* [19.1: Generating a Payment Request](19_1_Generate_a_Payment_Request.md) * [20.1: Generating a Payment Request](20_1_Generate_a_Payment_Request.md)
* [19.2: Paying an Invoice](19_2_Paying_a_Invoice.md) * [20.2: Paying an Invoice](20_2_Paying_a_Invoice.md)
* [19.3: Closing a Lighnting Channel]((19_3_Closing_a_Channel.md)) * [20.3: Closing a Lighnting Channel]((20_3_Closing_a_Channel.md))
* [19.4: Expanding the Lightning Network](19_4_Lightning_Network_Review.md) * [20.4: Expanding the Lightning Network](20_4_Lightning_Network_Review.md)
### APPENDICES ### APPENDICES