Browse Source

update from rootzoll /raspiblitz dev

dev
openoms 6 years ago
parent
commit
25107a262a
  1. 43
      FAQ.md
  2. 1
      README.md
  3. 9
      home.admin/00infoBlitz.sh
  4. 15
      home.admin/00infoLCD.sh
  5. 31
      home.admin/00mainMenu.sh
  6. 5
      home.admin/00settingsMenuServices.sh
  7. 9
      home.admin/10setupBlitz.sh
  8. 112
      home.admin/50copyHDD.sh
  9. 23
      home.admin/50syncHDD.sh
  10. 1
      home.admin/95finalSetup.sh
  11. 1
      home.admin/AAunlockLND.sh
  12. 1
      home.admin/BBcashoutWallet.sh
  13. 1
      home.admin/BBcloseAllChannels.sh
  14. 1
      home.admin/BBconnectPeer.sh
  15. 1
      home.admin/BBcreateInvoice.sh
  16. 1
      home.admin/BBfundWallet.sh
  17. 1
      home.admin/BBopenChannel.sh
  18. 1
      home.admin/BBpayInvoice.sh
  19. 100
      home.admin/XXcleanHDD.sh
  20. 52
      home.admin/assets/raspiblitz-torrents-rss.xml
  21. 1
      home.admin/config.scripts/lnd.setname.sh
  22. 87
      home.admin/config.scripts/network.reindex.sh

43
FAQ.md

@ -34,6 +34,26 @@ Of course people should modify the system, add own scripts, etc ... but if you w
BTW there is a beneficial side effect, when updating with a new SD card: You also get rid of any maleware or system bloat that happend in the past. You start with a fresh system :) BTW there is a beneficial side effect, when updating with a new SD card: You also get rid of any maleware or system bloat that happend in the past. You start with a fresh system :)
## I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?
Copying a already synced blockchain from another computer (for example your Laptop) can be a quick way to get the RaspiBlitz started. Also that way you synced and verified the blockchain yourself and not trusting the RaspiBlitz FTP/Torrent downloads (dont trust, verify).
One requirement is that the blockchain is from another bitcoin-core client with version greater or equal to 0.17.1 with transaction index switched on (`txindex=1` in the `bitcoin.conf`).
But we dont copy the data via USB to the device, because the HDD needs to be formatted in EXT4 and that is usually not read/writeable by Windows or Mac computers. So I will explain a way to copy the data thru your local network. This should work from Windows, Mac, Linux and even from another already synced RaspiBlitz.
Both computers (your RaspberryPi and the other computer with the full blockchain on) need to be connected to the same local network. Make sure that bitcoin is stoped on the computer containing the blockchain. If your blockchain source is another RaspiBlitz run on the terminal `sudo systemctl stop bitcoind` and then go to the directory where the blochcian data is with `cd /mnt/hdd/bitcoin` - when copy/transfer is done later reboot a RaspiBlitz source with `sudo shutdown -r now`.
If everything of the above is prepared, start the setup of the new RaspiBlitz with a fresh SD card (like explained in the README) - its OK that there is no blockchain data on your HDD yet - just follow the setup. When you get to the setup-point `Getting the Blockchain` choose the COPY option. Starting from version 1.0 of the RaspiBlitz this will give you further detailed instructions how to transfere the blockchain data onto your RaspiBlitz. In short: On your computer with the blockchain data source you will execute SCP commands, that will copy the data over your Local Network to your RaspiBlitz.
Once you finished all the transferes the Raspiblitz will make a quick-check on the data - but that will not guarantee that everything in detail was OK with the transfere. Check further FAQ answeres if you get stuck or see a final sync with a value below 90%.
## Why is my "final sync" taking so long?
First of all if you see a final sync over 90% and you can see from time to time small increase - you should be OK ... this can take some looong time to catch up with the network. Only in the case that you activly choose the `SYNC` option in the `Getting the Blockchain` a final sync under 90% is OK. If you did a torrent, a FTP or a copy from another computer and seeing under 90% somthing went wrong and the setup process is ignoring your prepared Blockchain and doing a full sync - which can almost take forever on a raspberryPi.
So if something is wrong (like mentioned above) then try again from the beginning. You need to reset your HDD for a fresh start: SSH in as admin user. Abort the final sync info with CTRL+c to get to the terminal. There run `sudo /home/admin/XXcleanHDD.sh -all` and follow the script to delete all data in HDD. When finsihed power down with `sudo shutdown now`. Then make a fresh SD card from image and this time try another option to get the blockchain. If you run into trouble the second time, please report an issue on GitHub.
## How to backup my Lightning Node? ## How to backup my Lightning Node?
CAUTION: Restoring a backup can lead to LOSS OF ALL CHANNEL FUNDS if its not the latest channel state. There is no perfect backup solution for lightning nodes yet - this topic is in development by the community. CAUTION: Restoring a backup can lead to LOSS OF ALL CHANNEL FUNDS if its not the latest channel state. There is no perfect backup solution for lightning nodes yet - this topic is in development by the community.
@ -46,6 +66,17 @@ To really have a good backup to rely on such feature needs to be part of the LND
But you can try to backup at your own risk. All your Lightning Node data is within the `/mnt/hdd/lnd` directory. Just run a backup of that data when the lnd service is stopped. But you can try to backup at your own risk. All your Lightning Node data is within the `/mnt/hdd/lnd` directory. Just run a backup of that data when the lnd service is stopped.
## What is this mnemonic seed word list?
With the 24 word list given you by LND on wallet creation you can recover your private key (BIP 39). You should write it down and store it at a save place.
For more background on mnemonic seeds see this video: https://www.youtube.com/watch?v=wWCIQFNf_8g
# How does PASSWORD D effects this seed?
On wallet creation you get asked if you want to protect your word seed list with an additional password. If you choose so, RaspiBlitz recommends you to use your PASSWORD D at this point.
To use a an additional password for your seed words is optional. If you choose so, you will need the password to recover your private key from your your seed words later on. Without this password your private key cannot be recovered from your seed words. So the password adds an additional layer of security, if someone finds your written down word list.
## How do I change the Name/Alias of my lightning node ## How do I change the Name/Alias of my lightning node
@ -87,3 +118,15 @@ https://www.addictivetips.com/ubuntu-linux-tips/manually-partition-a-hard-drive-
## 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 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 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
## Why is my bitcoin IP on the display red?
The bitcoin IP is red, when the RaspiBlitz detects that it cannot reach the port of bitcoin node from the outside. This means the bitcoin node can peer with other bitcoin nodes, but other bitcoin nodes cannot initiate a peering with you. Dont worry, you dont need a publicly reachable bitcoin node to run a (public) lightning node. If you want to change this however, you need to forward port 8333 on your router to the the RaspiBlitz. How to do this is different on every router.
## Why is my node address on the display red?
The node address is red, when the RaspiBlitz detects that it cannot reach the port of the LND node from the outside - when the device is behind a NAT or firewall of the the router. Your node is not publicly reachable. This means you can peer+openChannel with other public nodes, but other nodes cannot peer+openChannel with you. To change this you need to forward port 9735 on your router to the the RaspiBlitz. How to do this is different on every router.
## Why is my node address on the display yellow (not green)?
Yellow is OK. The RaspiBlitz can detect, that it can reach a service on the port 9735 of your public IP - this is in most cases the LND of your RaspiBlitz. But the RaspiBlitz cannot 100% for sure detect that this is its own LND service on that port - thats why its just yellow, not green.

1
README.md

@ -405,6 +405,7 @@ This is highly experimental. And again: If you restore the LND with an backup th
To connect a RaspiBlitz directly (without a router/switch) to your laptop and share the WIFI internet connection, you can follow this [guide for OSX](https://medium.com/@tzhenghao/how-to-ssh-into-your-raspberry-pi-with-a-mac-and-ethernet-cable-636a197d055). In short: To connect a RaspiBlitz directly (without a router/switch) to your laptop and share the WIFI internet connection, you can follow this [guide for OSX](https://medium.com/@tzhenghao/how-to-ssh-into-your-raspberry-pi-with-a-mac-and-ethernet-cable-636a197d055). In short:
* make sure all VPN are off (can interfere with local LAN)
* connect with LAN directly * connect with LAN directly
* Settings > Sharing/Freigaben > activate "internet sharing" from WLAN to Ethernet * Settings > Sharing/Freigaben > activate "internet sharing" from WLAN to Ethernet
* Settings > Network > Ethernet-Adapter > set to DHCP * Settings > Network > Ethernet-Adapter > set to DHCP

9
home.admin/00infoBlitz.sh

@ -152,16 +152,19 @@ torInfo=""
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6) networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
# TOR or IP # TOR or IP
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo) networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
networkConnections=$(echo ${networkInfo} | jq -r '.connections') networkConnections=$(echo ${networkInfo} | jq -r '.connections')
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections" networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections"
if [ "${onionAddress}" != "null" ]; then
if [ "${runBehindTor}" = "on" ]; then
# TOR address # TOR address
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}peers" networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}peers"
public_addr="${onionAddress}:${public_port}" public_addr="${onionAddress}:${public_port}"
public="" public=""
public_color="${color_green}" public_color="${color_green}"
torInfo="+ TOR" torInfo="+ TOR"
else else
# IP address # IP address
@ -286,7 +289,7 @@ ${color_yellow}${ln_publicColor}${ln_external}
"-------------------------------------------" \ "-------------------------------------------" \
"load average:${load##up*, }" "${temp}" \ "load average:${load##up*, }" "${temp}" \
"${hdd}" "${sync_percentage}" "${hdd}" "${sync_percentage}"
if [ ${#onionAddress} -eq 0 ]; then if [ "${runBehindTor}" != "on" ]; then
# one extra space line at the end if nodeaddress is not TOR # one extra space line at the end if nodeaddress is not TOR
echo "" echo ""
fi fi

15
home.admin/00infoLCD.sh

@ -37,7 +37,7 @@ while :
l1="Waiting for Network ...\n" l1="Waiting for Network ...\n"
l2="Not able to get local IP.\n" l2="Not able to get local IP.\n"
l3="Is LAN cable connected?\n" l3="Is LAN cable connected?\n"
dialog --backtitle "RaspiBlitz ${codeVersion}" --infobox "$l1$l2$l3" 5 30 dialog --backtitle "RaspiBlitz ${codeVersion}" --infobox "$l1$l2$l3" 5 40
sleep 3 sleep 3
continue continue
fi fi
@ -47,7 +47,7 @@ while :
l1="Waiting for DHCP ...\n" l1="Waiting for DHCP ...\n"
l2="Not able to get local IP.\n" l2="Not able to get local IP.\n"
l3="Will try reboot every 5min.\n" l3="Will try reboot every 5min.\n"
dialog --backtitle "RaspiBlitz ${codeVersion} (${localip})" --infobox "$l1$l2$l3" 5 30 dialog --backtitle "RaspiBlitz ${codeVersion} (${localip})" --infobox "$l1$l2$l3" 5 40
sleep 3 sleep 3
continue continue
fi fi
@ -151,6 +151,17 @@ while :
continue continue
fi fi
# if re-indexing
if [ "${state}" = "reindex" ]; then
l1="REINDEXING BLOCKCHAIN\n"
l2="To monitor & detect finish:\n"
l3="ssh admin@${localip}\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state})" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
# check if bitcoin is ready # check if bitcoin is ready
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
clienterror=`cat error.tmp` clienterror=`cat error.tmp`

31
home.admin/00mainMenu.sh

@ -58,6 +58,13 @@ if [ "${state}" = "recovered" ]; then
exit 1 exit 1
fi fi
# signal that a reindex was triggered
if [ "${state}" = "reindex" ]; then
echo "Re-Index in progress ... start monitoring:"
/home/admin/config.scripts/network.reindex.sh
exit 1
fi
# if pre-sync is running - stop it - before continue # if pre-sync is running - stop it - before continue
if [ "${state}" = "presync" ]; then if [ "${state}" = "presync" ]; then
# stopping the pre-sync # stopping the pre-sync
@ -118,6 +125,17 @@ waitUntilChainNetworkIsReady()
clienterror=`cat error.tmp` clienterror=`cat error.tmp`
rm error.tmp rm error.tmp
if [ ${#clienterror} -gt 0 ]; then if [ ${#clienterror} -gt 0 ]; then
# analyse LOGS for possible reindex
reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
if [ ${reindex} -gt 0 ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair script."
sleep 3
sudo /home/admin/config.scripts/network.reindex.sh
exit
fi
# normal info
boxwidth=40 boxwidth=40
l1="Waiting for ${network}d to get ready.\n" l1="Waiting for ${network}d to get ready.\n"
l2="---> ${clienterror/error*:/}\n" l2="---> ${clienterror/error*:/}\n"
@ -395,14 +413,21 @@ case $CHOICE in
;; ;;
NAME) NAME)
sudo /home/admin/config.scripts/lnd.setname.sh sudo /home/admin/config.scripts/lnd.setname.sh
noreboot=$?
if [ "${noreboot}" = "0" ]; then
sudo -u bitcoin ${network}-cli stop
echo "Press ENTER to Reboot." echo "Press ENTER to Reboot."
read key read key
sudo shutdown -r now sudo shutdown -r now
else
./00mainMenu.sh
fi
;; ;;
PASSWORD) PASSWORD)
sudo /home/admin/config.scripts/blitz.setpassword.sh sudo /home/admin/config.scripts/blitz.setpassword.sh
noreboot=$? noreboot=$?
if [ "${noreboot}" = "0" ]; then if [ "${noreboot}" = "0" ]; then
sudo -u bitcoin ${network}-cli stop
echo "Press ENTER to Reboot .." echo "Press ENTER to Reboot .."
read key read key
sudo shutdown -r now sudo shutdown -r now
@ -419,10 +444,10 @@ case $CHOICE in
echo "-----------------------------------------------" echo "-----------------------------------------------"
echo "stop lnd - please wait .." echo "stop lnd - please wait .."
sudo systemctl stop lnd sudo systemctl stop lnd
echo "stop bitcoind (1) - please wait .." echo "stop ${network}d (1) - please wait .."
sudo -u bitcoin bitcoin-cli stop sudo -u bitcoin ${network}-cli stop
sleep 10 sleep 10
echo "stop bitcoind (2) - please wait .." echo "stop ${network}d (2) - please wait .."
sudo systemctl stop ${network}d sudo systemctl stop ${network}d
echo "starting shutdown" echo "starting shutdown"
sudo shutdown now sudo shutdown now

5
home.admin/00settingsMenuServices.sh

@ -165,6 +165,7 @@ if [ "${rtlWebinterface}" != "${choice}" ]; then
echo "RTL Webinterface Setting changed .." echo "RTL Webinterface Setting changed .."
sudo /home/admin/config.scripts/bonus.rtl.sh ${choice} sudo /home/admin/config.scripts/bonus.rtl.sh ${choice}
if [ "${choice}" = "on" ]; then if [ "${choice}" = "on" ]; then
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
l1="RTL web servcie will be ready AFTER NEXT REBOOT:" l1="RTL web servcie will be ready AFTER NEXT REBOOT:"
l2="Try to open the following URL in your local webrowser" l2="Try to open the following URL in your local webrowser"
l3="and login with your PASSWORD B." l3="and login with your PASSWORD B."
@ -200,6 +201,8 @@ if [ ${needsReboot} -eq 1 ]; then
dialog --pause "OK. System will reboot to activate changes." 8 58 8 dialog --pause "OK. System will reboot to activate changes." 8 58 8
clear clear
echo "rebooting .. (please wait)" echo "rebooting .. (please wait)"
sleep 3 # stop bitcoind
sudo -u bitcoin ${network}-cli stop
sleep 4
sudo shutdown -r now sudo shutdown -r now
fi fi

9
home.admin/10setupBlitz.sh

@ -161,10 +161,10 @@ if [ ${mountOK} -eq 1 ]; then
echo "Bitcoin Options" echo "Bitcoin Options"
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \ menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \
--menu "You need a copy of the Bitcoin Blockchain - you have 3 options:" 13 75 4 \ --menu "You need a copy of the Bitcoin Blockchain - you have 3 options:" 13 75 4 \
T "TORRENT --> TESTNET + MAINNET thru Torrent (DEFAULT)" \ T "TORRENT --> MAINNET + TESTNET thru Torrent (DEFAULT)" \
D "DOWNLOAD --> TESTNET + MAINNET per FTP (FALLBACK)" \ D "DOWNLOAD --> MAINNET + TESTNET per FTP (FALLBACK)" \
C "COPY --> TESTNET + MAINNET from another HDD (TRICKY+FAST)" \ C "COPY --> USE BLOCKCHAINDATA from another computer" \
S "SYNC --> JUST TESTNET thru Bitoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty) S "SYNC --> MAINNET thru Bitoin Network (ULTRA SLOW)" 2>&1 >/dev/tty)
# Litecoin # Litecoin
elif [ ${network} = "litecoin" ]; then elif [ ${network} = "litecoin" ]; then
@ -173,7 +173,6 @@ if [ ${mountOK} -eq 1 ]; then
--menu "You need a copy of the Litecoin Blockchain - you have 3 options:" 13 75 4 \ --menu "You need a copy of the Litecoin Blockchain - you have 3 options:" 13 75 4 \
T "TORRENT --> MAINNET thru Torrent (DEFAULT)" \ T "TORRENT --> MAINNET thru Torrent (DEFAULT)" \
D "DOWNLOAD --> MAINNET per FTP (FALLBACK)" \ D "DOWNLOAD --> MAINNET per FTP (FALLBACK)" \
C "COPY --> MAINNET from another HDD (TRICKY+FAST)" \
S "SYNC --> MAINNET thru Litecoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty) S "SYNC --> MAINNET thru Litecoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty)
# error # error

112
home.admin/50copyHDD.sh

@ -0,0 +1,112 @@
#!/bin/bash
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
# get local ip
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
# create bitcoin base directory and link with bitcoin user
sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null
sudo mkdir /mnt/hdd/bitcoin
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin
clear
echo "************************************************************************************"
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another computer"
echo "************************************************************************************"
echo ""
echo "You can use the blockchain from another bitcoin-core client with version greater or equal"
echo "to 0.17.1 with transaction index switched on (txindex=1 in the bitcoin.conf)."
echo ""
echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need"
echo "to be connected to the same local network."
echo ""
echo "Open a terminal on the source computer and change into the directory that constains the"
echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'indexes'".
echo "Make sure the bitcoin client on that computer is stopped."
echo ""
echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:"
echo "sudo scp -r ./chainstate ./indexes ./testnet3 ./blocks bitcoin@${localip}:/home/bitcoin/.bitcoin"
echo ""
echo "This command will ask for your SSH PASSWORD A from this RaspiBlitz."
echo "It can take multiple hours until transfer is complete - be patient."
echo "************************************************************************************"
echo "PRESS ENTER if transfers is done OR if you want to choose another another option."
#echo "Copy, Paste and Execute the following commands - line by line:"
#echo "sudo scp -r ./chainstate bitcoin@${localip}:/home/bitcoin/.bitcoin/chainstate"
#echo "sudo scp -r ./indexes bitcoin@${localip}:/home/bitcoin/.bitcoin/indexes"
#echo "sudo scp -r ./blocks bitcoin@${localip}:/home/bitcoin/.bitcoin/blocks"
#echo ""
#echo "Every command above needs your SSH PASSWORD A to work and will take some time to transfer."
#echo "PRESS ENTER if all 3 transfers are done or if you dont care and you want to return to menu."
read key
# unlink bitcoin user (will created later in setup again)
sudo unlink /home/bitcoin/.bitcoin
# make quick check if data is there
anyDataAtAll=0
quickCheckOK=1
count=$(sudo ls /mnt/hdd/bitcoin/blocks 2>/dev/null | grep -c '.dat')
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/blocks"
anyDataAtAll=1
fi
if [ ${count} -lt 3000 ]; then
echo "FAIL: transfere seems invalid - less then 3000 .dat files (${count})"
quickCheckOK=0
fi
count=$(sudo ls /mnt/hdd/bitcoin/chainstate 2>/dev/null | grep -c '.ldb')
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/chainstate"
anyDataAtAll=1
fi
if [ ${count} -lt 1400 ]; then
echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})"
quickCheckOK=0
fi
count=$(sudo ls /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | grep -c '.ldb')
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/indexes/txindex"
anyDataAtAll=1
fi
if [ ${count} -lt 5200 ]; then
echo "FAIL: less then 5200 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)"
quickCheckOK=0
fi
# just if any data transferred ..
if [ ${anyDataAtAll} -eq 1 ]; then
# data was invalkid - ask user to keep?
if [ ${quickCheckOK} -eq 0 ]; then
echo "*********************************************"
echo "There seems to be a invalid transfere."
echo "Wait 5 secs ..."
sleep 5
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60
response=$?
echo "response(${response})"
case $response in
1) quickCheckOK=1 ;;
esac
fi
if [ ${quickCheckOK} -eq 0 ]; then
echo "Deleting invalid Data ..."
sudo rm -rf /mnt/hdd/bitcoin
sudo rm -rf /home/bitcoin/.bitcoin
sleep 2
fi
else
# when no data transferred - just delete bitcoin base dir again
sudo rm -rf /mnt/hdd/bitcoin
fi
# setup script will decide the next logical step
./10setupBlitz.sh

23
home.admin/50syncHDD.sh

@ -5,23 +5,28 @@ source /home/admin/raspiblitz.info 2>/dev/null
# only show warning when bitcoin # only show warning when bitcoin
if [ "$network" = "bitcoin" ]; then if [ "$network" = "bitcoin" ]; then
msg="" msg=" The RaspberryPi has very limited CPU power.\n"
msg="$msg Syncing is just practical for Bitcoin TESTNET!\n" msg="$msg To sync & validate the complete blockchain\n"
msg="$msg TESTNET is OK for learning, testing and development.\n" msg="$msg can take multiple days - even weeks!\n"
msg="$msg MAINNET is where things get real and fun.\n" msg="$msg Its recommended to use another option.\n"
msg="$msg \n" msg="$msg \n"
msg="$msg Syncing MAINNET on a raspberry is NOT practical.\n" msg="$msg So do you really want start syncing now?"
msg="$msg If you want MAINET, go back & try DOWNLOAD.\n"
msg="$msg \n"
msg="$msg Do you really want to work with ONLY TESTNET?"
dialog --title " WARNING " --yesno "${msg}" 12 57 dialog --title " WARNING " --yesno "${msg}" 11 57
response=$? response=$?
case $response in case $response in
0) echo "--> OK";; 0) echo "--> OK";;
1) ./10setupBlitz.sh; exit 1;; 1) ./10setupBlitz.sh; exit 1;;
255) ./10setupBlitz.sh; exit 1;; 255) ./10setupBlitz.sh; exit 1;;
esac esac
clear
echo "********************************"
echo "This is madness. This is Sparta!"
echo "********************************"
echo ""
sleep 3
fi fi
echo "*** Activating Blockain Sync ***" echo "*** Activating Blockain Sync ***"

1
home.admin/95finalSetup.sh

@ -44,6 +44,7 @@ sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
clear clear
echo "Setup done. Rebooting now." echo "Setup done. Rebooting now."
sudo -u bitcoin ${network}-cli stop
sleep 3 sleep 3
sudo shutdown -r now sudo shutdown -r now

1
home.admin/AAunlockLND.sh

@ -3,6 +3,7 @@
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait" echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')

1
home.admin/BBcashoutWallet.sh

@ -7,6 +7,7 @@ echo "please wait ..."
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain') chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
fi fi

1
home.admin/BBcloseAllChannels.sh

@ -3,6 +3,7 @@
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
fi fi

1
home.admin/BBconnectPeer.sh

@ -5,6 +5,7 @@ _error="./.error.out"
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait" echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')

1
home.admin/BBcreateInvoice.sh

@ -6,6 +6,7 @@ sudo chmod 7777 ${_error}
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait" echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')

1
home.admin/BBfundWallet.sh

@ -3,6 +3,7 @@
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait" echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')

1
home.admin/BBopenChannel.sh

@ -5,6 +5,7 @@ _error="./.error.out"
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait" echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')

1
home.admin/BBpayInvoice.sh

@ -5,6 +5,7 @@ _error="./.error.out"
# load raspiblitz config data (with backup from old config) # load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait" echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain') chain=$(${network}-cli getblockchaininfo | jq -r '.chain')

100
home.admin/XXcleanHDD.sh

@ -1,30 +1,74 @@
#!/bin/bash
echo "" echo ""
echo "!!!! This will DELETE your data & POSSIBLE FUNDS from the HDD !!!!" extraParameter="$1"
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)" if [ "${extraParameter}" = "-all" ]; then
read key
sudo dphys-swapfile swapoff echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
sudo systemctl stop bitcoind.service 2>/dev/null echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
sudo systemctl stop litecoind.service 2>/dev/null read key
sudo systemctl stop lnd.service 2>/dev/null
sudo rm -f -r /mnt/hdd/lnd echo "stopping services ... (please wait)"
sudo rm -f -r /mnt/hdd/ssh echo "- swap"
sudo rm -f /mnt/hdd/swapfile sudo dphys-swapfile swapoff
sudo rm -f /mnt/hdd/bitcoin/bitcoin.conf echo "- background"
sudo rm -f /mnt/hdd/bitcoin/bitcoin.pid sudo systemctl stop background 2>/dev/null
sudo rm -f /mnt/hdd/bitcoin/*.dat echo "- lnd"
sudo rm -f /mnt/hdd/bitcoin/*.log sudo systemctl stop lnd.service 2>/dev/null
sudo rm -f /mnt/hdd/bitcoin/*.pid echo "- blockchain"
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.dat sudo systemctl stop bitcoind.service 2>/dev/null
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.log sudo systemctl stop litecoind.service 2>/dev/null
sudo rm -f /mnt/hdd/bitcoin/testnet3/.lock
sudo rm -f /mnt/hdd/litecoin/litecoin.conf # delete plain all on HDD
sudo rm -f /mnt/hdd/litecoin/litecoin.pid echo "cleaning HDD ... (please wait)"
sudo rm -f /mnt/hdd/litecoin/*.dat sudo rm -rfv /mnt/hdd/*
sudo rm -f /mnt/hdd/litecoin/*.log
sudo rm -f /mnt/hdd/litecoin/*.pid else
sudo rm -f -r /mnt/hdd/lost+found
sudo rm -f -r /mnt/hdd/download echo "!!!! This will DELETE your personal data & POSSIBLE FUNDS from the HDD !!!!"
sudo rm -f -r /mnt/hdd/tor echo "--> It will keep Blockchain data - so you dont have to download/copy again."
sudo rm -f /mnt/hdd/raspiblitz.conf echo "--> If you want to delete also blockchain data, please run with '-all' parameter."
sudo rm -f /home/admin/raspiblitz.info echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
read key
echo "stopping services ... (please wait)"
echo "- swap"
sudo dphys-swapfile swapoff
echo "- background"
sudo systemctl stop background 2>/dev/null
echo "- lnd"
sudo systemctl stop lnd.service 2>/dev/null
echo "- blockchain"
sudo systemctl stop bitcoind.service 2>/dev/null
sudo systemctl stop litecoind.service 2>/dev/null
# just delete selective
echo "selective delete ... (please wait)"
sudo rm -f -r /mnt/hdd/lnd
sudo rm -f -r /mnt/hdd/ssh
sudo rm -f /mnt/hdd/swapfile
sudo rm -f /mnt/hdd/bitcoin/bitcoin.conf
sudo rm -f /mnt/hdd/bitcoin/bitcoin.pid
sudo rm -f /mnt/hdd/bitcoin/*.dat
sudo rm -f /mnt/hdd/bitcoin/*.log
sudo rm -f /mnt/hdd/bitcoin/*.pid
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.dat
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.log
sudo rm -f /mnt/hdd/bitcoin/testnet3/.lock
sudo rm -f /mnt/hdd/litecoin/litecoin.conf
sudo rm -f /mnt/hdd/litecoin/litecoin.pid
sudo rm -f /mnt/hdd/litecoin/*.dat
sudo rm -f /mnt/hdd/litecoin/*.log
sudo rm -f /mnt/hdd/litecoin/*.pid
sudo rm -f -r /mnt/hdd/lost+found
sudo rm -f -r /mnt/hdd/download
sudo rm -f -r /mnt/hdd/tor
sudo rm -f /mnt/hdd/raspiblitz.conf
sudo rm -f /home/admin/raspiblitz.info
fi
echo "*************************"
echo "OK - the HDD is now clean" echo "OK - the HDD is now clean"
echo "*************************"
echo "reboot -> sudo shutdown -r now"
echo "power off -> sudo shutdown now"

52
home.admin/assets/raspiblitz-torrents-rss.xml

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>RaspiBlitz TorrentSeeds RSS</title>
<description>Help on seeding the lastest RaspiBlitz Torrent Seeds</description>
<language>en-en</language>
<!-- Upload new versions to wiki.fulmo.org -->
<link>http://wiki.fulmo.org/downloads/raspiblitz-torrents-rss.xml</link>
<item>
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2018-10-13-base.torrent</guid>
<title>raspiblitz-bitcoin1-2018-10-13-base.torrent</title>
<enclosure
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2018-10-13-base.torrent"
type="application/x-bittorrent"
/>
</item>
<item>
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2019-01-16-update.torrent</guid>
<title>raspiblitz-bitcoin1-2019-01-16-update.torrent</title>
<enclosure
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-bitcoin1-2019-01-16-update.torrent"
type="application/x-bittorrent"
/>
</item>
<item>
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-base.torrent</guid>
<title>raspiblitz-litecoin1-2018-11-18-base.torrent</title>
<enclosure
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-base.torrent"
type="application/x-bittorrent"
/>
</item>
<item>
<guid>http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-update.torrent</guid>
<title>raspiblitz-litecoin1-2018-11-18-update.torrent</title>
<enclosure
url="http://github.com/rootzoll/raspiblitz/raw/master/home.admin/assets/raspiblitz-litecoin1-2018-11-18-update.torrent"
type="application/x-bittorrent"
/>
</item>
</channel>
</rss>

1
home.admin/config.scripts/lnd.setname.sh

@ -13,6 +13,7 @@ newName=$1
# run interactive if 'turn on' && no further parameters # run interactive if 'turn on' && no further parameters
if [ ${#newName} -eq 0 ]; then if [ ${#newName} -eq 0 ]; then
sudo rm ./.tmp
dialog --backtitle "Set LND Name/Alias" --inputbox "ENTER the new Name/Alias for LND node: dialog --backtitle "Set LND Name/Alias" --inputbox "ENTER the new Name/Alias for LND node:
(free to choose, one word, use basic characters) (free to choose, one word, use basic characters)
" 8 52 2>./.tmp " 8 52 2>./.tmp

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

@ -0,0 +1,87 @@
#!/bin/bash
# command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "script to run re-index if the blockchain (in case of repair)"
echo "run to start or monitor re-index progress"
exit 1
fi
# check and load raspiblitz config
# to know which network is running
source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
exit 1
fi
# load raspiblitz.info to know if reindex is already running
source /home/admin/raspiblitz.info 2>/dev/null
if [ ${#state} -eq 0 ]; then
echo "FAIL - missing /home/admin/raspiblitz.info"
exit 1
fi
# if re-index is not running, start ...
if [ "${state}" != "reindex" ]; then
# stop services
echo "making sure services are not running .."
sudo systemctl stop lnd 2>/dev/null
sudo systemctl stop ${network}d 2>/dev/null
# starting reindex
echo "starting re-index ..."
sudo -u bitcoin /usr/local/bin/${network}d -daemon -reindex -conf=/home/bitcoin/.${network}/${network}.conf -datadir=/home/bitcoin/.${network}
# set reindex flag in raspiblitz.info (gets deleted after (final) reboot)
sudo sed -i "s/^state=.*/state=reindex/g" /home/admin/raspiblitz.info
fi
# while loop to wait to finish
finished=0
while [ ${finished} -eq 0 ]
do
clear
echo "*************************"
echo "REINDEXING BLOCKCHAIN"
echo "*************************"
date
echo "THIS CAN TAKE SOME LONG TIME"
echo "If you dont see any progress after 24h keep X pressed to stop."
progress=0
echo ""
echo "PROGRESS: ${progress}%"
echo ""
#TODO: detect and display progress
#TODO: determine when finished and then finished=1
echo "You can close terminal while reindex is running.."
echo "But you have to login again to check if ready."
# wait 2 seconds for key input
read -n 1 -t 2 keyPressed
# check if user wants to abort monitor
if [ "${keyPressed}" = "x" ]; then
echo "stopped by user ..."
break
fi
done
# trigger reboot when finished
echo "*************************"
echo "Re-Index finished"
echo "Starting reboot ..."
echo "*************************"
# stop bitcoind
sudo -u bitcoin ${network}-cli stop
sleep 4
# clean logs (to prevent a false reindex detection)
sudo rm /mnt/hdd/${network}/debug.log
# reboot
sudo shutdown -r now
Loading…
Cancel
Save