local customizations: fava, litd, extensions path, lndconnect
Some checks are pending
ci / regtest (push) Waiting to run

This commit is contained in:
Patrick Mulligan 2026-04-27 03:32:10 -04:00
commit 99aad424ef
3 changed files with 210 additions and 7 deletions

110
lndconnect.sh Executable file
View file

@ -0,0 +1,110 @@
#!/bin/bash
#
# Generate lndconnect QR strings for Zeus wallet connection
#
# Usage:
# ./lndconnect.sh [node-number]
#
# Examples:
# ./lndconnect.sh 1 # lnd-1 (requires port exposure)
# ./lndconnect.sh 3 # lnd-3 (REST port 8081 exposed by default)
# ./lndconnect.sh 4 # lnd-4 (Lightning.Pub's node, requires port exposure)
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NODE_NUM="${1:-3}"
DATA_DIR="$SCRIPT_DIR/data/lnd-$NODE_NUM"
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
log() { echo -e "${GREEN}[lndconnect]${NC} $1"; }
warn() { echo -e "${YELLOW}[lndconnect]${NC} $1"; }
error() { echo -e "${RED}[lndconnect]${NC} $1"; exit 1; }
# Get local IP
get_local_ip() {
ip route get 1 2>/dev/null | awk '{print $7; exit}' || hostname -I | awk '{print $1}'
}
# Base64url encode (no padding, URL-safe)
base64url_encode() {
base64 -w0 | tr '+/' '-_' | tr -d '='
}
# Check if node data exists
if [ ! -d "$DATA_DIR" ]; then
error "Node data directory not found: $DATA_DIR"
fi
MACAROON_PATH="$DATA_DIR/data/chain/bitcoin/regtest/admin.macaroon"
CERT_PATH="$DATA_DIR/tls.cert"
if [ ! -f "$MACAROON_PATH" ]; then
error "Macaroon not found: $MACAROON_PATH"
fi
if [ ! -f "$CERT_PATH" ]; then
error "TLS cert not found: $CERT_PATH"
fi
# Get host IP
HOST_IP=$(get_local_ip)
# Determine REST port based on node
case $NODE_NUM in
3) REST_PORT=8081 ;; # Exposed in docker-compose
*)
warn "lnd-$NODE_NUM REST port may not be exposed to host."
warn "You may need to add port mapping to docker-compose.yml"
REST_PORT=8081
;;
esac
log "Generating lndconnect for lnd-$NODE_NUM..."
log "Host: $HOST_IP:$REST_PORT"
# Encode macaroon and cert
MACAROON_B64=$(cat "$MACAROON_PATH" | base64url_encode)
CERT_B64=$(cat "$CERT_PATH" | base64url_encode)
# Build lndconnect URL
LNDCONNECT_URL="lndconnect://${HOST_IP}:${REST_PORT}?macaroon=${MACAROON_B64}&cert=${CERT_B64}"
echo ""
echo "============================================================"
echo "lndconnect URL for lnd-$NODE_NUM:"
echo "============================================================"
echo ""
echo "$LNDCONNECT_URL"
echo ""
# Generate QR code if qrencode is available
if command -v qrencode &>/dev/null; then
log "Generating QR code..."
echo ""
qrencode -t ANSIUTF8 "$LNDCONNECT_URL"
echo ""
else
warn "Install 'qrencode' for terminal QR code: sudo pacman -S qrencode"
fi
echo "============================================================"
echo "Instructions:"
echo "============================================================"
echo "1. Open Zeus wallet"
echo "2. Go to Settings → Add a new node"
echo "3. Scan QR or paste the lndconnect URL"
echo ""
if [ "$NODE_NUM" != "3" ]; then
echo "NOTE: lnd-$NODE_NUM REST port is not exposed by default."
echo "Add this to docker-compose.yml under lnd-$NODE_NUM:"
echo " ports:"
echo " - '808$NODE_NUM:8081'"
echo ""
fi