Skip to content

Commit

Permalink
Merge pull request raspiblitz#20 from rootzoll/master
Browse files Browse the repository at this point in the history
  • Loading branch information
openoms authored Feb 20, 2019
2 parents bcd865a + c18394d commit 04e301e
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 66 deletions.
14 changes: 11 additions & 3 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,16 @@ When the HDD is clean, then flash a new RaspiBlitz sd card and your setup should

## My blockchain data is corrupted - what can I do?

You could try to re-index, but that can take some very long time - multiple days or even weeks.
You could try to re-index, but that can take some very long time - multiple days or even weeks. But there are other options:

Another option would be to delete the old blockchain and get a new one. See for details the FAQ question: [I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?](FAQ.md#i-have-the-full-blockchain-on-another-computer-how-do-i-copy-it-to-the-raspiblitz). And even if you are not able to delete the data, first rename the undeletable folders and then follow the instructions.
1. Copy Blockchain from another Computer

Also make sure to check again on your power supply - it needs to deliver equal or more then 3A and should deliver a stable current. If you think your HDD is degrading - maybe this is a good time to replace it. See for details the FAQ question: [How can I recover my coins from a failing RaspiBlitz?](FAQ.md#how-can-i-recover-my-coins-from-a-failing-raspiblitz)
You can delete the old blockchain and get a new one. See for details the FAQ question: [I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?](FAQ.md#i-have-the-full-blockchain-on-another-computer-how-do-i-copy-it-to-the-raspiblitz). And even if you are not able to delete the data, first rename the undeletable folders and then follow the instructions.

2. Re-Torrent download prepared Blockchain

You can also start a new Torrent-Download and replace the old blockchain with a new download once its finished. Go to terminal and run script `/mnt/hdd/50torrentHDD.sh`

3. Backup LND Data, make fresh Blitz, Replay LND Data

You can backup your channel and wallet data, make a complete fresh RaspiBlitz and after that one is setup you replace the LND data with your old one. Also make sure to check again on your power supply - it needs to deliver equal or more then 3A and should deliver a stable current. If you think your HDD or SD card is degrading - maybe this is a good time to replace. See for details the FAQ question: [How can I recover my coins from a failing RaspiBlitz?](FAQ.md#how-can-i-recover-my-coins-from-a-failing-raspiblitz)*
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ Connect the HDD to one of the USB ports. In the end your RaspiBlitz should look
Your SD-card needs to contain the RaspiBlitz software. You can take the long road by [building the SD-card image yourself](#build-the-sd-card-image) or use the already prepared SD-Card image:

1. Download SD-Card image - **Version 1.0**:
(PLEASE BE PATIENT - IMAGE v1.0 IS COMING SOON)

HTTP: http://wiki.fulmo.org/downloads/raspiblitz-v1.0-2019-02-18.img.gz

Torrent: https://github.com/rootzoll/raspiblitz/raw/master/raspiblitz-v1.0-2019-02-18.torrent

SHA-256: 99ca96d214657388305ca117e2343ead45f9d907f185bef36c712a9a3e75568f

2. Write the SD-Card image to your SD Card - if you need details, see here:
https://www.raspberrypi.org/documentation/installation/installing-images/README.md
Expand All @@ -103,7 +108,7 @@ When everything boots up correctly, you should see the local IP address of your

![LCD0](pictures/lcd0-welcome.png)

Now open up a [terminal](https://www.youtube.com/watch?v=5XgBd6rjuDQ) and connect thru SSH with the command displayed by the RaspiBlitz:
Now open up a terminal ([OSX](https://www.youtube.com/watch?v=5XgBd6rjuDQ)/[Win10](https://www.youtube.com/watch?v=xIfzZXHaCzQ)) and connect thru SSH with the command displayed by the RaspiBlitz:

`ssh admin@[YOURIP]` → use password: `raspiblitz`

Expand Down Expand Up @@ -574,6 +579,8 @@ You have still more questions? Check the [RaspiBlitz-FAQ-Archive](FAQ.md).

Everybody is welcome to join, improve and extend the RaspiBlitz - its a work in progress. [Check the issues](https://github.com/rootzoll/raspiblitz/issues) if you wanna help out or add new ideas. You find the scripts used for RaspiBlitz interactions on the device at `/home/admin` or in this git repo in the subfolder `home.admin`.

Also get inspired for a deep-dive with the original "[RaspiBolt](https://github.com/Stadicus/guides/tree/master/raspibolt)" tutorial on how to build a lightning node on the RaspberryPi which was the base work the RaspiBlitz was developed on - so much thx to Stadicus :)

Join me on twitter [@rootzoll](https://twitter.com/rootzoll), visit us at a upcomming [#lightninghackday](https://twitter.com/hashtag/LightningHackday?src=hash) or check by on of our bitcoin meetups in Berlin ... every 1st Thursday evening a month at the room77 bar - feel free to buy me a beer with lightning there :)

* [How can I get further help/support?](#support)
Expand Down
2 changes: 1 addition & 1 deletion home.admin/00infoLCD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ while :
l2="ssh admin@${localip}\n"
l3="Waiting for AUTO-UNLOCK"
fi
boxwidth=$((${#localip} + 24))
boxwidth=$((${#localip} + 26))
dialog --backtitle "RaspiBlitz ${codeVersion} (${localip}) - ${hostname}" --infobox "$l1$l2$l3$l4" ${h} ${boxwidth}
sleep 5
continue
Expand Down
1 change: 1 addition & 0 deletions home.admin/00settingsMenuServices.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ choice="off"; check=$(echo "${CHOICES}" | grep -c "5")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${rtlWebinterface}" != "${choice}" ]; then
echo "RTL Webinterface Setting changed .."
anychange=1
sudo /home/admin/config.scripts/bonus.rtl.sh ${choice}
if [ "${choice}" = "on" ]; then
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
Expand Down
111 changes: 60 additions & 51 deletions home.admin/50copyHDD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,20 @@ if [ "${setupStep}" = "100" ]; then
# make sure services are not running
echo "stopping servcies ..."
sudo systemctl stop lnd
sudo systemctl stop bitcoind
sudo systemctl stop bitcoind
sudo systemctl disable bitcoind
sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf
fi

# delete all IN bitcoin directory but not itself if it exists
# so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird
sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null

# create bitcoin base directory and link with bitcoin user
echo "delete and create new blockchain directory ..."
sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null
sudo rm -rf /home/bitcoin/.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

# check setup
echo "checking setup ..."
sudo touch /home/bitcoin/.bitcoin/test.txt
createdCorerct=$(sudo ls /mnt/hdd/bitcoin/test.txt | grep -c 'test.txt')
sudo rm /home/bitcoin/.bitcoin/test.txt
if [ ${createdCorerct} -eq 0 ]; then
sudo rm -rf /mnt/hdd/bitcoin
sudo rm -rf /home/bitcoin/.bitcoin
echo "FAILED: sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin"
echo "Press ENTER to get back to menu ..."
read key
exit 1
fi
# make sure /mnt/hdd/bitcoin exists
sudo mkdir /mnt/hdd/bitcoin 2>/dev/null

# allow all users write to it ()
sudo chmod 777 /mnt/hdd/bitcoin

clear
echo "************************************************************************************"
Expand All @@ -56,7 +45,7 @@ echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'inde
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 "sudo scp -r ./chainstate ./indexes ./testnet3 ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
echo ""
echo "This command may ask you first about the admin password of the other computer (because sudo)."
echo "Then it will ask for your SSH PASSWORD A from this RaspiBlitz."
Expand All @@ -66,9 +55,6 @@ echo "PRESS ENTER if transfers is done OR if you want to choose another another
sleep 2
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
Expand Down Expand Up @@ -100,42 +86,65 @@ if [ ${count} -lt 1500 ]; then
quickCheckOK=0
fi

echo "*********************************************"
echo "QUICK CHECK RESULT"
echo "*********************************************"

# just if any data transferred ..
if [ ${anyDataAtAll} -eq 1 ]; then

# data was invalid - ask user to keep?
if [ ${quickCheckOK} -eq 0 ]; then
echo "*********************************************"
echo "There seems to be an invalid transfer."
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
echo "FAIL -> DATA seems incomplete."

else

echo "OK -> DATA LOOKS GOOD :D"

fi

else

echo "CANCEL -> NO DATA was copied."
quickCheckOK=0

fi
echo "*********************************************"

# if started after intial setup - quit here
if [ "${setupStep}" = "100" ]; then
sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin/bitcoin.conf
sudo systemctl enable bitcoind
echo "DONE - reboot is needed: sudo shutdown -r now"
exit 0
fi

# REACT ON QUICK CHECK DURING INITAL SETUP


if [ ${quickCheckOK} -eq 0 ]; then

echo "*********************************************"
echo "There seems to be an invalid transfer."

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

echo "back to menu ..."
# when no data transferred - just delete bitcoin base dir again
fi

if [ ${quickCheckOK} -eq 0 ]; then
echo "Deleting invalid Data ... "
sudo rm -rf /mnt/hdd/bitcoin
sleep 2

fi

if [ ${setupStep} -lt 100 ]; then
# setup script will decide the next logical step
/home/admin/10setupBlitz.sh
else
"DONE - reboot is needed: sudo shutdown -r now"
fi
# setup script will decide the next logical step
/home/admin/10setupBlitz.sh
20 changes: 17 additions & 3 deletions home.admin/50torrentHDD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,34 @@ if [ ${torrentError} -gt 0 ]; then

fi

# if setup was done - remove old data
if [ "${setupStep}" = "100" ]; then
echo "stopping servcies ..."
sudo systemctl stop lnd
sudo systemctl stop ${network}d
sudo systemctl disable ${network}d
sudo cp -f /mnt/hdd/${network}/${network}.conf /home/admin/assets/${network}.conf
sudo rm -rfv /mnt/hdd/${network}/* 2>/dev/null
fi

# Download worked / just move, copy on USB2 >4h
echo ""
echo "*** Moving Files ***"
date +%s
echo "can take some minutes... please wait"

echo "can take 10-60 minutes... please wait"
sudo mkdir /mnt/hdd/${network} 2>/dev/null
sudo mv ${targetPath1}/* /mnt/hdd/${network}/
sudo cp -r ${targetPath2}/* /mnt/hdd/${network}/
sudo rm -r ${targetDir}
echo "OK"
date +%s

if [ ${setupStep} -lt 100 ]; then
if [ "${setupStep}" = "100" ]; then
sudo cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf
sudo chown -R bitcoin:bitcoin /mnt/hdd/${network}/
sudo systemctl enable ${network}d
echo "DONE - reboot needed: sudo shutdown -r now"
else
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# continue setup
Expand Down
4 changes: 4 additions & 0 deletions home.admin/_bootstrap.provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,8 @@ else
fi

sudo sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile}

echo "DONE - Give raspi some cool off time after hard building .... 20 secs sleep" >> ${logFile}
sleep 20

echo "END Provisioning" >> ${logFile}
4 changes: 2 additions & 2 deletions home.admin/config.scripts/bonus.rtl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** Get the RTL Source Code ***"
git clone https://github.com/ShahanaFarooqui/RTL.git
cd RTL
#git reset --hard v0.1.13-alpha
git reset --hard v0.1.14-alpha
git reset --hard v0.2.1
#git reset --hard v0.1.14-alpha


# install
Expand Down
24 changes: 21 additions & 3 deletions home.admin/config.scripts/internet.dyndomain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,25 @@ fi
turn="off"
if [ "$1" = "1" ] || [ "$1" = "on" ]; then turn="on"; fi

echo "number of args($#)"

# 2. parameter [?domainName]
dynDomain=$2
if [ $# > 1 ]; then
dynDomain=$2
fi

# 3. parameter [?domainName]
updateDynDomain=$3
if [ $# > 2 ]; then
dynUpdateUrl=$3
fi

# run interactive if 'turn on' && no further parameters
if [ "${turn}" = "on" ] && [ ${#dynDomain} -eq 0 ]; then

# make sure dialog file is writeable
sudp touch ./.tmp
sudo chmod 777 ./.tmp

dialog --backtitle "DynamicDNS" --inputbox "ENTER the Dynamic Domain Name:
For more details see chapter in GitHub README
Expand Down Expand Up @@ -81,7 +91,15 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then

# setting value in raspi blitz config
sudo sed -i "s/^dynDomain=.*/dynDomain='${dynDomain}'/g" /mnt/hdd/raspiblitz.conf
sudo sed -i "s/^dynUpdateUrl=.*/dynUpdateUrl='${dynUpdateUrl}'/g" /mnt/hdd/raspiblitz.conf

# setting dynUpdateUrl is a bit cpmplicated because value can contain chars that break sed replacement
# so first remove dynUpdateUrl from config and then add fresh as new line at the end
grep -v "dynUpdateUrl" /mnt/hdd/raspiblitz.conf > ./raspiblitz.conf.new
echo "dynUpdateUrl='${dynUpdateUrl}'" >> ./raspiblitz.conf.new
sudo rm /mnt/hdd/raspiblitz.conf
sudo mv ./raspiblitz.conf.new /mnt/hdd/raspiblitz.conf
sudo chmod 777 /mnt/hdd/raspiblitz.conf
#sudo sed -i "s/^dynUpdateUrl=.*/dynUpdateUrl='${dynUpdateUrl}'/g" /mnt/hdd/raspiblitz.conf

echo "changing lnd.conf"

Expand Down
4 changes: 3 additions & 1 deletion home.admin/config.scripts/network.reindex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ while [ ${finished} -eq 0 ]
echo "REINDEXING BLOCKCHAIN"
echo "*************************"
date
echo "THIS CAN TAKE SOME LONG TIME"
echo "THIS CAN TAKE SOME VERY LONG TIME"
echo "See Raspiblitz FAQ: https://github.com/rootzoll/raspiblitz"
echo "On question: My blockchain data is corrupted - what can I do?"
echo "If you dont see any progress after 24h keep X pressed to stop."

# get blockchain sync progress
Expand Down
Binary file added raspiblitz-v1.0-2019-02-18.torrent
Binary file not shown.

0 comments on commit 04e301e

Please sign in to comment.