Browse Source

Merge pull request #35 from rootzoll/dev

merge @rootzoll dev
dev
bluecell296 6 years ago
committed by GitHub
parent
commit
67e92b59a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      FAQ.md
  2. 5
      README.md
  3. 49
      home.admin/00infoBlitz.sh
  4. 7
      home.admin/00infoLCD.sh
  5. 4
      home.admin/00mainMenu.sh
  6. 2
      home.admin/40addHDD.sh
  7. 10
      home.admin/80scanLND.sh
  8. 2
      home.admin/90finishSetup.sh
  9. 52
      home.admin/97addMobileWallet.sh
  10. 59
      home.admin/97addMobileWalletShango.sh
  11. 20
      home.admin/97addMobileWalletZap.sh
  12. 87
      home.admin/97addMobileWalletZeus.sh
  13. 78
      home.admin/BBcreateInvoice.sh
  14. 38
      home.admin/BBfundWallet.sh
  15. 28
      home.admin/BBpayInvoice.sh
  16. 4
      home.admin/XXaptInstall.sh
  17. 37
      home.admin/XXchainInSync.sh
  18. 8
      home.admin/XXdisplayLCD.sh
  19. 24
      home.admin/XXdisplayQR.sh
  20. 10
      home.admin/XXdisplayQRlcd.sh
  21. 4
      home.admin/XXdisplayQRlcd_hide.sh
  22. BIN
      home.admin/assets/install_shango.jpg
  23. 138
      home.admin/config.scripts/blitz.datadrive.sh
  24. 1
      home.admin/config.scripts/network.reindex.sh

2
FAQ.md

@ -270,7 +270,7 @@ Linux/Ubuntu (desktop): https://askubuntu.com/questions/86724/how-do-i-open-the-
Linux/Raspbian (command line): https://www.addictivetips.com/ubuntu-linux-tips/manually-partition-a-hard-drive-command-line-linux/
## How do I shrink the QR code for connecting my Shango/Zap mobile phone?
## How do I shrink the QR code for connecting my Shango/Zap/Zeus mobile phone?
Make the fonts smaller until the QR code fits into your (fullscreen) terminal. In OSX use `CMD` + `-` key. In LINUX use `CTRL`+ `-` key. On WINDOWS Putty go into the settings and change the font size: https://globedrill.com/change-font-size-putty

5
README.md

@ -431,11 +431,12 @@ This feature should support you in connecting your RaspiBlitz to a mobile wallet
<img src="pictures/mobile.png" alt="mobile-wallets">
At the moment [ZAP (iOS)](https://github.com/LN-Zap/zap-iOS) and [Shango (iOS/Android)](https://github.com/neogeno/shango-lightning-wallet) are available.
At the moment [ZAP (iOS)](https://github.com/LN-Zap/zap-iOS), [Shango (iOS/Android)](https://github.com/neogeno/shango-lightning-wallet),
and [Zeus (iOS/Android)](https://github.com/ZeusLN/zeus) are available.
Please keep in mind that if you also want to connect to your smartphone also from the outside (thru LTE, 3G, ..) with your RaspiBlitz you might need to open/forward ports on your router and should look into the DynamicDNS features to handle changeing IP of our Home-DSL.
* [How do I shrink the QR code for connecting my Shango/Zap mobile phone?](FAQ.md#how-do-i-shrink-the-qr-code-for-connecting-my-shangozap-mobile-phone)
* [How do I shrink the QR code for connecting my Shango/Zap/Zeus mobile phone?](FAQ.md#how-do-i-shrink-the-qr-code-for-connecting-my-shangozap-mobile-phone)
#### EXPORT: Macaroons and TLS.cert

49
home.admin/00infoBlitz.sh

@ -6,7 +6,8 @@ source /home/admin/_version.info
# set colors
color_red='\033[0;31m'
color_green='\033[0;32m'
color_yellow='\033[0;33m'
color_amber='\033[0;33m'
color_yellow='\033[1;93m'
color_gray='\033[0;37m'
color_purple='\033[0;35m'
@ -90,7 +91,7 @@ if [ -n ${btc_path} ]; then
block_diff=$(expr ${block_chain} - ${block_verified})
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
sync_percentage=$(printf "%.2f%%" "$(echo $progress | awk '{print 100 * $1}')")
sync_percentage=$(echo $progress | awk '{printf( "%.2f%%", 100 * $1)}')
if [ ${block_diff} -eq 0 ]; then # fully synced
sync="OK"
@ -174,19 +175,11 @@ else
if [ $public_check = "0" ]; then
public=""
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
public_color="${color_yellow}"
public_color="${color_amber}"
else
public=""
public_color="${color_red}"
fi
if [ ${#public_addr} -gt 25 ]; then
# if a IPv6 address dont show peers to save space
networkConnectionsInfo=""
fi
if [ ${#public_addr} -gt 35 ]; then
# if a LONG IPv6 address dont show "Public" in front to save space
public_addr_pre=""
fi
# DynDNS
if [ ${#dynDomain} -gt 0 ]; then
@ -196,14 +189,22 @@ else
if [ "${ipOfDynDNS}:${public_port}" != "${public_addr}" ]; then
public_color="${color_red}"
else
public_color="${color_yellow}"
public_color="${color_amber}"
fi
# replace IP display with dynDNS
public_addr_pre="DynDNS "
networkConnectionsInfo=""
public_addr="${dynDomain}"
fi
if [ ${#public_addr} -gt 25 ]; then
# if a IPv6 address dont show peers to save space
networkConnectionsInfo=""
fi
if [ ${#public_addr} -gt 35 ]; then
# if a LONG IPv6 address dont show "Public" in front to save space
public_addr_pre=""
fi
fi
@ -234,7 +235,7 @@ else
public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?)
if [ $public_check = "0" ]; then
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
ln_publicColor="${color_yellow}"
ln_publicColor="${color_amber}"
else
ln_publicColor="${color_red}"
fi
@ -273,17 +274,17 @@ printf "
${color_yellow}
${color_yellow}
${color_yellow}
${color_yellow} ${color_yellow}%s ${color_green} ${ln_alias}
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias}
${color_yellow} ${color_gray}${network} Fullnode + Lightning Network ${torInfo}
${color_yellow} ,/ ${color_yellow}%s
${color_yellow} ,'/ ${color_gray}%s, CPU %s°C
${color_yellow} ,' / ${color_gray}Free Mem ${color_ram}${ram} ${color_gray} Free HDD ${color_hdd}%s
${color_yellow} ,' /_____, ${color_gray}ssh admin@${color_green}${local_ip}${color_gray}${network_rx}${network_tx}
${color_yellow} .'____ ,' ${color_gray}${webinterfaceInfo}
${color_yellow} / ,' ${color_gray}${network} ${color_green}${networkVersion} ${chain}net ${color_gray}Sync ${sync_color}${sync} (%s)
${color_yellow} / ,' ${color_gray}${public_addr_pre}${public_color}${public_addr} ${public}${networkConnectionsInfo}
${color_yellow} /,' ${color_gray}
${color_yellow} /' ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
${color_yellow} / ${color_amber}%s
${color_yellow} // ${color_gray}%s, CPU %s°C
${color_yellow} / / ${color_gray}Free Mem ${color_ram}${ram} ${color_gray} Free HDD ${color_hdd}%s
${color_yellow} / /______ ${color_gray}ssh admin@${color_green}${local_ip}${color_gray}${network_rx}${network_tx}
${color_yellow} /_____ / ${color_gray}${webinterfaceInfo}
${color_yellow} / / ${color_gray}${network} ${color_green}${networkVersion} ${chain}net ${color_gray}Sync ${sync_color}${sync} (%s)
${color_yellow} / / ${color_gray}${public_addr_pre}${public_color}${public_addr} ${public}${networkConnectionsInfo}
${color_yellow} // ${color_gray}
${color_yellow} / ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
${color_yellow}
${color_yellow}${ln_publicColor}${ln_external}${color_red}

7
home.admin/00infoLCD.sh

@ -73,19 +73,18 @@ while :
# check for internet connection
# https://en.wikipedia.org/wiki/1.1.1.1
online=$(ping 1.1.1.1 -c 1 -W 2 | grep -c '1 received')
online=$(ping 1.0.0.1 -c 1 -W 2 | grep -c '1 received')
if [ ${online} -eq 0 ]; then
message="no internet connection"
# when in presync - get more info on progress
elif [ "${state}" = "presync" ]; then
# get blockchain sync progress
blockchaininfo="$(sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf getblockchaininfo 2>/dev/null)"
blockchaininfo="$(sudo -u root ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>/dev/null)"
message="starting"
if [ ${#blockchaininfo} -gt 0 ]; then
message="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
message=$(echo "${message}*100" | bc)
message="${message}%"
message=$(echo $message | awk '{printf( "%.2f%%", 100 * $1)}')
fi
# when old data - improve message

4
home.admin/00mainMenu.sh

@ -545,7 +545,9 @@ case $CHOICE in
sleep 10
echo "stop ${network}d (2) - please wait .."
sudo systemctl stop ${network}d
echo "starting shutdown"
sleep 3
sync
echo "starting shutdown ..."
sudo shutdown now
exit 0
;;

2
home.admin/40addHDD.sh

@ -53,7 +53,7 @@ if [ ${existsHDD} -gt 0 ]; then
# init the RASPIBLITZ Config
configFile="/mnt/hdd/raspiblitz.conf"
configExists=$(sudo ls ${configFile} | grep -c 'raspiblitz.conf')
configExists=$(sudo ls ${configFile} 2>/dev/null | grep -c 'raspiblitz.conf')
if [ ${configExists} -eq 0 ]; then
# create file and use init values from raspiblitz.info

10
home.admin/80scanLND.sh

@ -36,7 +36,7 @@ if [ ${#item} -eq 0 ]; then
# check if offline
# https://en.wikipedia.org/wiki/1.1.1.1
online=$(ping 1.1.1.1 -c 1 -W 2 | grep -c '1 received')
online=$(ping 1.0.0.1 -c 1 -W 2 | grep -c '1 received')
fi
# get total number of blocks
@ -46,7 +46,8 @@ scanstate="${item}/${total}"
# get blockchain sync progress
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
progress=$(echo "${progress}*100" | bc)
#progress=$(echo "${progress}*100" | bc)
progress=$(echo $progress | awk '{printf( "%.2f%%", 100 * $1)}')
# check if blockchain is still syncing
heigh=6
@ -59,7 +60,7 @@ fi
if [ ${online} -eq 0 ]; then
heigh=7
width=44
infoStr=$(echo " Waiting INTERNET CONNECTION\n RaspiBlitz cannot ping 1.1.1.1\n Local IP is ${localip}\n Please check cables and router.")
infoStr=$(echo " Waiting INTERNET CONNECTION\n RaspiBlitz cannot ping 1.0.0.1\n Local IP is ${localip}\n Please check cables and router.")
elif [ ${isInitialChainSync} -gt 0 ]; then
heigh=7
infoStr=" Waiting for final Blockchain Sync\n Progress: ${progress} %\n Please wait - this can take some time.\n ssh admin@${localip}\n Password A"
@ -88,4 +89,5 @@ fi
# display progress to user
sleep 3
dialog --title " ${network} / ${chain} " --backtitle "RaspiBlitz (${hostname})" --infobox "${infoStr}" ${heigh} ${width}
temp=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc)
dialog --title " ${network} / ${chain} " --backtitle "RaspiBlitz (${hostname}) CPU: ${temp}°C" --infobox "${infoStr}" ${heigh} ${width}

2
home.admin/90finishSetup.sh

@ -63,7 +63,7 @@ echo "allow: lightning gRPC"
sudo ufw allow 10009 comment 'lightning gRPC'
echo "allow: lightning REST API"
sudo ufw allow 8080 comment 'lightning REST API'
echo "allow: trasmission"
echo "allow: transmission"
sudo ufw allow 51413 comment 'transmission'
echo "allow: local web admin"
sudo ufw allow from 192.168.0.0/16 to any port 80 comment 'allow local LAN web'

52
home.admin/97addMobileWallet.sh

@ -6,7 +6,7 @@ source /mnt/hdd/raspiblitz.conf
# check if dynamic domain is set
if [ ${#dynDomain} -eq 0 ]; then
dialog --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz
whiptail --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz
also from outside your local network you need to
activate 'Services' -> 'DynamicDNS' FIRST.
@ -25,16 +25,56 @@ fi
# Basic Options
OPTIONS=(ZAP "Zap Wallet (iOS)" \
SHANGO "Shango Wallet (iOS/Android)")
ZEUS "Zeus Wallet (iOS/Android)"
SHANGO_IOS "Shango Wallet for iOS"
SHANGO_ANDROID "Shango Wallet for Android"
)
CHOICE=$(dialog --clear --title "Choose Mobile Wallet" --menu "" 10 40 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 15 50 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
./XXdisplayQRlcd_hide.sh
clear
case $CHOICE in
CLOSE)
exit 1;
;;
SHANGO)
SHANGO_IOS)
echo "https://testflight.apple.com/join/WwCjFnS8" > qr.txt
./XXdisplayLCD.sh /home/admin/assets/install_shango.jpg
whiptail --title "Install Testflight and Shango on your iOS device" \
--yes-button "show link as QR" \
--no-button "continue" \
--yesno "At the moment this app is in public beta testing:\n\nhttps://testflight.apple.com/join/WwCjFnS8" 20 60
if [ $? -eq 0 ]; then
/home/admin/XXdisplayQR.sh
fi
shred qr.txt
rm -f qr.txt
/home/admin/XXdisplayQRlcd_hide.sh
./97addMobileWalletShango.sh
exit 1;
;;
SHANGO_ANDROID)
echo "https://play.google.com/apps/testing/com.shango" > qr.txt
./XXdisplayQRlcd.sh
whiptail --title "Install Shango on your Android Phone" \
--yes-button "show link as QR" \
--no-button "continue" \
--yesno "At the moment this app is in public beta testing:\n\nhttps://play.google.com/apps/testing/com.shango \n\nDo you want to see a QR code with an Playstore link?" 20 60
if [ $? -eq 0 ]; then
/home/admin/XXdisplayQR.sh
fi
shred qr.txt
rm -f qr.txt
/home/admin/XXdisplayQRlcd_hide.sh
./97addMobileWalletShango.sh
exit 1;
;;
@ -42,4 +82,8 @@ case $CHOICE in
./97addMobileWalletZap.sh
exit 1;
;;
ZEUS)
./97addMobileWalletZeus.sh
exit 1;
;;
esac

59
home.admin/97addMobileWalletShango.sh

@ -4,10 +4,7 @@
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# make sure qrcode-encoder in installed
clear
echo "*** Setup ***"
sudo apt-get install qrencode -y
# get local IP
myip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
@ -17,39 +14,33 @@ if [ ${#dynDomain} -gt 0 ]; then
myip="${dynDomain}"
fi
clear
echo "******************************"
echo "Connect Shango Mobile Wallet"
echo "******************************"
echo ""
echo "GETTING THE APP"
echo "At the moment this app is in public beta testing:"
echo "iOS: Read https://testflight.apple.com/join/WwCjFnS8 (open on device)"
echo "Android: https://play.google.com/apps/testing/com.shango (open on device)"
echo ""
echo "*** STEP 1 ***"
#echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt
echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt
./XXdisplayQRlcd.sh
msg=""
if [ ${#dynDomain} -eq 0 ]; then
echo "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
msg="Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
fi
echo "On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED'"
echo "(Or in the App go to --> 'Settings' > 'Connect to your LND Server')"
echo "There you see three 3 form fields to fill out. Skip those and go right to the buttons below."
echo ""
echo "Click on the 'Scan QR' button"
echo "Make the this terminal as big as possible - fullscreen would be best."
echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it with the app."
read key
msg="${msg}On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED' \n\n (Or in the App go to --> 'Settings' > 'Connect to your LND Server') \n\nThere you see three 3 form fields to fill out. Skip those and go right to the buttons below.\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and <continue> or <show QR> to see it in this window."
clear
echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***"
#echo -e "${myip}:10009,\n$(xxd -p -c2000 ~/.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && qrencode -t ANSIUTF8 < qr.txt
echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && qrencode -t ANSI256 < qr.txt
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished."
read key
whiptail --backtitle "Connecting Shango Mobile Wallet" \
--title "Setup Shango Step 1" \
--yes-button "show QR" \
--no-button "continue" \
--yesno "${msg}" 20 65
if [ $? -eq 0 ]; then
/home/admin/XXdisplayQR.sh
fi
shred qr.txt
rm -f qr.txt
clear
echo "Now press 'Connect' within the Shango Wallet."
echo "If its not working - check issues on GitHub:"
echo "https://github.com/neogeno/shango-lightning-wallet/issues"
echo ""
whiptail --backtitle "Connecting Shango Mobile Wallet" \
--title "Press Connect on Shango" \
--msgbox "Now press 'Connect' within the Shango Wallet.\n\nIf its not working - check issues on GitHub:\n\nhttps://github.com/neogeno/shango-lightning-wallet/issues" 15 65
./XXdisplayQRlcd_hide.sh
shred qr.png 2> /dev/null
rm -f qr.png

20
home.admin/97addMobileWalletZap.sh

@ -44,7 +44,7 @@ fi
# make sure qrcode-encoder in installed
echo "*** Setup ***"
echo ""
echo "Installing zapconnect."
echo "Installing lndconnect. Please wait..."
echo ""
echo "Getting github.com/LN-Zap/lndconnect (please wait - can take several minutes) ..."
go get -d github.com/LN-Zap/lndconnect
@ -87,11 +87,25 @@ else
lndconnect --host=${dynDomain}
fi
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished."
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
elif [[ "$unamestr" == 'Darwin' ]]; then
platform='Darwin' # mac OSX
fi
if [[ $platform == 'Linux' ]]; then
echo "(To shrink QR code: CTRL-) Press ENTER when finished."
elif [[ $platform == 'Darwin' ]]; then
echo "(To shrink QR code: CMD-) Press ENTER when finished."
fi
read key
clear
echo "If its not working - check issues on GitHub:"
echo "If it's not working - check issues on GitHub:"
echo "https://github.com/LN-Zap/zap-iOS/issues"
echo "https://github.com/LN-Zap/lndconnect/issues"
echo ""

87
home.admin/97addMobileWalletZeus.sh

@ -0,0 +1,87 @@
#!/bin/bash
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# export go vars (if needed)
if [ ${#GOROOT} -eq 0 ]; then
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
fi
if [ ${#GOPATH} -eq 0 ]; then
export GOPATH=/usr/local/gocode
export PATH=$PATH:$GOPATH/bin
fi
# make sure go is installed
goInstalled=$(go version 2>/dev/null | grep -c 'go')
if [ ${goInstalled} -eq 0 ];then
echo "### Installing GO ###"
wget https://storage.googleapis.com/golang/go1.11.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.11.linux-armv6l.tar.gz
sudo rm *.gz
sudo mkdir /usr/local/gocode
sudo chmod 777 /usr/local/gocode
goInstalled=$(go version 2>/dev/null | grep -c 'go')
fi
if [ ${goInstalled} -eq 0 ];then
echo "FAIL: Was not able to install GO (needed to run LndConnect)"
exit 1
fi
# make sure qrcode-encoder in installed
clear
echo "*** Setup ***"
echo ""
echo "Installing lndconnect. Please wait..."
echo ""
echo "Getting github.com/LN-Zap/lndconnect (please wait) ..."
go get -d github.com/LN-Zap/lndconnect
cd $GOPATH/src/github.com/LN-Zap/lndconnect
echo ""
echo "Building github.com/LN-Zap/lndconnect ..."
make
cd
sleep 3
clear
echo "******************************"
echo "Connect Zeus Mobile Wallet"
echo "******************************"
echo ""
echo "GETTING THE APP"
echo "At the moment this app is in alpha stages."
echo "You can compile the code for iOS or Android but only an Android APK is currently available for downloads."
echo "Go to https://github.com/ZeusLN/zeus/releases to find the latest release."
echo ""
echo "*** STEP 1 ***"
if [ ${#dynDomain} -eq 0 ]; then
echo "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
fi
echo "During setup of the Zeus app you should get to the 'Settings' screen."
echo ""
echo "---> Click on the Scan lndconnect config button"
echo "Make the this terminal as big as possible - fullscreen would be best."
echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it with the app."
read key
clear
echo "*** STEP 2 : Click on Scan (make whole QR code fill camera) ***"
if [ ${#dynDomain} -eq 0 ]; then
# If you drop the -i parameter, lndconnect will use the external IP.
lndconnect -i --port=8080
else
# when dynamic domain is set
lndconnect --host=${dynDomain} --port=8080
fi
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished."
read key
clear
echo "If it's not working - check issues on GitHub:"
echo "https://github.com/ZeusLN/zeus"
echo "https://github.com/LN-Zap/lndconnect/issues"
echo ""

78
home.admin/BBcreateInvoice.sh

@ -13,29 +13,9 @@ if [ ${#chain} -eq 0 ]; then
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
fi
echo ""
echo "*** Precheck ***"
# check if chain is in sync
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
if [ ${chainInSync} -eq 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
echo "Wait until chain is sync with LND and try again."
echo "!!!!!!!!!!!!!!!!!!!"
echo ""
exit 1
fi
# check number of connected peers
echo "check for open channels"
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
if [ ${openChannels} -eq 0 ]; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
echo "!!!!!!!!!!!!!!!!!!!"
echo ""
# Check if ready (chain in sync and channels open)
./XXchainInSync.sh $network $chain
if [ $? != 0 ]; then
exit 1
fi
@ -51,6 +31,8 @@ if [ ${#amount} -eq 0 ]; then
exit 1
fi
# TODO let user enter a description
# build command
command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}"
@ -79,20 +61,48 @@ if [ ${#error} -gt 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "${error}"
else
echo "******************************"
echo "WIN"
echo "******************************"
echo "${result}"
echo ""
# echo "******************************"
# echo "WIN"
# echo "******************************"
# echo "${result}"
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4)
echo -e "${payReq}" > qr.txt
./XXdisplayQRlcd.sh
echo
echo "********************"
echo "Here is your invoice"
echo "********************"
echo
echo "Give this Invoice/PaymentRequest to someone to pay it:"
echo ""
echo ${payReq}
echo ""
echo "You can use 'lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}' to check the payment. "
echo
echo "${payReq}"
echo
echo "Do you want to see the invoice QR-code in this terminal? (Y/N)"
# TODO: Offer to go into monitor for incommin payment loop.
read -n1 key
if [ "$key" = "y" ]; then
/home/admin/XXdisplayQR.sh
fi
shred qr.txt
rm -f qr.txt
clear
echo "************"
echo "What's next?"
echo "************"
echo
echo "You can use"
echo
echo "lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}"
echo
echo "to check the payment."
/home/admin/XXdisplayQRlcd_hide.sh
# TODO: Offer to go into monitor for incommin payment loop.
# Or simply start the loop and show success status when payment occured
fi
echo ""

38
home.admin/BBfundWallet.sh

@ -23,8 +23,8 @@ echo ""
echo "RESULT:"
# PRECHECK) check if chain is in sync
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
if [ ${chainInSync} -eq 0 ]; then
chainOutSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": false' -c)
if [ ${chainOutSync} -eq 1 ]; then
command=""
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
fi
@ -56,15 +56,29 @@ if [ "$chain" = "test" ]; then
coininfo="TESTNET Bitcoin"
fi
# output info
echo ""
echo "******************************"
echo "TODO"
echo "******************************"
echo "Send ${coininfo} to address --> ${address}"
msg="Send ${coininfo} to address --> ${address}\n\nScan the QR code on the LCD with your mobile wallet or copy paste the address."
if [ "$chain" = "test" ]; then
echo "get some testnet coins from https://testnet-faucet.mempool.co"
msg="${msg} \n\n Get some testnet coins from https://testnet-faucet.mempool.co"
fi
echo "Whats next? --> Wait for confirmations. You can use info on LCD to check if funds have arrived."
echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'"
echo ""
echo -e "$network:${address}" > qr.txt
/home/admin/XXdisplayQRlcd.sh
whiptail --backtitle "Fund your on chain wallet" \
--title "Send ${coininfo}" \
--yes-button "show QR" \
--no-button "continue" \
--yesno "${msg} \n\n Do you want to see the QR-code for ${coininfo}:${address} in this window?" 0 0
if [ $? -eq 0 ]; then
/home/admin/XXdisplayQR.sh
fi
shred qr.txt
rm -f qr.txt
whiptail --backtitle "Fund your on chain wallet" \
--title "What's next?" \
--msgbox "Wait for confirmations. \n\nYou can use info on LCD to check if funds have arrived. \n\nIf you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'" 0 0
/home/admin/XXdisplayQRlcd_hide.sh

28
home.admin/BBpayInvoice.sh

@ -12,31 +12,9 @@ if [ ${#chain} -eq 0 ]; then
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
fi
echo ""
echo "*** Precheck ***"
echo "please wait a moment ..."
# check if chain is in sync
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
if [ ${chainInSync} -eq 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
echo "Wait until chain is sync with LND and try again."
echo "!!!!!!!!!!!!!!!!!!!"
echo ""
exit 1
fi
# check number of connected peers
echo "check for open channels"
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
if [ ${openChannels} -eq 0 ]; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
echo "!!!!!!!!!!!!!!!!!!!"
echo ""
# Check if ready (chain in sync and channels open)
./XXchainInSync.sh $network $chain
if [ $? != 0 ]; then
exit 1
fi

4
home.admin/XXaptInstall.sh

@ -0,0 +1,4 @@
# Installs package if not yet installed
if [ $(sudo dpkg-query -l | grep "ii $1" | wc -l) = 0 ]; then
sudo apt-get install $1 -y > /dev/null
fi

37
home.admin/XXchainInSync.sh

@ -0,0 +1,37 @@
#!/bin/bash
# Check if lnd is synced to chain and channels are open
# If it isn't, wait until it is
# exits with 1 if it isn't.
network=$1
chain=$2
# check if chain is in sync
cmdChainInSync="lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c"
chainInSync=${cmdChainInSync}
while [ $chainInSync -eq 0 ]; do
dialog --title "Fail: not in sync" \
--ok-label "Try now" \
--cancel-label "Give up" \
--pause "\n\n'lncli getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
if [ $? -gt 0 ]; then
exit 1
fi
chainInSync=${cmdChainInSync}
done
# check number of connected peers
echo "check for open channels"
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
if [ ${openChannels} -eq 0 ]; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
echo "!!!!!!!!!!!!!!!!!!!"
echo ""
exit 1
fi
exit 0

8
home.admin/XXdisplayLCD.sh

@ -0,0 +1,8 @@
#!/bin/bash
# Display an image on the LCD
# make sure fbi is installed
./XXaptInstall.sh fbi
sudo fbi -a -T 1 -d /dev/fb1 --noverbose $1 2> /dev/null

24
home.admin/XXdisplayQR.sh

@ -0,0 +1,24 @@
#!/bin/bash
# Display a QR code for the string in qr.txt
# make sure qrcode-encode and fbi are installed
#clear
#echo "*** Setup ***"
echo 50 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100
./XXaptInstall.sh qrencode
echo 90 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100
./XXaptInstall.sh fbi
whiptail --title "Get ready" --backtitle "QR-Code in Terminal Window" \
--msgbox "Make this terminal window as large as possible - fullscreen would be best. \n\nThe QR-Code might be too large for your display. In that case, shrink the letters by pressing the keys Ctrl and Minus (or Cmd and Minus if you are on a Mac) \n\nPRESS ENTER when you are ready to see the QR-code." 20 60
clear
qrencode -t ANSI256 < /home/admin/qr.txt
shred /home/admin/qr.txt
rm -f /home/admin/qr.txt
echo "(To shrink QR code: macOS press CMD- / LINUX press CTRL-) Press ENTER when finished."
read key
clear

10
home.admin/XXdisplayQRlcd.sh

@ -0,0 +1,10 @@
#!/bin/bash
# Display a QR code for the string in qr.txt
# make sure qrcode-encode and fbi are installed
./XXaptInstall.sh qrencode
./XXaptInstall.sh fbi
qrencode -l L -o /home/admin/qr.png < /home/admin/qr.txt > /dev/null
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null

4
home.admin/XXdisplayQRlcd_hide.sh

@ -0,0 +1,4 @@
#!/bin/bash
sudo killall -3 fbi
shred /home/admin/qr.png 2> /dev/null
rm -f /home/admin/qr.png 2> /dev/null

BIN
home.admin/assets/install_shango.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

138
home.admin/config.scripts/blitz.datadrive.sh

@ -0,0 +1,138 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "managing additional data storage"
echo "blitz.datadrive.sh [on|off]"
echo "exits on 0 = needs reboot"
exit 1
fi
# check if sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root (with sudo)"
exit 1
fi
# update install sources
echo "make sure BTRFS is installed ..."
sudo apt-get install -y btrfs-tools
echo ""
# check on/off state
dataStorageNotAvailableYet=$(sudo btrfs filesystem df /mnt/data 2>&1 | grep -c "ERROR: not a btrfs filesystem")
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "Trying to switch additional data storage on ..."
if [ ${dataStorageNotAvailableYet} -eq 0 ]; then
echo "FAIL -> data storage is already on"
exit 1
fi
elif [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "Trying to switch additional data storage off ..."
if [ ${dataStorageNotAvailableYet} -eq 1 ]; then
echo "FAIL -> data storage is already off"
exit 1
fi
else
echo "FAIL -> Parameter '${$1}' not known."
exit 1
fi
###################
# SWITCH ON
###################
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# detect the two usb drives
echo "Detecting two USB sticks/drives with same size ..."
lsblk -o NAME | grep "^sd" | while read -r test1 ; do
size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}" | awk '$1=$1' | cut -d " " -f 2)
echo "Checking : ${test1} size(${size1})"
lsblk -o NAME | grep "^sd" | grep -v "${test1}" | while read -r test2 ; do
size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}" | awk '$1=$1' | cut -d " " -f 2)
if [ "${size1}" = "${size2}" ]; then
echo " MATCHING ${test2} size(${size2})"
echo "${test1}" > .dev1.tmp
echo "${test2}" > .dev2.tmp
else
echo " different ${test2} size(${size2})"
fi
done
done
dev1=$(cat .dev1.tmp)
dev2=$(cat .dev2.tmp)
rm -f .dev1.tmp
rm -f .dev2.tmp
echo "RESULTS:"
echo "dev1(${dev1})"
echo "dev2(${dev2})"
echo ""
# check that results are available
if [ ${#dev1} -eq 0 ] || [ ${#dev2} -eq 0 ]; then
echo "!! FAIL -> was not able to detect two devices with the same size"
exit 1
fi
# check size (at least 4GB minus some tolerance)
size=$(lsblk -o NAME,SIZE -b | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2)
if [ ${size} -lt 3500000000 ]; then
echo "!! FAIL -> too small - additional storage needs to be bigger than 4GB"
exit 1
fi
# check if devices are containing old data
echo "Analysing Drives ..."
nameDev1=$(lsblk -o NAME,LABEL | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2)
nameDev2=$(lsblk -o NAME,LABEL | grep "^${dev2}" | awk '$1=$1' | cut -d " " -f 2)
if [ "${nameDev1}" = "DATASTORE" ] || [ "${nameDev2}" = "DATASTORE" ]; then
# TODO: once implemented -> also make sure that dev1 is named "DATASTORE" and if 2nd is other -> format and add as raid
echo "!! NOT IMPLEMENTED YET -> devices seem contain old data, because name is 'DATASTORE'"
echo "if you dont care about that data: format devices devices on other computer with FAT(32) named TEST"
exit 1
fi
echo "OK drives dont contain old data."
echo ""
# format first drive
echo "Formatting /dev/${dev1} with BTRFS ..."
sudo mkfs.btrfs -L DATASTORE -f /dev/${dev1}
echo "OK"
echo ""
# mount the BTRFS drive
echo "Mounting under /mnt/data ..."
sudo mkdir -p /mnt/data
sudo mount /dev/${dev1} /mnt/data
echo "OK"
echo ""
# adding the second device
echo "Adding the second device as RAID1 .."
sudo btrfs device add -f /dev/${dev2} /mnt/data
sudo btrfs filesystem balance start -dconvert=raid1 -mconvert=raid1 /mnt/data
echo ""
exit 0
# adding the second device
uuid=$(sudo btrfs filesystem show /mnt/data | grep "uuid:" | awk '$1=$1' | cut -d " " -f 4)
fi
###################
# SWITCH OFF
###################
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "TODO -> Turn off"
sudo btrfs filesystem show /mnt/data
sudo btrfs filesystem df /mnt/data
sudo umount /mnt/data
exit 0
fi

1
home.admin/config.scripts/network.reindex.sh

@ -59,6 +59,7 @@ while [ ${finished} -eq 0 ]
blockchaininfo=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo)
progress=$(echo "${blockchaininfo}" | jq -r '.verificationprogress')
#progress=$(echo "${progress}*100" | bc)
progress=$(echo $progress | awk '{printf( "%.2f%%", 100 * $1)}')
inprogress="$(echo "${blockchaininfo}" | jq -r '.initialblockdownload')"
if [ "${inprogress}" = "false" ]; then
finished=1

Loading…
Cancel
Save