Skip to content

Commit f5702d1

Browse files
authoredFeb 8, 2025
Add i2p support (#19)
* Add i2p support
1 parent f02a049 commit f5702d1

File tree

7 files changed

+100
-7
lines changed

7 files changed

+100
-7
lines changed
 

‎.env.example

+13-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@ SHARED_GID=1099
77
# Example: tor-0.4.8.10
88
TOR_VERSION=0.4.8.13
99

10-
# User identifier used for tor inside the container
10+
# User identifier used for tor inside the container.
1111
TOR_USER_ID=1099
1212

1313
# Directory on the host machine where to moutn the data volume for tor
1414
TOR_DATA=./volumes/tor
1515

16-
# Bitcoin core version and platform to build the container.
16+
# i2p version to build the container.
17+
# To be obtained from this site: https://github.com/i2p/i2p.i2p/releases
18+
# Example: i2p-2.7.0
19+
I2P_VERSION=2.7.0
20+
21+
# User identifier used for i2p inside the container.
22+
I2P_USER_ID=1000
23+
24+
# Directory on the local machine where to mount the data volume for i2p
25+
I2P_DATA=./volumes/i2p
26+
27+
# Bitcoin core version to build the container.
1728
# To be obtained from this site: https://github.com/bitcoin/bitcoin/releases
1829
# Example: bitcoin-v26.0
1930
BITCOIN_VERSION=28.1

‎.github/workflows/build.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ jobs:
99
steps:
1010
- name: Checkout repository
1111
uses: actions/checkout@v3
12-
- name: Build images
12+
- name: Build default images
1313
run: docker compose --env-file .env.example build
14+
- name: Build disabled images
15+
run: docker compose --env-file .env.example --profile disabled build
1416
- name: List images
1517
run: docker images

‎GETTING_STARTED.md

+26
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- <a href="#using-your-node">Using your node</a>
1313
- <a href="#post-installation">Post-installation</a>
1414
- <a href="#remote-access-to-your-node-via-tor-optional">Remote access to your node via tor (Optional)</a>
15+
- <a href="#add-i2p-as-an-additional-network-optional">Add i2p as an additional network (Optional)</a>
1516

1617
## Prerequisites
1718

@@ -122,6 +123,8 @@ $ docker logs -f 06a96296854a
122123
# [notice] Bootstrapped 100% (done): Done
123124
```
124125

126+
127+
125128
### bitcoind
126129

127130
The bitcoind configuration file is located in `/mnt/hdd/bitcoind/bitcoin.conf`. The default parameters are enough, except for one that depends on the memory of your local machine and the default password for communication between services, which you should generate yourself for security reasons.
@@ -317,3 +320,26 @@ $ cat btc-rpc-explorer/hostname
317320
```
318321

319322
To revert this configuration, comment the lines again, and restart tor.
323+
324+
## Add i2p as an additional network (Optional)
325+
326+
I2P (Invisible Internet Project) is a decentralized network designed for anonymous communication, complementing Tor by offering additional censorship resistance protection. Combining I2P with Tor in a Bitcoin node enhances privacy, decentralization, and connectivity to privacy-focused peers while mitigating Eclipse attacks, as the node does not connect to the clearnet by default, making isolation by malicious actors significantly harder.
327+
328+
I2P adds extra complexity to node setup and is disabled by default, allowing advanced users to enable it if needed.
329+
330+
If you want to enable it, uncomment the following lines in the I2P service of the `docker-compose` file.
331+
332+
```conf
333+
profiles:
334+
- disabled
335+
```
336+
337+
When the service is up and running, follow these steps:
338+
339+
- Open the web page: http://your_node_ip:7657 and follow the wizard (just click "Next" for all steps, using the default settings).
340+
- Go to the Client tab.
341+
- Enable Run at Startup? for the SAMBridge client and save.
342+
- Click "Start" for the SAMBridge to activate it immediately.
343+
- After the SAMBridge starts, ensure the configuration is properly saved and the service is running.
344+
345+
Finally, edit the bitcoin.conf file, uncomment the lines related to I2P, and restart the node.

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The following services are deployed:
3535
| <a href="https://github.com/romanz/electrs">Electrs</a> | 0.10.8 | debian:stable-slim | 80.7 MB |
3636
| <a href="https://github.com/janoside/btc-rpc-explorer">Bitcoin RPC Explorer</a> | 3.4.0 | node:22-slim | 377 MB |
3737
| <a href="https://github.com/nginxinc/docker-nginx">NGINX</a> | stable-slim | nginx:alpine-slim | 11.5 MB |
38+
| <a href="https://github.com/i2p/i2p.i2p">i2p</a> (optional) | 2.7.0 | debian:stable-slim | 222 MB |
3839

3940
## Documentation
4041

‎docker-compose.yml

+24-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ services:
1313
networks:
1414
default:
1515
ipv4_address: 172.18.0.2
16+
i2p:
17+
image: i2p:$I2P_VERSION
18+
profiles:
19+
- disabled
20+
build:
21+
context: ./i2p
22+
args:
23+
- I2P_VERSION=$I2P_VERSION
24+
- I2P_USER_ID=$I2P_USER_ID
25+
- GROUP_ID=$SHARED_GID
26+
volumes:
27+
- $I2P_DATA:/i2p/.i2p
28+
environment:
29+
- EXT_PORT:7656
30+
ports:
31+
- 7657:7657
32+
restart: on-failure
33+
networks:
34+
default:
35+
ipv4_address: 172.18.0.3
1636
bitcoind:
1737
image: bitcoind:$BITCOIN_VERSION
1838
depends_on:
@@ -28,7 +48,7 @@ services:
2848
restart: unless-stopped
2949
networks:
3050
default:
31-
ipv4_address: 172.18.0.3
51+
ipv4_address: 172.18.0.4
3252
electrs:
3353
image: electrs:$ELECTRS_VERSION
3454
depends_on:
@@ -45,7 +65,7 @@ services:
4565
restart: on-failure
4666
networks:
4767
default:
48-
ipv4_address: 172.18.0.4
68+
ipv4_address: 172.18.0.5
4969
btcrpcexplorer:
5070
image: btcrpcexplorer:$BTC_RPC_EXPLORER_VERSION
5171
depends_on:
@@ -62,7 +82,7 @@ services:
6282
restart: on-failure
6383
networks:
6484
default:
65-
ipv4_address: 172.18.0.5
85+
ipv4_address: 172.18.0.6
6686
nginx:
6787
image: nginx:alpine-slim
6888
depends_on:
@@ -76,7 +96,7 @@ services:
7696
restart: on-failure
7797
networks:
7898
default:
79-
ipv4_address: 172.18.0.6
99+
ipv4_address: 172.18.0.7
80100

81101
networks:
82102
default:

‎i2p/Dockerfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM alpine:latest AS build
2+
ARG I2P_VERSION
3+
RUN apk add --update --no-cache apache-ant bzip2 gettext gpg gpg-agent wget \
4+
&& cd /opt \
5+
&& wget https://github.com/i2p/i2p.i2p/releases/download/i2p-${I2P_VERSION}/i2psource_${I2P_VERSION}.tar.bz2 \
6+
&& wget https://github.com/i2p/i2p.i2p/releases/download/i2p-${I2P_VERSION}/i2psource_${I2P_VERSION}.tar.bz2.sig \
7+
&& wget -O - https://geti2p.net/_static/idk.key.asc | gpg --import \
8+
&& gpg --verify i2psource_${I2P_VERSION}.tar.bz2.sig \
9+
&& tar -xvf i2psource_${I2P_VERSION}.tar.bz2 \
10+
&& cd i2p-${I2P_VERSION} \
11+
&& ant preppkg-linux-only \
12+
&& apk del apache-ant bzip2 gettext gpg gpg-agent wget
13+
14+
15+
FROM alpine:latest
16+
ARG I2P_USER_ID
17+
ARG I2P_VERSION
18+
ARG GROUP_ID
19+
COPY --from=build /opt/i2p-${I2P_VERSION}/pkg-temp /i2p
20+
COPY --from=build /opt/i2p-${I2P_VERSION}/docker/rootfs/ /
21+
RUN apk add --update --no-cache openjdk17-jre-headless \
22+
&& addgroup --gid ${GROUP_ID} i2p \
23+
&& adduser -u ${I2P_USER_ID} --disabled-password --gecos "" --ingroup i2p i2p \
24+
&& chmod +x /startapp.sh
25+
26+
USER i2p
27+
28+
CMD /startapp.sh

‎volumes/bitcoind/bitcoin.conf

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ onlynet=onion
1717
# Since the preference dns=0, we have to reference "tor" by IP
1818
proxy=172.18.0.2:9050
1919

20+
# i2p - Uncomment when i2p is configured. There can be several onlynet in this file.
21+
# onlynet=i2p
22+
# i2psam=172.18.0.3:7656
23+
#
24+
2025
# When the configuration specifies that śonly tor be used, the node has problems discovering the first nodes
2126
addnode=akvbwwzxuylqefaaxtsvieordjb3invsercadlwseswhii3hjis7vryd.onion
2227
addnode=bitcoinlpnavvcmyviet6vjfdkeive5yolewi4teudtywhbsqxcqtxid.onion

0 commit comments

Comments
 (0)
Please sign in to comment.