Enable Bitcoin Knots, Fulcrum, and ElectrumX to connect to ecosystem apps (#1813)

This commit is contained in:
Nathan Fretz 2024-11-19 00:03:30 +10:00 committed by GitHub
parent 0c49ff05cc
commit 9b59da0fcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 236 additions and 43 deletions

View File

@ -114,6 +114,8 @@ BIN_ARGS+=( "-zmqpubsequence=tcp://0.0.0.0:${APP_BITCOIN_KNOTS_ZMQ_SEQUENCE_PORT
# BIN_ARGS+=( "-peerblockfilters=1" )
# BIN_ARGS+=( "-rpcworkqueue=128" )
BIN_ARGS+=( "-blocknotify='curl -s -m 5 http://datum_datum_1:21000/NOTIFY'" )
# We can remove depratedrpc=create_bdb in a future update once Jam (JoinMarket) implements descriptor wallet support
BIN_ARGS+=( "-deprecatedrpc=create_bdb" )
export APP_BITCOIN_KNOTS_COMMAND=$(IFS=" "; echo "${BIN_ARGS[@]}")
@ -130,30 +132,41 @@ if [[ "${APP_BITCOIN_KNOTS_NETWORK_ELECTRS}" = "mainnet" ]]; then
APP_BITCOIN_KNOTS_NETWORK_ELECTRS="bitcoin"
fi
# We do not need this legacy bitcoin app logic because the Bitcoin Knots app was forked after advanced settings were introduced
# Add special handling for knots internal/external port mismatch.
# This must appear above the below loop.
export APP_BITCOIN_RPC_PORT="${APP_BITCOIN_RPC_PORT:-$APP_BITCOIN_KNOTS_INTERNAL_RPC_PORT}"
export APP_BITCOIN_P2P_PORT="${APP_BITCOIN_P2P_PORT:-$APP_BITCOIN_KNOTS_INTERNAL_P2P_PORT}"
# {
# # Migrate settings for app updates differently to fresh installs
# BITCOIN_DATA_DIR="${EXPORTS_APP_DIR}/data/bitcoin"
# IS_POST_ADVANCED_SETTINGS_INSTALL_FILE_PATH="${EXPORTS_APP_DIR}/data/app/IS_POST_ADVANCED_SETTINGS_INSTALL"
# # If no blocks directory exists, we write out a file to indicate that this is a fresh install.
# # This gets around the issue of the pre-start hook starting up the bitcoind container early for Tor HS creation
# # and creating the blocks directory.
# if [[ ! -d "${BITCOIN_DATA_DIR}/blocks" ]] && [[ ! -d "${BITCOIN_DATA_DIR}/testnet3/blocks" ]] && [[ ! -d "${BITCOIN_DATA_DIR}/regtest/blocks" ]]
# then
# touch "${IS_POST_ADVANCED_SETTINGS_INSTALL_FILE_PATH}"
# fi
# APP_CONFIG_EXISTS="false"
# if [[ -f "${EXPORTS_APP_DIR}/data/app/bitcoin-config.json" ]]
# then
# APP_CONFIG_EXISTS="true"
# fi
# if [[ ! -f "${IS_POST_ADVANCED_SETTINGS_INSTALL_FILE_PATH}" ]] && [[ "${APP_CONFIG_EXISTS}" = "false" ]]
# then
# # This app is not a fresh install, it's being updated, so preserve existing clearnet over Tor setting
# export BITCOIN_INITIALIZE_WITH_CLEARNET_OVER_TOR="true"
# fi
# } || true
for var in \
IP \
NODE_IP \
TOR_PROXY_IP \
I2P_DAEMON_IP \
DATA_DIR \
RPC_PORT \
P2P_PORT \
TOR_PORT \
ZMQ_RAWBLOCK_PORT \
ZMQ_RAWTX_PORT \
ZMQ_HASHBLOCK_PORT \
ZMQ_SEQUENCE_PORT \
NETWORK \
RPC_USER \
RPC_PASS \
RPC_AUTH \
INTERNAL_RPC_PORT \
INTERNAL_P2P_PORT \
INTERNAL_tor_PORT \
COMMAND \
RPC_HIDDEN_SERVICE \
P2P_HIDDEN_SERVICE \
NETWORK_ELECTRS
do
bitcoin_var="APP_BITCOIN_${var}"
knots_var="APP_BITCOIN_KNOTS_${var}"
if [ -n "${!knots_var-}" ]; then
export "$bitcoin_var"="${!bitcoin_var:=${!knots_var}}"
else
echo "Warning: $knots_var is unset or empty"
fi
done

View File

@ -1,16 +1,14 @@
manifestVersion: 1.1
id: bitcoin-knots
implements:
- bitcoin
category: bitcoin
name: Bitcoin Knots
version: "27.1.2"
version: "27.1.2-swappable"
tagline: Run your personal node powered by Bitcoin Knots
description: >-
Take control of your digital sovereignty by running a Bitcoin node that aligns with your needs and preferences.
Independently store and validate every single Bitcoin transaction with Bitcoin Knots.
⚠️ Bitcoin Knots does not yet automatically integrate with other apps in the Bitcoin ecosystem on Umbrel.
However, in a future umbrelOS update, users will be able to choose which Bitcoin node app they want to use to connect with other apps.
Powered by Bitcoin Knots: https://bitcoinknots.org/
@ -27,7 +25,12 @@ gallery:
path: ""
defaultPassword: ""
releaseNotes: >-
This release updates Bitcoin Knots on umbrelOS to be compatible with Datum
and introduces several new configuration options in Advanced Settings for configuring your node's block construction policy.
Bitcoin Knots now integrates seamlessly with other apps, allowing you to connect compatible apps like Electrum servers, block explorers, and Lightning nodes directly to it.
To switch an existing app to use Bitcoin Knots, right-click the app and update the connection in “Settings.”
⚠️ Note: This feature requires umbrelOS 1.3 or later.
submitter: Léo Haf
submission: https://github.com/getumbrel/umbrel-apps/pull/953

View File

View File

@ -0,0 +1,53 @@
version: "3.7"
services:
app_proxy:
environment:
APP_HOST: $APP_ELECTRUMX_IP
APP_PORT: 3007
app:
image: ghcr.io/getumbrel/umbrel-electrumx:1.0.0@sha256:2352ce668f722118e248c7b4458a6ea4509e5312e3cf1ee3963ddea35d395c09
depends_on:
- electrumx
restart: on-failure
environment:
ELECTRUM_HIDDEN_SERVICE: "${APP_ELECTRUMX_RPC_HIDDEN_SERVICE}"
ELECTRUM_LOCAL_SERVICE: "${DEVICE_DOMAIN_NAME}"
ELECTRUM_HOST: "${APP_ELECTRUMX_NODE_IP}"
ELECTRUM_PUBLIC_CONNECTION_PORT: "${APP_ELECTRUMX_PUBLIC_CONNECTION_PORT}"
ELECTRUM_RPC_PORT: "${APP_ELECTRUMX_RPC_PORT}"
BITCOIN_HOST: "${APP_BITCOIN_NODE_IP}"
RPC_USER: "${APP_BITCOIN_RPC_USER}"
RPC_PASSWORD: "${APP_BITCOIN_RPC_PASS}"
RPC_PORT: "${APP_BITCOIN_RPC_PORT}"
networks:
default:
ipv4_address: $APP_ELECTRUMX_IP
electrumx:
image: lukechilds/electrumx:v1.16.0@sha256:2949784536f8f85af229004e12e5b5c3a1d7428918a492f77b4e958035c2ae2a
restart: always
init: true
environment:
DAEMON_URL: "http://${APP_BITCOIN_RPC_USER}:${APP_BITCOIN_RPC_PASS}@${APP_BITCOIN_NODE_IP}:${APP_BITCOIN_RPC_PORT}"
COIN: "BitcoinSegwit"
# https://github.com/spesmilo/electrumx/blob/master/electrumx/lib/coins.py
NET: $APP_ELECTRUMX_BITCOIN_NETWORK
volumes:
- "${APP_DATA_DIR}/data/electrumx:/data"
ports:
- "${APP_ELECTRUMX_PUBLIC_CONNECTION_PORT}:${APP_ELECTRUMX_NODE_PORT}"
networks:
default:
ipv4_address: $APP_ELECTRUMX_NODE_IP
tor:
image: getumbrel/tor:0.4.7.8@sha256:2ace83f22501f58857fa9b403009f595137fa2e7986c4fda79d82a8119072b6a
user: "1000:1000"
restart: on-failure
volumes:
- ${APP_DATA_DIR}/torrc:/etc/tor/torrc:ro
- ${TOR_DATA_DIR}:/data
environment:
HOME: "/tmp"

30
electrumx/exports.sh Normal file
View File

@ -0,0 +1,30 @@
export APP_ELECTRUMX_IP="10.21.22.199"
export APP_ELECTRUMX_NODE_IP="10.21.21.199"
export APP_ELECTRUMX_NODE_PORT="50001"
export APP_ELECTRUMX_PUBLIC_CONNECTION_PORT="50003"
export APP_ELECTRUMX_RPC_PORT="8000"
# ElectrumX NET takes: mainnet, testnet, signet, regtest, testnet4
# electrumx 1.16.0 does not support signet or testnet4 (latest commits in repo do however)
export APP_ELECTRUMX_BITCOIN_NETWORK=$APP_BITCOIN_NETWORK
if [[ "${BITCOIN_NETWORK}" == "testnet3" ]]; then
export APP_ELECTRUMX_BITCOIN_NETWORK="testnet"
fi
for var in \
IP \
NODE_IP \
NODE_PORT \
; do
electrs_var="APP_ELECTRS_${var}"
electrumx_var="APP_ELECTRUMX_${var}"
if [ -n "${!electrumx_var-}" ]; then
export "$electrs_var"="${!electrs_var:=${!electrumx_var}}"
else
echo "Warning: $electrumx_var is unset or empty"
fi
done
rpc_hidden_service_file="${EXPORTS_TOR_DATA_DIR}/app-${EXPORTS_APP_ID}-tpc/hostname"
export APP_ELECTRUMX_RPC_HIDDEN_SERVICE="$(cat "${rpc_hidden_service_file}" 2>/dev/null || echo "notyetset.onion")"

26
electrumx/hooks/pre-start Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Delay booting ElectrumX until the RPC Tor Hidden Service is ready
HIDDEN_SERVICE_FILE="${TOR_DATA_DIR}/app-${APP_ID}-tpc/hostname"
if [[ -f "${HIDDEN_SERVICE_FILE}" ]]; then
exit
fi
"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach electrumx
"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach tor
echo "App: ${APP_ID} - Generating Tor Hidden Service..."
for attempt in $(seq 1 100); do
if [[ -f "${HIDDEN_SERVICE_FILE}" ]]; then
echo "App: ${APP_ID} - Hidden service file created successfully!"
break
fi
sleep 0.1
done
if [[ ! -f "${HIDDEN_SERVICE_FILE}" ]]; then
echo "App: ${APP_ID} - Hidden service file wasn't created"
fi

3
electrumx/torrc.template Normal file
View File

@ -0,0 +1,3 @@
# ElectrumX RPC Hidden Service
HiddenServiceDir /data/app-$APP_ID-tpc
HiddenServicePort $APP_ELECTRUMX_NODE_PORT $APP_ELECTRUMX_NODE_IP:$APP_ELECTRUMX_NODE_PORT

35
electrumx/umbrel-app.yml Normal file
View File

@ -0,0 +1,35 @@
manifestVersion: 1.1
id: electrumx
implements:
- electrs
category: bitcoin
name: ElectrumX
version: "1.16.0"
tagline: A lightweight Electrum server
description: >
Run your personal Electrum server and connect your Electrum-compatible wallet,
including BitBoxApp, BlueWallet, Electrum Wallet (Android and Desktop), Nunchuk
(Desktop), Phoenix, and Sparrow Wallet to it instead of using a third-party
Electrum server.
Powered by ElectrumX from Thomas Voegtlin.
An official app from Umbrel.
developer: Umbrel
website: https://umbrel.com/
dependencies:
- bitcoin
repo: https://github.com/getumbrel/umbrel-electrumx
support: https://community.getumbrel.com/c/bitcoin-and-lightning
port: 1999
gallery:
- 1.jpg
- 2.jpg
- 3.jpg
path: ""
defaultPassword: ""
releaseNotes: ""
submitter: Umbrel
submission: https://github.com/getumbrel/umbrel-apps/pull/1813

View File

View File

@ -7,20 +7,21 @@ services:
APP_PORT: 3006
app:
image: ghcr.io/sahilph/umbrel-fulcrum:sha-349e246@sha256:5d565f3b15f7bbeab28c027320ffc84d647e7816cd007fd84077c0db05c15393
image: nmfretz/umbrel-fulcrum:1.0.0@sha256:fd8a45f757e11ae1526b650ee5179d25f469d9b371163466fead08c70aab9d41
depends_on:
- fulcrum
restart: on-failure
environment:
ELECTRUM_HIDDEN_SERVICE: "${APP_FULCRUM_RPC_HIDDEN_SERVICE}"
ELECTRUM_LOCAL_SERVICE: "${DEVICE_DOMAIN_NAME}"
ELECTRUM_PORT: ${APP_FULCRUM_NODE_PORT}
FULCRUM_HOST: "${APP_FULCRUM_NODE_IP}"
FULCRUM_PORT: "${APP_FULCRUM_NODE_PORT}"
ELECTRUM_HOST: "${APP_FULCRUM_NODE_IP}"
ELECTRUM_PUBLIC_CONNECTION_PORT: ${APP_FULCRUM_NODE_PORT}
BITCOIN_HOST: "${APP_BITCOIN_NODE_IP}"
RPC_USER: "${APP_BITCOIN_RPC_USER}"
RPC_PASSWORD: "${APP_BITCOIN_RPC_PASS}"
RPC_PORT: "${APP_BITCOIN_RPC_PORT}"
volumes:
- "${APP_DATA_DIR}/data/fulcrum-logs:/fulcrum-logs"
networks:
default:
ipv4_address: $APP_FULCRUM_IP
@ -31,14 +32,16 @@ services:
user: "1000:1000"
environment:
TCP: 0.0.0.0:${APP_FULCRUM_NODE_PORT}
ADMIN: 0.0.0.0:${APP_FULCRUM_ADMIN_PORT}
BITCOIND: ${APP_BITCOIN_NODE_IP}:${APP_BITCOIN_RPC_PORT}
RPCUSER: ${APP_BITCOIN_RPC_USER}
RPCPASSWORD: ${APP_BITCOIN_RPC_PASS}
PEERING: "false"
ANNOUNCE: "false"
command: Fulcrum _ENV_
command: sh -c 'Fulcrum -D /data _ENV_ 2>&1 | tee /logs/fulcrum.log'
volumes:
- "${APP_DATA_DIR}/data/fulcrum:/data"
- "${APP_DATA_DIR}/data/fulcrum-logs:/logs"
ports:
- "${APP_FULCRUM_NODE_PORT}:${APP_FULCRUM_NODE_PORT}"
networks:

View File

@ -2,6 +2,21 @@ export APP_FULCRUM_IP="10.21.22.200"
export APP_FULCRUM_NODE_IP="10.21.21.200"
export APP_FULCRUM_NODE_PORT="50002"
export APP_FULCRUM_ADMIN_PORT="8000"
for var in \
IP \
NODE_IP \
NODE_PORT \
; do
electrs_var="APP_ELECTRS_${var}"
fulcrum_var="APP_FULCRUM_${var}"
if [ -n "${!fulcrum_var-}" ]; then
export "$electrs_var"="${!electrs_var:=${!fulcrum_var}}"
else
echo "Warning: $fulcrum_var is unset or empty"
fi
done
rpc_hidden_service_file="${EXPORTS_TOR_DATA_DIR}/app-${EXPORTS_APP_ID}-rpc/hostname"
export APP_FULCRUM_RPC_HIDDEN_SERVICE="$(cat "${rpc_hidden_service_file}" 2>/dev/null || echo "notyetset.onion")"

6
fulcrum/hooks/pre-start Normal file → Executable file
View File

@ -1,5 +1,11 @@
#!/usr/bin/env bash
# If ${APP_DATA_DIR}/data/fulcrum-logs doesn't exist, we create it and set 1000:1000 ownership
if [[ ! -d "${APP_DATA_DIR}/data/fulcrum-logs" ]]; then
mkdir -p "${APP_DATA_DIR}/data/fulcrum-logs"
chown 1000:1000 "${APP_DATA_DIR}/data/fulcrum-logs"
fi
# Delay booting Fulcrum until the RPC Tor Hidden Service is ready
HIDDEN_SERVICE_FILE="${TOR_DATA_DIR}/app-${APP_ID}-rpc/hostname"

View File

@ -1,8 +1,10 @@
manifestVersion: 1.1
id: fulcrum
implements:
- electrs
category: bitcoin
name: Fulcrum
version: "1.11.1"
version: "1.11.1-swappable"
tagline: A fast and nimble Electrum Server
description: >-
Run your personal Electrum server and connect your Electrum-compatible wallet,
@ -12,9 +14,6 @@ description: >-
Powered by Fulcrum from Calin Culianu
⚠️ Fulcrum does not yet automatically integrate with other apps in the Bitcoin ecosystem on Umbrel. However, in a future umbrelOS update, users will be able to choose which Electrum Server app they want to use to connect with other apps.
developer: Calin Culianu
website: https://fulcrumserver.org/
submitter: Sahil Phule
@ -30,4 +29,11 @@ gallery:
- 3.jpg
path: ""
defaultPassword: ""
releaseNotes: ""
releaseNotes: >-
Fulcrum now integrates seamlessly with other apps, allowing you to connect to compatible apps like Bitcoin nodes and block explorers.
To switch an existing app to connect to Fulcrum, right-click the app and update the connection in “Settings.”
⚠️ Note: This feature requires umbrelOS 1.3 or later.