diff --git a/.env.example b/.env.example index c7d60ea..dac5887 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,8 @@ ELECTRUM_VERSION=4.7.2 # Telegram bot token from @BotFather TELEGRAM_BOT_TOKEN=your_bot_token_here + +# Local / Umbrel mode only: IP address of your Umbrel node. +# umbrel.local will NOT resolve inside the container — use the actual IP. +# Example: UMBREL_IP=192.168.1.100 +UMBREL_IP= diff --git a/.gitignore b/.gitignore index 83a921e..4f35006 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .env +allowed_users.txt *.pyc __pycache__/ diff --git a/README.md b/README.md index 1fb6292..351b697 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ TELEGRAM_BOT_TOKEN=your_bot_token_here ### 3. Add your Telegram user ID to the allowed users list ```bash +cp allowed_users.txt.example allowed_users.txt nano allowed_users.txt ``` @@ -82,6 +83,61 @@ You should see `Electrum daemon started. Launching bot...` followed by the bot s --- +## Local / Umbrel Mode + +Use this mode to connect to your own Electrum server running on Umbrel (or any local node) on your home network. + +> **Note:** `umbrel.local` does not resolve inside Docker containers — mDNS is host-only. Use the actual **IP address** of your Umbrel device (e.g. `192.168.1.100`). + +### Setup + +```bash +cp .env.example .env +nano .env +``` + +Fill in `TELEGRAM_BOT_TOKEN` and set your Umbrel's IP: + +``` +UMBREL_IP=192.168.1.100 +``` + +```bash +cp allowed_users.txt.example allowed_users.txt +nano allowed_users.txt +``` + +### Start + +```bash +docker compose -f docker-compose.local.yml up -d --build +``` + +### How it works + +On first start, the entrypoint writes `./electrum-data/config` with: + +```json +{ + "auto_connect": false, + "enable_proxy": false, + "oneserver": true, + "server": "192.168.1.100:50001:t" +} +``` + +If the config file already exists it is left untouched, so manual edits survive restarts. + +> **If the connection doesn't work:** check `./electrum-data/config` after the first run and make sure the server string still ends in `:t` (TCP). Electrum may rewrite it to `:s` (SSL) on first connect. If it did, stop the container, change it back to `:t`, and restart. + +### Check logs + +```bash +docker compose -f docker-compose.local.yml logs -f +``` + +--- + ## Tor Mode Tor mode runs Electrum through the Tor network. It uses a separate Docker Compose file and Dockerfile so the standard setup is not affected. diff --git a/allowed_users.txt.example b/allowed_users.txt.example new file mode 100644 index 0000000..9e22c12 --- /dev/null +++ b/allowed_users.txt.example @@ -0,0 +1,5 @@ +# Add one Telegram user per line in the format: userid, Name +# Find your user ID by messaging @userinfobot on Telegram. +# Example: +# 123456789, Alice +# 987654321, Bob diff --git a/entrypoint.local.sh b/entrypoint.local.sh index fb1cc94..1e318a6 100644 --- a/entrypoint.local.sh +++ b/entrypoint.local.sh @@ -1,17 +1,19 @@ #!/usr/bin/env bash set -e +: "${UMBREL_IP:?UMBREL_IP is not set. Add it to your .env file (e.g. UMBREL_IP=192.168.1.100)}" + mkdir -p /root/.electrum/wallets CONFIG="/root/.electrum/config" if [ ! -f "$CONFIG" ]; then echo "Writing default config..." - cat > "$CONFIG" <<'EOF' + cat > "$CONFIG" <