Merge branch 'dev' into bostr2

This commit is contained in:
/rootzoll 2024-09-30 18:39:55 +02:00 committed by GitHub
commit 2e41082971
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 322 additions and 165 deletions

View File

@ -2,7 +2,9 @@
- New: Tailscale (basic install script) [details](https://en.wikipedia.org/wiki/Tailscale)
- New: Bostr2 (Nostr Relay Bouncer) [details](https://codeberg.org/Yonle/bostr)
- Update: LNDK 0.2.0 (Pay BOLT12 offers with LND) [details](https://github.com/lndk-org/lndk/releases/tag/v0.2.0)
- Update: Helipad (Podcasting 2.0 Boostagram reader) v0.2.0 [details](https://github.com/Podcastindex-org/helipad/releases/tag/v0.2.0)
- Update: Mempool 3.0.0 [details](https://github.com/mempool/mempool/releases/tag/v3.0.0)
## What's new in Version 1.11.2 of RaspiBlitz?

View File

@ -909,6 +909,7 @@ echo "1. login fresh --> user:admin password:raspiblitz"
echo -e "2. run --> release\n"
# make sure that at least the code is available (also if no internet)
echo "** DISPLAY(${display})"
/home/admin/config.scripts/blitz.display.sh prepare-install || exit 1
# (do last - because it might trigger reboot)
if [ "${display}" != "headless" ] || [ "${baseimage}" = "raspios_arm64" ]; then

View File

@ -375,7 +375,7 @@ if [ "${clNode}" != "${choice}" ]; then
echo "# Core Lightning NODE Setting changed .."
if [ "${choice}" = "on" ]; then
echo "# turning ON"
/home/admin/config.scripts/cl.install.sh on mainnet
/home/admin/config.scripts/cl.install.sh on mainnet || exit 1
# generate wallet from seedwords or just display (write to dev/null to not write seed words to logs)
echo "Generating CL wallet seedwords .."
/home/admin/config.scripts/cl.hsmtool.sh new mainnet noninteractive

View File

@ -20,41 +20,41 @@ source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
source <(/home/admin/config.scripts/network.aliases.sh getvars $LNTYPE ${chain}net)
# check if chain is in sync
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
lncommand="${netprefix}lightning-cli"
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo | grep blocks | awk '{print $2}' | cut -d, -f1)
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
if [ $BLOCKHEIGHT -eq $CLHEIGHT ]; then
cmdChainInSync=1
else
cmdChainInSync=0
fi
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
lncommand="${netprefix}lncli"
cmdChainInSync="$lncli_alias getinfo | grep '"synced_to_chain": true' -c"
fi
chainInSync=${cmdChainInSync}
while [ "${chainInSync}" == "0" ]; do
dialog --title "Fail: not in sync" \
--ok-label "Try now" \
--cancel-label "Give up" \
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
--ok-label "Try now" \
--cancel-label "Give up" \
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
if [ $? -gt 0 ]; then
exit 0
exit 0
fi
chainInSync=${cmdChainInSync}
done
# check number of connected peers
echo "check for open channels"
if [ $LNTYPE = cl ];then
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
elif [ $LNTYPE = lnd ];then
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
if [ $LNTYPE = cl ]; then
openChannels=$($lightningcli_alias getinfo | jq .num_active_channels)
elif [ $LNTYPE = lnd ]; then
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
fi
if [ ${openChannels} -eq 0 ]; then
echo
echo
echo "#########"
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
echo "#########"
@ -66,7 +66,7 @@ fi
l1="Enter the AMOUNT IN SATOSHIS to invoice:"
l2="1 ${network} = 100 000 000 SAT"
dialog --title "Request payment through Lightning" \
--inputbox "$l1\n$l2" 9 50 2>$_temp
--inputbox "$l1\n$l2" 9 50 2>$_temp
amount=$(cat $_temp | xargs | tr -dc '0-9')
shred -u $_temp
if [ ${#amount} -eq 0 ]; then
@ -80,12 +80,12 @@ fi
# TODO let user enter a description
# build command
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
label=$(date +%s) # seconds since 1970-01-01 00:00:00 UTC
# invoice msatoshi label description [expiry] [fallbacks] [preimage] [exposeprivatechannels] [cltv]
command="$lightningcli_alias invoice ${amount}sat $label ''"
# TODO warn about insufficient liquidity
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
command="$lncli_alias addinvoice ${amount}"
fi
@ -114,16 +114,16 @@ if [ ${#error} -gt 0 ]; then
echo "###############"
echo "${error}"
else
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
payReq=$(echo "$result" | grep bolt11 | cut -d '"' -f4)
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
payReq=$(echo "$result" | grep payment_request | cut -d '"' -f4)
fi
sudo /home/admin/config.scripts/blitz.display.sh qr "${payReq}"
if [ $(sudo dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then
sudo apt-get install qrencode -y > /dev/null
sudo apt-get install qrencode -y >/dev/null
fi
# raise high focus on lightning channel balance next 5min
@ -141,24 +141,23 @@ else
echo "${payReq}"
echo
echo "Monitoring the Incoming Payment with:"
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
echo "$lightningcli_alias waitinvoice $label"
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
echo "$lncli_alias lookupinvoice ${rhash}"
fi
echo "Press x and hold to skip to menu."
while :
do
if [ $LNTYPE = cl ];then
while :; do
if [ $LNTYPE = cl ]; then
result=$($lightningcli_alias waitinvoice $label)
wasPayed=$(echo $result | grep -c 'paid')
elif [ $LNTYPE = lnd ];then
wasPaid=$(echo $result | grep -c 'paid')
elif [ $LNTYPE = lnd ]; then
result=$($lncli_alias lookupinvoice ${rhash})
wasPayed=$(echo $result | grep -c '"settled": true')
wasPaid=$(echo $result | grep -c '"settled": true')
fi
if [ ${wasPayed} -gt 0 ]; then
echo
if [ ${wasPaid} -gt 0 ]; then
echo
echo $result
echo
echo "OK the Invoice was paid - returning to menu."
@ -167,16 +166,16 @@ else
sleep 2
break
fi
# wait 2 seconds for key input
read -n 1 -t 2 keyPressed
# check if user wants to abort session
if [ "${keyPressed}" = "x" ]; then
echo
echo
echo $result
echo
echo "Returning to menu - invoice was not payed yet."
echo "Returning to menu - the invoice has not been paid yet."
break
fi
@ -186,4 +185,4 @@ else
fi
echo "Press ENTER to return to main menu."
read key
read key

View File

@ -19,46 +19,46 @@ fi
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
# check if chain is in sync
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
lncommand="${netprefix}lightning-cli"
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo | grep blocks | awk '{print $2}' | cut -d, -f1)
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
if [ $BLOCKHEIGHT -eq $CLHEIGHT ]; then
cmdChainInSync=1
else
cmdChainInSync=0
fi
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
lncommand="${netprefix}lncli"
cmdChainInSync="$lncli_alias getinfo | grep '"synced_to_chain": true' -c"
fi
chainInSync=${cmdChainInSync}
while [ "${chainInSync}" == "0" ]; do
dialog --title "Fail: not in sync" \
--ok-label "Try now" \
--cancel-label "Give up" \
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
--ok-label "Try now" \
--cancel-label "Give up" \
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
if [ $? -gt 0 ]; then
exit 0
exit 0
fi
chainInSync=${cmdChainInSync}
done
# check number of connected peers
echo "check for open channels"
if [ $LNTYPE = cl ];then
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
elif [ $LNTYPE = lnd ];then
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
if [ $LNTYPE = cl ]; then
openChannels=$($lightningcli_alias getinfo | jq .num_active_channels)
elif [ $LNTYPE = lnd ]; then
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
fi
if [ ${openChannels} -eq 0 ]; then
echo
echo
echo "#########"
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
echo "#########"
sleep 3
echo
echo
exit 0
fi
@ -81,7 +81,7 @@ l1="Copy the LightningInvoice/PaymentRequest into here:"
l2="Its a long string starting with '${paymentRequestStart}'"
l3="To try it out go to: ${testSite}"
dialog --title "Pay through the Lightning Network" \
--inputbox "$l1\n$l2\n$l3" 10 70 2>$_temp
--inputbox "$l1\n$l2\n$l3" 10 70 2>$_temp
invoice=$(cat $_temp | xargs)
shred -u $_temp
if [ ${#invoice} -eq 0 ]; then
@ -95,10 +95,10 @@ fi
# TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq
# build command
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
# pay bolt11 [msatoshi] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee]
command="$lightningcli_alias pay ${invoice}"
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
command="$lncli_alias sendpayment --force --pay_req=${invoice}"
fi
@ -112,7 +112,7 @@ echo "Pay Invoice / Payment Request"
echo "This script is an example using lightning in the command line."
echo "It is not optimized for performance or error handling."
echo "************************************************************"
echo
echo
echo "COMMAND LINE: "
echo $command
echo
@ -125,9 +125,9 @@ error=$(cat ${_error})
#echo "result(${result})"
#echo "error(${error})"
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
resultIsError=$(echo "${result}" | grep -c '"code":')
elif [ $LNTYPE = lnd ];then
elif [ $LNTYPE = lnd ]; then
resultIsError=$(echo "${result}" | grep -c "payment_error")
fi
if [ ${resultIsError} -gt 0 ]; then

View File

@ -45,14 +45,9 @@ echo "***********************************************" >> $logFile
# list all running systemd services for future debug
systemctl list-units --type=service --state=running >> $logFile
# check if the file /etc/ssh/sshd_init_keys exists --> initial boot of fresh sd card image
if [ -f "/etc/ssh/sshd_init_keys" ]; then
echo "# init SSH KEYS fresh for new user" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh init >> $logFile
else
echo "# make sure SSH server is configured & running" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh checkrepair >> $logFile
fi
# make sure ssh is configured and running
echo "# make sure SSH server is configured & running" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh checkrepair >> $logFile
echo "## prepare raspiblitz temp" >> $logFile
@ -86,6 +81,12 @@ ln_cl_mainnet_sync_initial_done=0
ln_cl_testnet_sync_initial_done=0
ln_cl_signet_sync_initial_done=0
# detect VM
vm=0
if [ $(systemd-detect-virt) != "none" ]; then
vm=1
fi
# load already persisted valued (overwriting defaults if exist)
source ${infoFile} 2>/dev/null
@ -96,6 +97,7 @@ echo "setupPhase=${setupPhase}" >> $infoFile
echo "setupStep=${setupStep}" >> $infoFile
echo "baseimage=${baseimage}" >> $infoFile
echo "cpu=${cpu}" >> $infoFile
echo "vm=${vm}" >> $infoFile
echo "blitzapi=${blitzapi}" >> $infoFile
echo "displayClass=${displayClass}" >> $infoFile
echo "displayType=${displayType}" >> $infoFile
@ -131,8 +133,9 @@ echo "# raspi_bootdir(${raspi_bootdir})" >> $logFile
flagExists=$(ls ${raspi_bootdir}/stop 2>/dev/null | grep -c 'stop')
if [ "${flagExists}" == "1" ]; then
# set state info
localip=$(hostname -I | awk '{print $1}')
/home/admin/_cache.sh set state "stop"
/home/admin/_cache.sh set message "stopped for manual provision"
/home/admin/_cache.sh set message "stopped for manual provision ${localip}"
systemctl stop background.service
systemctl stop background.scan.service
# log info
@ -284,7 +287,6 @@ source <(/home/admin/config.scripts/blitz.datadrive.sh status)
################################
echo "Waiting for HDD/SSD ..." >> $logFile
ls -la /etc/ssh >> $logFile
until [ ${isMounted} -eq 1 ] || [ ${#hddCandidate} -gt 0 ]
do
@ -885,7 +887,7 @@ if [ ${isMounted} -eq 0 ]; then
# Set Password A (in all cases)
if [ "${passwordA}" == "" ]; then
/home/admin/config.scripts/blitz.error.sh _bootstrap.sh "missing-passworda" "missing passwordA in (${setupFile})" "" ${logFile}
/home/admin/config.scripts/blitz.error.sh _bootstrap.sh "missing-passworda-2" "missing passwordA(2) in (${setupFile})" "" ${logFile}
exit 1
fi

View File

@ -151,7 +151,7 @@ function release() {
echo "- shutdown"
confirmMsg release
if [ $confirm -eq 1 ]; then
/home/admin/config.scripts/blitz.preparerelease.sh
/home/admin/config.scripts/blitz.preparerelease.sh $1
fi
}
@ -161,6 +161,8 @@ function fatpack() {
confirmMsg fatpack
if [ $confirm -eq 1 ]; then
sudo /home/admin/config.scripts/blitz.fatpack.sh
# raspberry pi fatpack has lcd display be default
sudo /home/admin/config.scripts/blitz.display.sh set-display lcd
fi
}

View File

@ -230,21 +230,29 @@ if [ "$1" = "status" ]; then
echo "hddTemperature="
echo "hddTemperatureStr='?°C'"
# display results from hdd & partition detection
echo "hddCandidate='${hdd}'"
hddBytes=0
hddGigaBytes=0
if [ "${hdd}" != "" ]; then
hddBytes=$(fdisk -l /dev/$hdd | grep GiB | cut -d " " -f 5)
if [ "${hddBytes}" = "" ]; then
hddBytes=$(fdisk -l /dev/$hdd | grep TiB | cut -d " " -f 5)
hddBytes=$(fdisk -l /dev/$hdd | grep TiB | cut -d " " -f 5)
fi
hddGigaBytes=$(echo "scale=0; ${hddBytes}/1024/1024/1024" | bc -l)
fi
# check if big enough
if [ ${hddGigaBytes} -lt 130 ]; then
echo "# Found HDD '${hdd}' is smaller than 130GB"
hdd=""
hddDataPartition=""
fi
# display results from hdd & partition detection
echo "hddCandidate='${hdd}'"
echo "hddBytes=${hddBytes}"
echo "hddGigaBytes=${hddGigaBytes}"
echo "hddPartitionCandidate='${hddDataPartition}'"
# if positive deliver more data
if [ ${#hddDataPartition} -gt 0 ]; then
# check partition size in bytes and GBs

View File

@ -136,7 +136,4 @@ echo "* Adding Code&Compile for WEBUI-APP: BTC RPC EXPLORER"
echo "* Adding Code&Compile for WEBUI-APP: MEMPOOL"
/home/admin/config.scripts/bonus.mempool.sh install || exit 1
echo "* Adding Code&Compile for WEBUI-APP: ELECTRS"
/home/admin/config.scripts/bonus.electrs.sh install || exit 1
# set default display to LCD
sudo /home/admin/config.scripts/blitz.display.sh set-display lcd
/home/admin/config.scripts/bonus.electrs.sh install || exit 1

View File

@ -177,6 +177,7 @@ else
blitzpy_wheel=$(ls -trR /home/admin/raspiblitz/home.admin/BlitzPy/dist | grep -E ".*any.whl" | tail -n 1)
blitzpy_version=$(echo ${blitzpy_wheel} | grep -oE "([0-9]\.[0-9]\.[0-9])")
echo "# BlitzPy changed --> UPDATING to Version ${blitzpy_version}"
sudo pip config set global.break-system-packages true
sudo -H /usr/bin/python -m pip install "/home/admin/raspiblitz/home.admin/BlitzPy/dist/${blitzpy_wheel}" >/dev/null 2>&1
fi

View File

@ -68,6 +68,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# install python lib for smime into virtual env
sudo pip config set global.break-system-packages true
sudo -H /usr/bin/python3 -m pip install smime
# write ssmtp config

View File

@ -2,6 +2,7 @@
# Just run this script once after a fresh sd card build
# to prepare the image for release as a downloadable sd card image
# call with parameter `-quick` to skip skip os update
# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop)
raspi_bootdir=""
@ -69,21 +70,25 @@ echo "OK"
wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/torproject.gpg >/dev/null
# update system (only security updates with minimal risk of breaking changes)
echo
echo "update OS ..."
sudo apt-get update -y
sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/sources.list.d/security.list -y
sudo apt-get upgrade openssh-server -y
sudo dpkg --configure -a
if [ "$1" != "-quick" ]; then
echo
echo "update OS ..."
sudo apt-get update -y
sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/sources.list.d/security.list -y
sudo apt-get upgrade openssh-server -y
sudo dpkg --configure -a
else
echo
echo "skipping OS update ..."
fi
# SSH Pubkeys (make unique for every sd card image install)
echo
echo "deleting SSH Pub keys ..."
echo "keys will get recreated and sshd reactivated on fresh bootup, by _bootstrap.sh service"
sudo systemctl stop sshd
sudo systemctl disable sshd
sudo systemctl stop ssh
sudo systemctl disable ssh
sudo rm /etc/ssh/ssh_host_*
sudo touch ${raspi_bootdir}/ssh
echo "OK"
echo

View File

@ -42,7 +42,7 @@ echo "-----------------------------------------------"
sleep 3
# general services to stop
servicesToStop="electrs fulcrum"
servicesToStop="electrs fulcrum elementsd"
for service in ${servicesToStop}; do
if systemctl is-active --quiet ${service}; then
echo "stopping ${service} - please wait .."

View File

@ -52,6 +52,7 @@ if [ "$1" = "init" ]; then
rm /etc/ssh/sshd_init_keys
echo "# restart sshd"
systemctl enable ssh
systemctl restart sshd
if [ $? -gt 0 ]; then
echo "error='sshd restart failed'"
@ -138,7 +139,8 @@ if [ "$1" = "checkrepair" ]; then
if [ ${sshdRunning} -eq 0 ]; then
echo "# DETECTED: SSHD NOT RUNNING --> Try reconfigure & kickstart again"
sudo dpkg-reconfigure openssh-server
sudo systemctl restart sshd
sudo systemctl enable ssh
sudo systemctl restart ssh
sleep 3
fi

View File

@ -161,6 +161,7 @@ function installService() {
echo "
# Elementsd configuration
datadir=/mnt/hdd/app-data/.elements
walletdir=/mnt/hdd/app-data/.elements/liquidv1/wallets
rpcuser=raspiblitz
rpcpassword=$PASSWORD_B
rpcbind=127.0.0.1

View File

@ -1,64 +1,129 @@
#!/bin/bash
# https://github.com/lndk-org/lndk/releases/tag/v0.0.1
LNDKVERSION="v0.1.1"
# https://github.com/lndk-org/lndk/releases
LNDKVERSION="v0.2.0"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch the LNDK Service on or off"
echo "installs the version $LNDKVERSION"
echo "bonus.lndk.sh [on|off|menu]"
echo "bonus.lndk.sh [on|menu]"
echo "bonus.lndk.sh off <--delete-data|--keep-data>"
exit 1
fi
source /home/admin/raspiblitz.info
source <(/home/admin/_cache.sh get state)
# Switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# INSTALL LNDK"
lndkServicePath="/etc/systemd/system/lndk.service"
isInstalled=$(sudo ls $lndkServicePath 2>/dev/null | grep -c 'lndk.service')
if [ ${isInstalled} -eq 0 ]; then
echo "# INSTALL LNDK"
USERNAME=lndk
echo "# add the user: ${USERNAME}"
sudo adduser --system --group --shell /bin/bash --home /home/${USERNAME} ${USERNAME}
echo "Copy the skeleton files for login"
sudo -u ${USERNAME} cp -r /etc/skel/. /home/${USERNAME}/
sudo apt-get install -y protobuf-compiler
# Install Rust for lndk, includes rustfmt
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sudo -u bitcoin sh -s -- -y
sudo -u lndk curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sudo -u lndk sh -s -- -y
# Clone and compile lndk onto Raspiblitz.
if [ ! -d "/home/bitcoin/lndk" ]; then
cd /home/bitcoin || exit 1
sudo -u bitcoin git clone https://github.com/lndk-org/lndk
cd /home/bitcoin/lndk || exit 1
sudo -u bitcoin git checkout tags/$LNDKVERSION -b $LNDKVERSION
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build # Lndk bin will be built to /home/bitcoin/lndk/target/debug/lndk
if [ ! -f "/usr/local/bin/lndk" ] || [ ! -f "/usr/local/bin/lndk-cli" ]; then
cd /home/lndk || exit 1
sudo -u lndk git clone https://github.com/lndk-org/lndk
cd /home/lndk/lndk || exit 1
sudo -u lndk git reset --hard $LNDKVERSION
sudo -u lndk /home/lndk/.cargo/bin/cargo build # Lndk bin will be built to /home/lndk/lndk/target/debug/lndk
sudo install -m 0755 -o root -g root -t /usr/local/bin /home/lndk/lndk/target/debug/lndk
sudo install -m 0755 -o root -g root -t /usr/local/bin /home/lndk/lndk/target/debug/lndk-cli
fi
# LND needs the following configuration settings so lndk can run.
protocol=protocol
lnd_conf_file=/home/bitcoin/.lnd/lnd.conf
if grep $protocol $lnd_conf_file; then
echo "[protocol]
protocol.custom-message=513
protocol.custom-nodeann=39
protocol.custom-init=39
" | sudo tee -a $lnd_conf_file
lnd_conf_file="/home/bitcoin/.lnd/lnd.conf"
lines=(
"protocol.custom-message=513"
"protocol.custom-nodeann=39"
"protocol.custom-init=39"
)
# Check if the [protocol] section exists
needsLNDrestart=0
if grep -q "\[protocol\]" "$lnd_conf_file"; then
# Loop through each line to append after the [protocol] section
for line in "${lines[@]}"; do
# Check if the line already exists in the configuration file
if ! grep -q "$line" "$lnd_conf_file"; then
# Append the line after the [protocol] section
echo $line
sudo sed -i "/^\[protocol\]$/a $line" "$lnd_conf_file"
needsLNDrestart=1
fi
done
else
# If the [protocol] section does not exist, create it and append the lines
{
echo "[protocol]"
for line in "${lines[@]}"; do
echo "$line"
done
} | sudo tee -a "$lnd_conf_file" >/dev/null
needsLNDrestart=1
fi
if [ ${needsLNDrestart} -eq 1 ]; then
if [ "${state}" == "ready" ]; then
sudo systemctl restart lnd
fi
fi
#config
sudo mkdir -p /mnt/hdd/app-data/.lndk
sudo chown -R lndk:lndk /mnt/hdd/app-data/.lndk
sudo chmod 755 /mnt/hdd/app-data/.lndk
cat <<EOF | sudo tee /mnt/hdd/app-data/.lndk/lndk.conf
address="https://localhost:10009"
cert_path="/mnt/hdd/lnd/tls.cert"
macaroon_path="/home/lndk/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"
grpc_port=5635
log_level="debug"
response_invoice_timeout=15
EOF
# symlink data dir for lndk and admin users
sudo rm -rf /home/lndk/.lndk
sudo ln -s /mnt/hdd/app-data/.lndk /home/lndk/
sudo rm -rf /home/admin/.lndk
sudo ln -s /mnt/hdd/app-data/.lndk /home/admin/
# create symlink
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/lndk/.lnd"
# add user to group with admin access to lnd
sudo /usr/sbin/usermod --append --groups lndadmin lndk
echo "[Unit]
Description=lndk Service
After=lnd.service
PartOf=lnd.service
BindsTo=lnd.service
[Service]
ExecStart=/home/bitcoin/lndk/target/debug/lndk --address=https://localhost:10009 --cert=/mnt/hdd/lnd/tls.cert --macaroon=/mnt/hdd/lnd/data/chain/bitcoin/mainnet/admin.macaroon
User=bitcoin
Group=bitcoin
ExecStart=/usr/local/bin/lndk --conf=/mnt/hdd/app-data/.lndk/lndk.conf
User=lndk
Group=lndk
Type=simple
TimeoutSec=60
Restart=on-failure
RestartSec=60
StandardOutput=journal
StandardError=journal
LogLevelMax=4
# Hardening measures
PrivateTmp=true
@ -68,13 +133,25 @@ PrivateDevices=true
[Install]
WantedBy=multi-user.target
" | sudo tee -a $lndkServicePath
" | sudo tee $lndkServicePath
sudo systemctl enable lndk
sudo systemctl start lndk
echo "OK - we've now started the LNDK service"
echo "# Enabled the lndk.service"
if [ "${state}" == "ready" ]; then
sudo systemctl start lndk
echo "# Started the lndk.service"
fi
echo "# Add alias for lndk-cli"
sudo -u admin touch /home/admin/_aliases
if [ $(grep -c "alias lndk-cli" </home/admin/_aliases) -eq 0 ]; then
echo 'alias lndk-cli="lndk-cli -n mainnet --grpc-port=5635"' | sudo tee -a /home/admin/_aliases
fi
# Set value in raspiblitz config
/home/admin/config.scripts/blitz.conf.sh set lndk "on"
else
echo "# LNDK is already installed."
sudo systemctl status lndk
fi
exit 0
@ -82,9 +159,13 @@ fi
# Show info menu
if [ "$1" = "menu" ]; then
whiptail --title " LNDK " --msgbox "Your node is now forwarding onion messages!\n
Check 'sudo systemctl status lndk' to see if it's running properly.\n
See more information about LNDK v0.0.1 here: https://github.com/lndk-org/lndk" 14 63
whiptail --title " LNDK " --msgbox "Your node is now able to pay BOLT12 offers and is forwarding onion messages!
Use the 'lndk-cli' command to get started.
Check 'sudo systemctl status lndk' to see if it's running properly.
Find more information about LNDK here: https://github.com/lndk-org/lndk" 16 63
echo "please wait ..."
exit 0
@ -100,15 +181,46 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo systemctl disable lndk
sudo rm /etc/systemd/system/lndk.service
sudo rm /home/bitcoin/lndk/target/debug/lndk
else
echo "# LNDK is not installed."
fi
# remove the binaries
sudo rm -f /usr/local/bin/lndk
sudo rm -f /usr/local/bin/lndk-cli
sudo rm -f /home/lndk/lndk/target/debug/lndk
# remove the user and home dirlndl
sudo userdel -rf lndk
sudo rm -rf /home/admin/.lndk
# get delete data status - either by parameter or if not set by user dialog
deleteData=""
if [ "$2" == "--delete-data" ]; then
deleteData="1"
fi
if [ "$2" == "--keep-data" ]; then
deleteData="0"
fi
if [ "${deleteData}" == "" ]; then
if (whiptail --title "Delete Data?" --yes-button "Keep Data" --no-button "Delete Data" --yesno "Do you want to delete all data related to LNDK?" 0 0); then
deleteData="0"
else
deleteData="1"
fi
fi
if [ "${deleteData}" == "1" ]; then
echo "# Deleting LNDK data ..."
sudo rm -rf /mnt/hdd/app-data/.lndk
else
echo "# LNDK data is kept on the disk"
fi
# Set value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set lndk "off"
exit 0
exit 0
fi
echo "FAIL - Unknown Parameter $1"

View File

@ -2,7 +2,7 @@
# https://github.com/mempool/mempool
pinnedVersion="v2.5.0"
pinnedVersion="v3.0.0"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -157,15 +157,18 @@ if [ "$1" = "install" ]; then
exit 1
fi
echo "# install Rust for mempool"
sudo -u mempool curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u mempool sh -s -- -y
echo "# npm install for mempool explorer (backend)"
cd ../backend/ || exit 1
if ! sudo -u mempool NG_CLI_ANALYTICS=false npm ci; then
if ! sudo -u mempool NG_CLI_ANALYTICS=false PATH=$PATH:/home/mempool/.cargo/bin npm ci; then
echo "# FAIL - npm install did not run correctly, aborting"
echo "result='failed npm install'"
exit 1
fi
if ! sudo -u mempool NG_CLI_ANALYTICS=false npm run build; then
if ! sudo -u mempool NG_CLI_ANALYTICS=false PATH=$PATH:/home/mempool/.cargo/bin npm run build; then
echo "# FAIL - npm run build did not run correctly, aborting (2)"
echo "result='failed npm run build'"
exit 1
@ -430,7 +433,7 @@ if [ "$1" = "update" ]; then
cd /home/mempool/mempool || exit 1
localVersion=$(git describe --tag)
localVersion=$(sudo -u mempool git describe --tag)
updateVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/mempool/mempool/releases/latest | grep tag_name | head -1 | cut -d '"' -f4)
if [ $localVersion = $updateVersion ]; then
@ -446,12 +449,15 @@ if [ "$1" = "update" ]; then
echo "# npm install for mempool explorer (backend)"
echo "# install Rust for mempool"
sudo -u mempool curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u mempool sh -s -- -y
cd /home/mempool/mempool/backend/ || exit 1
if ! sudo -u mempool NG_CLI_ANALYTICS=false npm ci; then
if ! sudo -u mempool NG_CLI_ANALYTICS=false PATH=$PATH:/home/mempool/.cargo/bin npm ci; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
if ! sudo -u mempool NG_CLI_ANALYTICS=false npm run build; then
if ! sudo -u mempool NG_CLI_ANALYTICS=false PATH=$PATH:/home/mempool/.cargo/bin npm run build; then
echo "FAIL - npm run build did not run correctly, aborting (3)"
exit 1
fi
@ -478,17 +484,12 @@ if [ "$1" = "update" ]; then
cd /home/mempool/mempool || exit 1
# Reinstall the mempool configuration for nginx
cp nginx.conf nginx-mempool.conf /etc/nginx/nginx.conf
sudo systemctl restart nginx
# Remove useless deps
echo "Removing unnecessary modules..."
npm prune --production
sudo -u mempool npm prune --production
echo "*** Restarting Mempool ***"
sudo systemctl start mempool
fi
# check for error

View File

@ -34,9 +34,9 @@ fi
echo
echo "# Running:"
echo "${netprefix}lightning-cli -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS"
echo "${netprefix}lightning-cli -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS,FLAG,BASE,PPM,UPTIME,HTLCS,STATE summars-sort-by=-IN_SATS"
echo
$lightningcli_alias -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS
$lightningcli_alias -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS,FLAG,BASE,PPM,UPTIME,HTLCS,STATE summars-sort-by=-IN_SATS
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ]; then

View File

@ -234,7 +234,9 @@ if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ] || [ "$1" = "
elif [ "$1" = "new-force" ]; then
# get 24 words
source <(python /home/admin/config.scripts/blitz.mnemonic.py generate)
echo "seedwords='${seedwords}'"
seedwordsCommaSeparated=$(echo "$seedwords" | sed 's/^ *//;s/ *$//;s/ \+/, /g')
echo "seedwords='${seedwordsCommaSeparated}'"
echo "seedwords6x4='${seedwords6x4}'"
elif [ "$1" = "seed" ] || [ "$1" = "seed-force" ]; then
#TODO get seedwords from cl.backup.sh seed-import-gui [$RESULTFILE]
@ -248,6 +250,7 @@ if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ] || [ "$1" = "
echo "# No seedwords - exiting"
exit 14
fi
seedwordsCommaSeparated=$(echo "$seedwords" | sed 's/^ *//;s/ *$//;s/ \+/, /g')
# place the seedwords to /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
sudo touch /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
sudo chown bitcoin:bitcoin /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
@ -255,7 +258,7 @@ if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ] || [ "$1" = "
echo "
# This file was placed by cl.hsmtool.sh
# Contains the seed words from which the hsm_secret in the same directory was generated from
seedwords='${seedwords}'
seedwords='${seedwordsCommaSeparated}'
seedwords6x4='${seedwords6x4}'
# Will be removed safely when the hsm_secret is encrypted.
" | sudo -u bitcoin tee /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info

View File

@ -2,21 +2,18 @@
# https://lightning.readthedocs.io/
# https://github.com/ElementsProject/lightning/releases
CLVERSION="v24.02.1"
# install the latest master by using the last commit id
# https://github.com/ElementsProject/lightning/commit/master
# CLVERSION="063366ed7e3b7cc12a8d1681acc2b639cf07fa23"
CLVERSION="v24.08.1"
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys
# rustyrussell D9200E6CD1ADB8F1 # cdecker A26D6D9FE088ED58 # niftynei BFF0F67810C1EED1 # pneuroth (nepet) C3F21EE387FF4CD2
PGPsigner="cdecker"
# rustyrussell D9200E6CD1ADB8F1
# cdecker A26D6D9FE088ED58
# niftynei BFF0F67810C1EED1
# pneuroth (nepet) C3F21EE387FF4CD2
# sfarooqui (ShahanaFarooqui) B56B4453DA8C6DF7FC9BCFCBDCA40B7128DA62A8
# amyers (endothermicdev) F3BF63F2747436AB
PGPsigner="sfarooqui"
PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/${PGPsigner}.txt"
PGPpubkeyFingerprint="A26D6D9FE088ED58"
# PGPsigner="endothermicdev"
# PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
# PGPpubkeyFingerprint="8F55EE750D950E3E"
PGPpubkeyFingerprint="B56B4453DA8C6DF7FC9BCFCBDCA40B7128DA62A8"
# help
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
@ -38,27 +35,30 @@ fi
function installDependencies() {
echo "- installDependencies()"
# from https://lightning.readthedocs.io/INSTALL.html#to-build-on-ubuntu
# apt packages
sudo apt-get install -y \
autoconf automake build-essential git libtool libsqlite3-dev \
net-tools zlib1g-dev libsodium-dev gettext
# additional requirements
sudo apt-get install -y libpq-dev
# for clnrest (since v23.11)
# for clnrest - https://docs.corelightning.org/docs/installation#clnrest
sudo apt-get install -y python3-json5 python3-flask python3-gunicorn
# python deps
# upgrade pip
sudo pip3 config set global.break-system-packages true
sudo pip3 install --upgrade pip
# for clnrest
sudo pip3 install mako
cd /home/bitcoin/lightning || exit 1
sudo -u bitcoin pip3 config set global.break-system-packages true
sudo -u bitcoin pip3 install --user -r plugins/clnrest/requirements.txt
sudo -u bitcoin pip3 install --user flask-cors flask-restx pyln-client flask-socketio gevent gevent-websocket
# for wss proxy - https://docs.corelightning.org/docs/installation#wss-proxy
sudo -u bitcoin pip3 install --user pyln-client websockets
# poetry
sudo pip3 install poetry
if ! grep -Eq '^PATH="$HOME/.local/bin:$PATH"' /home/bitcoin/.profile; then
echo 'PATH="$HOME/.local/bin:$PATH"' | sudo tee -a /home/bitcoin/.profile
fi
export PATH="home/bitcoin/.local/bin:$PATH"
cd /home/bitcoin/lightning || exit 1
sudo -u bitcoin poetry install
}
@ -71,6 +71,9 @@ function buildAndInstallCLbinaries() {
echo
sudo -u bitcoin make
echo
echo "- make check VALGRIND=0"
sudo -u bitcoin make check VALGRIND=0
echo
echo "- install to /usr/local/bin/"
sudo make install || exit 1
}
@ -233,7 +236,7 @@ if [ "$1" = on ] || [ "$1" = update ] || [ "$1" = testPR ]; then
installDependencies
currentCLversion=$(
cd /home/bitcoin/lightning 2>/dev/null
cd /home/bitcoin/lightning || exit 1
git describe --tags 2>/dev/null
)
echo "# Building from source Core Lightning $currentCLversion"
@ -259,10 +262,13 @@ if [ "$1" = on ] || [ "$1" = update ] || [ "$1" = testPR ]; then
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available 2>/dev/null
echo "# Store the lightning data in /mnt/hdd/app-data/.lightning"
sudo mkdir -p /mnt/hdd/app-data/.lightning
echo "# Symlink to /home/bitcoin/"
sudo rm -rf /home/bitcoin/.lightning # not a symlink, delete
sudo mkdir -p /mnt/hdd/app-data/.lightning
sudo ln -s /mnt/hdd/app-data/.lightning /home/bitcoin/
echo "# Symlink to /home/admin/"
sudo rm -rf /home/admin/.lightning # not a symlink, delete
sudo ln -s /mnt/hdd/app-data/.lightning /home/admin/
if [ ${CLNETWORK} != "bitcoin" ] && [ ! -d /home/bitcoin/.lightning/${CLNETWORK} ]; then
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}
@ -333,14 +339,11 @@ always-use-proxy=true
}" | sudo tee /etc/logrotate.d/${netprefix}lightningd
# debug:
# sudo logrotate --debug /etc/logrotate.d/lightningd
echo
sudo -u admin touch /home/admin/_aliases
if ! grep -Eq "^alias ${netprefix}lightning-cli" /home/admin/_aliases; then
echo "# Adding aliases"
echo "# Adding aliases: ${netprefix}cl, ${netprefix}cllog, ${netprefix}clconf"
echo "\
alias ${netprefix}lightning-cli=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
--conf=${CLCONF}\"
alias ${netprefix}cl=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
--conf=${CLCONF}\"
alias ${netprefix}cllog=\"sudo\

View File

@ -156,7 +156,7 @@ if [ "$2" = "info" ]; then
# raw data demo:
# sudo /usr/local/bin/lightning-cli --lightning-dir=/home/bitcoin/.lightning --conf=/home/bitcoin/.lightning/config getinfo
# get data
# getinfo
command="sudo -u bitcoin $lightningcli_alias getinfo"
ln_getInfo=$(${command} 2>/dev/null)
if [ "${ln_getInfo}" == "" ]; then
@ -165,6 +165,15 @@ if [ "$2" = "info" ]; then
exit 1
fi
# listpeers
command="sudo -u bitcoin $lightningcli_alias listpeers"
ln_listpeers=$(${command} 2>/dev/null)
if [ "${ln_listpeers}" == "" ]; then
echo "command='${command}'"
echo "error='no data'"
exit 1
fi
# parse data
cl_alias=$(echo "${ln_getInfo}" | grep '"alias":' | cut -d '"' -f4)
port=$(echo "${ln_getInfo}" | grep '"port":' | cut -d: -f2 | tail -1 | bc)
@ -176,9 +185,9 @@ if [ "$2" = "info" ]; then
cl_address="${pubkey}@${address}:${port}"
cl_tor=$(echo "${cl_address}" | grep -c ".onion")
cl_channels_pending=$(echo "${ln_getInfo}" | jq -r '.num_pending_channels')
cl_channels_active=$(echo "${ln_getInfo}" | jq -r '.num_active_channels')
cl_channels_inactive=$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')
cl_channels_total=$((cl_channels_pending + cl_channels_active + cl_channels_inactive))
cl_channels_active=$(echo "${ln_listpeers}" | jq -r '[.peers[] | select(.connected == true)] | length')
cl_channels_inactive=$(echo "${ln_listpeers}" | jq -r '[.peers[] | select(.connected == false)] | length')
cl_channels_total=$((cl_channels_active + cl_channels_inactive))
cl_peers=$(echo "${ln_getInfo}" | jq -r '.num_peers')
cl_fees_collected_msat=$(echo "${ln_getInfo}" | jq -r '.fees_collected_msat')

View File

@ -196,6 +196,7 @@ if [ "$1" = on ]; then
Description=c-lightning-REST daemon for ${CHAIN}
Wants=${netprefix}lightningd.service
After=${netprefix}lightningd.service
BindsTo=${netprefix}lightningd.service
[Service]
ExecStart=/usr/bin/node /home/bitcoin/c-lightning-REST/${CLNETWORK}/cl-rest.js

View File

@ -79,7 +79,7 @@ fi
#############################################
# get local IP Range
localiprange=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0\|inet' | tail -n1 | awk '{print $2}' | awk -F. '{print $1"."$2"."$3".0/24"}')
localiprange=$(ip -o -4 addr show ${networkDevice} | awk '/scope global/ {split($4,ip,"/"); split(ip[1],octets,"."); printf "%s.%s.%s.0/%s\n", octets[1], octets[2], octets[3], ip[2]}')
#############################################
# check DHCP

View File

@ -285,6 +285,13 @@ fi
echo "# Starting passwords dialog ..."
sudo /home/admin/setup.scripts/dialogPasswords.sh || exit 1
# check if password A is set
source ${SETUPFILE}
if [ "${passwordA}" == "" ]; then
/home/admin/config.scripts/blitz.error.sh $(basename "$0") "missing-passworda-1" "missing passwordA(1) in (${SETUPFILE}) after dialogPasswords.sh" ""
exit 1
fi
# set flag for bootstrap process to kick-off provision process
/home/admin/_cache.sh set state "waitprovision"