Browse Source

Merge pull request #4 from rootzoll/master

Sync with rootzoll
master
geco91 6 years ago
committed by GitHub
parent
commit
663a13bdcd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 626
      FAQ.md
  2. 594
      README.md
  3. 187
      WORKSHOP.md
  4. 153
      background_downloadBlockchain.md
  5. 43
      background_raspiblitzSettings.md
  6. 240
      build_sdcard.sh
  7. BIN
      case.3dprint/standard/RaspiBlitz_Standard_Bottom.stl
  8. BIN
      case.3dprint/standard/RaspiBlitz_Standard_Top.stl
  9. 126
      dietpi/Odroid_HC1_HC2.md
  10. 126
      dietpi/README.md
  11. 262
      dietpi/RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.torrent
  12. 1
      dietpi/boot/Automation_Custom_Script.sh
  13. 264
      dietpi/boot/dietpi.txt
  14. 256
      dietpi/boot/dietpi.txt.sample
  15. 43
      dietpi/hw_comparison.md
  16. BIN
      dietpi/pictures/DroidBlitz.jpg
  17. BIN
      dietpi/pictures/HDD_copy_example.jpg
  18. BIN
      dietpi/pictures/adapterHDD_HC1.jpg
  19. BIN
      dietpi/pictures/bash_prompt.png
  20. BIN
      dietpi/pictures/dietpi-software_exit.png
  21. BIN
      dietpi/pictures/dietpi_1st_reboot.png
  22. 52
      home.admin/00infoBlitz.sh
  23. 108
      home.admin/00infoLCD.sh
  24. 194
      home.admin/00mainMenu.sh
  25. 92
      home.admin/00settingsMenuServices.sh
  26. 75
      home.admin/10setupBlitz.sh
  27. 75
      home.admin/20recoverDialog.sh
  28. 83
      home.admin/20setupDialog.sh
  29. 37
      home.admin/30initHDD.sh
  30. 60
      home.admin/40addHDD.sh
  31. 210
      home.admin/50cloneHDD.sh
  32. 249
      home.admin/50copyHDD.sh
  33. 14
      home.admin/50downloadHDD.sh
  34. 25
      home.admin/50syncHDD.sh
  35. 174
      home.admin/50torrentHDD.old.sh
  36. 48
      home.admin/50torrentHDD.sh
  37. 2
      home.admin/60finishHDD.sh
  38. 52
      home.admin/70initLND.sh
  39. 3
      home.admin/80scanLND.sh
  40. 13
      home.admin/90finishSetup.sh
  41. 23
      home.admin/95finalSetup.sh
  42. 1
      home.admin/97addMobileWallet.sh
  43. 6
      home.admin/97addMobileWalletShango.sh
  44. 69
      home.admin/97addMobileWalletZap.sh
  45. 4
      home.admin/AAunlockLND.sh
  46. 6
      home.admin/BBcashoutWallet.sh
  47. 4
      home.admin/BBcloseAllChannels.sh
  48. 4
      home.admin/BBconnectPeer.sh
  49. 4
      home.admin/BBcreateInvoice.sh
  50. 4
      home.admin/BBfundWallet.sh
  51. 4
      home.admin/BBopenChannel.sh
  52. 17
      home.admin/BBpayInvoice.sh
  53. 100
      home.admin/XXcleanHDD.sh
  54. 15
      home.admin/XXdebugLogs.sh
  55. 16
      home.admin/XXprepareRelease.sh
  56. 72
      home.admin/XXsyncScripts.sh
  57. 43
      home.admin/XXupdateScripts.sh
  58. 57
      home.admin/_background.sh
  59. 30
      home.admin/_bootstrap.migration.sh
  60. 29
      home.admin/_bootstrap.provision.sh
  61. 125
      home.admin/_bootstrap.sh
  62. 3
      home.admin/_commands.sh
  63. 2
      home.admin/_version.info
  64. 2
      home.admin/assets/RTL.service
  65. 3
      home.admin/assets/bitcoin.conf
  66. 2
      home.admin/assets/bitcoind.service
  67. 1
      home.admin/assets/bootstrap.service
  68. 2
      home.admin/assets/lnd.bitcoin.conf
  69. 2
      home.admin/assets/lnd.litecoin.conf
  70. 4
      home.admin/assets/lnd.service
  71. 1617
      home.admin/assets/raspiblitz-bitcoin1-2019-01-16-update.torrent
  72. 52
      home.admin/assets/raspiblitz-torrents-rss.xml
  73. 255
      home.admin/config.scripts/blitz.setpassword.sh
  74. 56
      home.admin/config.scripts/bonus.rtl.sh
  75. 24
      home.admin/config.scripts/internet.dyndomain.sh
  76. 119
      home.admin/config.scripts/internet.tor.sh
  77. 1
      home.admin/config.scripts/lnd.autonat.sh
  78. 1
      home.admin/config.scripts/lnd.autopilot.sh
  79. 8
      home.admin/config.scripts/lnd.autounlock.sh
  80. 165
      home.admin/config.scripts/lnd.export.sh
  81. 7
      home.admin/config.scripts/lnd.newtlscert.sh
  82. 151
      home.admin/config.scripts/lnd.rescue.sh
  83. 73
      home.admin/config.scripts/lnd.setname.sh
  84. 77
      home.admin/config.scripts/lnd.setport.sh
  85. 11
      home.admin/config.scripts/network.chain.sh
  86. 102
      home.admin/config.scripts/network.reindex.sh
  87. BIN
      pictures/RTL-dashboard.png
  88. BIN
      pictures/befestigung.jpg
  89. BIN
      pictures/download-ftp.png
  90. BIN
      pictures/download-torrent.png
  91. BIN
      pictures/export.png
  92. BIN
      pictures/hardwaresetup.jpg
  93. BIN
      pictures/lcdassm.png
  94. BIN
      pictures/logoraspiblitz.png
  95. BIN
      pictures/mainmenu-services.png
  96. BIN
      pictures/mainmenu.png
  97. BIN
      pictures/mainmenu1.png
  98. BIN
      pictures/mainmenu2.png
  99. BIN
      pictures/mainmenu3.png
  100. BIN
      pictures/mobile.png

626
FAQ.md

@ -0,0 +1,626 @@
# FAQ - Frequently Asked Questions
## Whats new in Version 1.1 of RaspiBlitz?
Version 1.1 packs some first fixes and enhancements to make the RaspiBlitz more stable, protect HDD data better and support you better in case of data corruption of the blockchain data.
- Update: RTL (Ride the Lightning) Web UI version 0.2.15-beta
- Fix: Preventing logs from filling up the sd card
- Fix: Pairing for latest Zap iOS Mobile Wallet
- Fix: Pairing for latest Shango Mobile Wallet
- Fix: Open LND port check when custom port
- New: Undervoltage Reports on LCD
- New: fsk (file system consistency check) of HDD on every boot
- New: Repair Help Menu in case if blockchain data corruption
- New: /config.scripts/lnd.setport.sh (set custom LND port)
- New: /config.scripts/lnd.rescue.sh (backup/replay LND data)
- New: Bootscreen with logo
- Removed: FTP download option for blockchain
For full details see issue list of [Release 1.1 Milestone](https://github.com/rootzoll/raspiblitz/milestone/3?closed=1).
Instructions on how to update see FAQ info below.
## How to update my RaspiBlitz (AFTER version 0.98)?
For update you dont need to close any channels, remove funding or download the blockchain again.
Simply [Ddwnload the new RaspiBlitz SD card image](https://github.com/rootzoll/raspiblitz#installing-the-software) to your laptop and have an sd card writer ready. Then login into your RaspiBlitz with SSH and:
- main menu > OFF
- remove power
- remove SD card
Write the new image it to your SD card .. yes you simply overwrite the old one, it's OK, all your personal data is on the HDD. If you want to be extra safe you can make a image backup of your old sd card first - but that is optional. If you made manual changes to your RaspiBlitz with scripts on the sd card you might wanna check on this FAQ question first: [Why do I need to re-burn my SD card for an update?](FAQ.md#why-do-i-need-to-re-burn-my-sd-card-for-an-update).
- insert new sd card image
- power on the RaspiBlitz again
You should see that it switched into recover/backup mode. Its now provisioning the fresh OS on the sd card your old settings and data. This process can take some while especially if you had RTL Web UI activated. Follow the instructions on the display ... if it takes longer then an hour .. [get support](https://github.com/rootzoll/raspiblitz#support).
When update/recover process is ready you will see a `FINAL RECOVER LOGIN NEEDED` message on the display. Login per SSH by using the password `raspiblitz` and set your Password A again. It can be the same as the old one, but maybe use the occasion to make password change for security reasons. If you had auto-unlock activated you might also be asked to enter your old Password C again. Then it wil make a final reboot.
After your RaspiBlitz is done with catching up the latest blockchain data you should see your status screen displaying your funds and channels. Your backup is complete.
## Can I downgrade from v1.1 to v1.0?
Yes - it was tested one time and worked. Just follow the normal update mechanism - just use the old v1.0 image or your own backup image of the old sd card.
## Can I still get version 1.0 of RaspiBlitz?
Yes here are the links:
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
Code: https://github.com/rootzoll/raspiblitz/tree/v1.0
## How to update a old RaspiBlitz (BEFORE version 0.98)?
If your old RaspiBlitz if version 0.98 or higher, just follow the update instructions in the README.
If you run a version earlier then 0.98 you basically need to setup a new RaspiBlitz to update - but you can keep the blockchain data on the HDD, so you dont need have that long waiting time again:
1. Close all open lightning channels you have (`lncli closeallchannels --force`) or use the menu option 'CLOSE ALL' if available. Wait until all closing transactions are done.
2. Move all on-chain funds to a wallet outside raspiblitz (`lncli --conf_target 3 sendcoins [ADDRESS]`) or use the menu option 'CHASH OUT' if available
3. Prepare the HDD for the new setup by running the script `/home/admin/XXcleanHDD.sh` (Blockchain will stay on HDD)
4. then shutdown RaspiBlitz (`sudo shutdown now`), flash SD card with new image, redo a fresh setup of RaspiBlitz, move your funds back in, Re-Open your channels
## Why do I need to re-burn my SD card for an update?
I know it would be nicer to run just an update script and you are ready to go. But then the scripts would need to be written in a much more complex way to be able to work with any versions of LND and Bitcoind (they are already complex enough with all the edge cases) and testing would become even more time consuming than it is now already. That's nothing a single developer can deliver.
For some, it might be a pain point to make an update by re-burning a new sd card - especially if you added your own scripts or made changes to the system - but thats by design. It's a way to enforce a "clean state" with every update - the same state that I tested and developed the scripts with. The reason for that pain: I simply cannot write and support scripts that run on every modified system forever - that's simply too much work.
With the SD card update mechanism I reduce complexity, I deliver a "clean state" OS, LND/Bitcoind and the scripts tightly bundled together exactly in the dependency/combination like I tested them and its much easier to reproduce bug reports and give support that way.
Of course, people should modify the system, add own scripts, etc ... but if you want to also have the benefit of the updates of the RaspiBlitz, you have two ways to do it:
1. Contribute your changes back to the main project as pull requests so that they become part of the next update - the next SD card release.
2. Make your changes so that they survive an SD card update easily - put all your scripts and extra data onto the HDD AND document for yourself how to activate them again after an update .. maybe even write a small shell script (stored on your HDD) that installes & configs all your additional packages, software and scripts.
*BTW there is a beneficial side effect when updating with a new SD card: You also get rid of any malware or system bloat that happened in the past. You start with a fresh system :)*
## How can I avoid using a prepared blockchain and validate myself?
The torrent download use a prepared blockchain to kick start the RaspiBlitz. If you want to selft validate you could do this on another more powerful computer and then transfere your own validated blockchain over to the RaspiBlitz. Check the options `Copying from another Computer` & `Cloning from a 2nd HDD` described in the [README](README.md) for more details.
## 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 or replacing a corrupted blockchain with a fresh one. Also that way you synced and verified the blockchain yourself and not trusting the RaspiBlitz 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 through 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 blockchain 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 transfer 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 transfer. Check further FAQ answeres if you get stuck or see a final sync with a value below 90%.
**If you want to replace a corrupted blockchain this way:** *Go to terminal - maybe with CTRL+c. Then call `/home/admin/50copyHDD.sh` use the displayed SCP commands to copy over the fresh blockchain. Press ENTER when all is copied, so that the script can quick check the data. Then make a reboot `sudo shutdown -r now`*
## How do I clone the Blockchain from a 2nd HDD?
During setup, when you start with an empty HDD you need to get a copy of the blockchain. One option available is to connect a 2nd HDD to the RaspiBlitz that contains already the blockchain data and start to copy/clone.
If you choose this option, the console requests you to connect the second HDD and will autmatically detect it:
![SSH6b](pictures/ssh6b-copy.png)
You can simply use the HDD of another RaspiBlitz or you prepare a HDD yourself by:
* format second HDD with exFAT (availbale on Windows and Mac)
* copy an indexed Blockchain into the root folder "bitcoin"
* when your HDD is ready the content of your folder bitcoin should look like this:
```
/bitcoin/blocks
/bitcoin/chainstate
/bitcoin/indexes
```
optional you can add also the testnet data:
```
/bitcoin/testnet3/blocks
/bitcoin/testnet3/chainstate
/bitcoin/testnet3/indexes
```
To connect the 2nd HDD to the RaspiBlitz, the use of a Y cable to provide extra power is recommended (see optional shopping list). Because the RaspiBlitz cannot run 2 HDDs without extra power. For extra power you can use a battery pack (like in picture below) or choose a external HDD with its own power supply.
![ExtraPower](pictures/extrapower.png)
## How do I generate a Debug Report?
If your RaspiBlitz is not working right and you like to get help from the community, its good to provide more debug information, so other can better diagnose your problem - please follow the following steps to generate a debug report:
- ssh into your raspiblitz as admin user with your password A
- If you see the menu - use CTRL+C to get to the terminal
- To generate debug report run: `./XXdebugLogs.sh`
- Then copy all output beginning with `*** RASPIBLITZ LOGS ***` and share this
*PLEASE NOTICE: Its possible that this logs can contain private information (like IPs, node IDs, ...) - just share publicly what you feel OK with.*
## 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 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?
CAUTION: Restoring a backup can lead to LOSS OF ALL CHANNEL FUNDS if it's not the latest channel state. There is no perfect backup solution for lightning nodes yet - this topic is in development by the community.
But there is one safe way to start: Store your LND wallet seed (list of words you got on wallet creation) in a safe place. Its the key to recover access to your on-chain funds - your coins that are not bound in an active channel.
Recovering the coins that you have in an active channel is a bit more complicated. Because you have to be sure that you really have an up to date backup of your channel state data. The problem is: If you post an old state of your channel, to the network this looks like an atempt to cheat, and your channel partner is allowed claim all the funds in the channel.
To really have a reliable backup, such feature needs to be part of the LND software. Almost every other solution would not be perfect. Thats why RaspiBlitz is not trying to provide a backup feature at the moment. But if you feel experimental and you look for a continues backup you may want to check out the following script to integrate into your RaspiBlitz: https://github.com/vindard/lnd-backup/blob/master/do-lndbackup.sh
How to backup LND data in a rescue situation see next question "How can I recover my coins from a failing RaspiBlitz?".
## How can I recover my coins from a failing RaspiBlitz?
On a RaspiBlitz you have coins in your on-chain wallet (bitcoin wallet) and also coins in lightning channels. First we will try to recover all of them and even trying to keep your channels open with "Recover LND data". This that is not possible you can fall back to the second option "Recover from Wallet Seed".
### 1) Recover LND data
To recover all your LND data you must still be able to SSH into the RaspiBlitz (minimum v1.1) and the HDD should be still useable/reachable (mounted) - even it shows some errors. If this is not possible anymore you should skip to the second option "Recover from Wallet Seed".
If you still can SSH in and HDD is readable, we can try to rescue/export your LND data (funds and channels) from a RaspiBlitz to then be able to restore it back to a fresh one. For this you can use the following procedure ...
To rescue/export your Lightning data from a RaspiBlitz:
* SSH into your RaspiBlitz and EXIT to terminal from the menu.
* then run: `/home/admin/config.scripts/lnd.rescue.sh backup`
* follow the instructions of the script.
This will create a lnd-rescue file (ends on gz.tar) that contains all the data from the LND. The script offers you a command to transfere the lnd-rescue file to your laptop. If transfere was successfull. You can now setup a fresh RaspiBlitz. Do all the setup until you have a clean new Lightning node running - just without any funding or channels.
Then to restore your old LND data and to recover your funds and channels:
* SSH into your new RaspiBlitz and EXIT to terminal from the menu.
* then run: `/home/admin/config.scripts/lnd.rescue.sh restore`
* follow the instructions of the script.
This script will offer you a way to transfere the lnd-rescue file from your laptop to the new RaspiBlitz and will restore the old data. LND gets then restarted for you and after some time it should show you the status screen again with your old funds and channels.
**Be aware that if backup is some hours old, channels could have been closed by the other party and it may take some time until you see funds back on-chain. If backup is somewhat older then 1 day also the channel counter parties may have used your offline time to cheat you with an old state. And if your backup was not the latest state it could also been happening that you are posting an old channel state (seen as cheating) and funds of that channel get lost as punishment. So again .. this backup method can be risky, use with caution. But its recommended to try in recover and rescue situations - its not for regular backups.**
### 2) Recover from Wallet Seed
Remember those 24 words you were writing down during the setup? Thats your "cipher seed" - now this words are important to recover your wallet. If you dont have them anymore: skip this chapter and read option 2. If you still have the cypher seed: good, but read the following carefully:
With the cypher seed you can recover the bitcoin wallet that LND was managing for you - but it does not contain all the details about the channels you have open - its just the key to your funding wallet. If you were able to close all channels or never opened any channels, then everything is OK and you can go on. If you had open channels with funds in there, the following is to consider:
* You now rely on your channel counter parts to force close the channel at one point. If they do, the coins will be available to use in your funding wallet again at one point in the future - after force close delay (but see also [#278](https://github.com/rootzoll/raspiblitz/issues/278) ).
* If your channel counter parts never force close the channel (because they are offline too) your channel funds can be frozen forever.
So going this way there is a small risk, that you will not recover your funds. But normally if your channel counter parts are still online, see that you will not come back online and they have themselves some funds on their channel side with you: They have an incentive to force close the channel to make use of their funds again.
So here is what todo if you want to "Recover from Wallet Seed" with RaspiBlitz:
- SetUp a fresh RaspiBlitz (fresh SD-Card image and clean HDD).
- During the new SetUp you get to the point of creating the LND wallet (see image below).
![SSH8](pictures/wallet-recover.png)
- When you get asked "do you have an existing cypher wallet" answere `y` this time.
- Enter the cypher seed - all words in one line seperated by spaces
- If you get asked at the end for the password D to encrypt your cypher seed, use the same as the last time. If you havent entered one last time, just press Enter again.
- When asked about the "address look-ahead" number - use `250000` instead of the default!
Then give LND some time to rescan the blockchain. In the end you will have restored your funding wallet. You maybe need to wait for your old channel counter parts to force close the old channels until you see the coins back displayed.
*Important: If you see a zero balance for on-chain funds after restoring from seed ... see details discussed [here](https://github.com/rootzoll/raspiblitz/issues/278) - you might try setup fresh this time with bigger look-ahead number.*
## 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 the word 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
Use the "Change Name/Alias of Node" option in the main menu. The RaspiBlitz will make a reboot after this.
## What to do when on SSH I see "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"
This means, that he public ssh key of the RaspiBlitz has changed to the one you logged in the last time under that IP.
It's OK when happening during an update - when you changed the sd card image. If it's really happening out of the blue - check your local network setup for a second. Maybe the local IP of your RaspiBlitz changed? Is there a second RaspiBlitz connected? It's a security warning, so at least take some time to check if anything is strange. But also don't get to panic - when it's in your local network, normally it's some network thing - not an intruder.
To fix this and to be able to login with SSH again, you have to remove the old public key for that IP from your local client computer. Just run the following command (with the replaced IP of your RaspiBlitz): `ssh-keygen -R IP-OF-YOUR-RASPIBLITZ` or remove the line for this IP manually from the known_hosts file (see the path to the file in the warning message).
After that, you should be able to login with SSH again.
## When using Auto-Unlock, how much security do I lose?
The idea of the "wallet lock" in general, is that your private key / seed / wallet is stored in a encrypted way on your HDD. On every restart, you have to input the password once manually (unlock your wallet), so that the LND can read and write to the encrypted wallet again. This improves your security if your RaspiBlitz gets stolen or taken away - it loses power and then your wallet is safe - the attacker cannot access your wallet.
When you activate the "Auto-Unlock" feature of the RaspiBlitz, the password of the wallet gets stored on the RaspiBlitz. So if an attacker steals the RaspiBlitz physically, it's now possible for them to find the password and unlock the wallet.
## I connected my HDD but it still says 'Connect HDD' on the display?
Your HDD may have no partitions yet. SSH into the RaspiBlitz as admin (see command and password on display) and you should be offered the option to create a partition. If this is not the case:
Check/Exchange the USB cable. Connect the HDD to another computer and check if it shows up at all.
OSX: https://www.howtogeek.com/212836/how-to-use-your-macs-disk-utility-to-partition-wipe-repair-restore-and-copy-drives/
Windows: https://www.lifewire.com/how-to-open-disk-management-2626080
Linux/Ubuntu (desktop): https://askubuntu.com/questions/86724/how-do-i-open-the-disk-utility-in-unity
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?
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.
## Can I run the RaspiBlitz as Backend for BTCPayServer?
BTCPay Server is a solution to be your own payment processor to accept Lightning Payments for your online store: https://github.com/btcpayserver/btcpayserver
You can find setup instructions for a experimental setup here: https://goo.gl/KnTzLu
Thanks to @RobEdb (ask on twitter for more details) running his demo store with RaspiBlitz: https://store.edberg.eu - buy a picture of [him and Andreas](https://store.edberg.eu/produkt/jag-andreas/) :)
## I dont have a LAN port on my Laptop - how to connect to my RaspiBlitz?
You dont need a LAN port on your laptop as long as you can connect over WLAN to the same LAN router/switch the RaspiBlitz is connected to .. and you are on the same local network.
## Is it possible to connect the Blitz over Wifi instead of using a LAN cable?
A LAN cable is recommended because it reduces a possible source of error on the network connection side. But how to setup WLAN when you dont have a LAN-Router/Switch available see here:
https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#prepare-wifi
## Can I directly connect the RaspiBlitz with my laptop?
If you have a LAN port on your laptop - or you have a USB-LAN adapter, you can connect the 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 for OSX:
* make sure all VPN are off (can interfere with local LAN)
* connect with LAN directly
* Settings > Sharing/Freigaben > activate "internet sharing" from WLAN to Ethernet
* Settings > Network > Ethernet-Adapter > set to DHCP
* in terminal > `ifconfig` there you should the the IP of the bridge100
* in terminal > `arp -a` and check for an IP of a client to the bridge
* in terminal > ssh admin@[clientIP]
If anyone has expirence on doing this in Linux/Win, please share.
## How do I unplug/shutdown safely without SSH
Just removing power from the RaspiBlitz can lead to data corruption if the HDD is right in the middle of a writing process. The safest way is always to SSH into the RaspiBlitz and use the "POWER OFF" option in the main menu.
But if cannot login with SSH and you need to power off at least remove the LAN cable (network connection)first for sometime (around 10-30 secs - until you can see no more blinking lights on the HDD) and then remove the power cable. This should minimize the risk if data corruption in this situations.
## How can I build an SD card other then the master branch?
There might be a new not released features in development that are not yet in the master branch - but you want to try them out.
To build a sd card image from another branch than master you follow the [Build the SD Card Image](README.md#build-the-sd-card-image) from the README, but execute the build script from the other branch and add the name of that branch as a parameter to the build script.
For example if you want to make a build from the 'dev' branch you execute the following command:
`wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/build_sdcard.sh && sudo bash build_sdcard.sh 'dev'`
## How can I build an SD card from my forked GitHub Repo?
If you fork the RaspiBlitz repo (much welcome) and you want to run that code on your RaspiBlitz, there are two ways to do that:
* The quick way: For small changes in scripts, go to `/home/admin` on your running RaspiBlitz, delete the old git with `sudo rm -r raspiblitz` then replace it with your code `git clone [YOURREPO]` and `/home/admin/XXsyncScripts.sh`
* The long way: If you like to install/remove/change services and system configurations you need to build a SD card from your own code. Prepare like in [Build the SD Card Image](README.md#build-the-sd-card-image) from the README but in the end run the command:
`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]
If you are then working in your forked repo and want to update the scripts on your RaspiBlitz with your latest repo changes, run `/home/admin/XXsyncScripts.sh` - thats OK as long as you dont make changes to the sd card build script - then you would need to build a fresh sd card again from your repo.
## How to attach the RaspberryPi to the HDD?
There are multiple ways to do it - just remember it should be easy to get to the SD card slot to remove and replace the card.
Here is an example to use [Hook-and-loop fastener](https://en.wikipedia.org/wiki/Hook-and-loop_fastener) tape:
![ExtraPower](pictures/befestigung.jpg)
## What other case options do I have?
You can replace the generic case in the shopping lists with a customized 3D printed for the RaspiBlitz called "Lightning Shell" - great work by @CryptoCloaks
https://thecryptocloak.com/product/lightningshell/
![LightningShell](pictures/lightningshell.png)
Also there are first free 3D open source files in this repo in the directory `case.3dprint` that you can selfprint. Those are much simpler then the 'Lightning Shell' and are not finished yet. But feel free to try out and improve - PullRequests welcome.
## Are those "Under-Voltage detected" warnings a problem?
When your USB power adapter for the RaspiBlitz delivers too low power those messages with "Under-Voltage detected" (undervoltage) are shortly seen on the display. This can lead to data loss/corruption on the HDD. If you see those just one or two times that's not OK, but can be in a tolerant window. Nevertheless it make sure your USB power adapter can deliver at least 3A (big and stable is good). If you still see those warnings maybe get a second USB Power adapter just for the HDD and power the HDD through a Y-Cable - see https://en.wikipedia.org/wiki/Y-cable#USB or put a USB Hub with extra power between the raspberry and the HDD.
## Why do we need to download the blockchain and not syncing it?
The RaspiBlitz is powered by the RaspberryPi. The processing power of this SingleBoardComputer is too low to make a fast sync of the blockchain from the bitcoin peer to peer network during setup process (validation). To sync and index the complete blockchain could take weeks or even longer. Thats why the RaspiBlitz needs to download a prepared blockchain from another source.
## Is using the perpared SD card image secure?
Using pre-built software almost always shifts trust to the one who made the binary. But at least you can check with the SHA checksum after download if the image downloaded is really the one offered by the GitHub Repo. To do so make a quick check if your browser is really in the correct GiutHub page and that your HTTPS of the GitHub page is signed by 'DigiCert'. Then compare the SHA-256 string (always next to the download link of the image on the README) with the result of the command `shasum -a 256 [DOWNLOADED-FILE-TO-CHECK]` (Mac/Linux). Still this is not optimal and if at least some people from the community request it, I will consider signing the download as an author for the future.
The best way would be to build the sd card yourself. You use the script `build_sdcard.sh` for it. Take some minutes to check if you see anything suspicious in that build script and then follow the [README](README.md#build-the-sd-card-image) on this.
## Is downloading the blockchain from a third party secure?
To download a blockchain from a third party (torrent/ftp) is not optimal and for the future with more cheap & powerfull SingleBoardComputers we could get rid of this 'patch'.
The downloaded blockchain is pre-indexed and pre-validated. That should be practically secure enough, because if the user gets a "manipulated" blockchain it would not work after setup. The beginning of the downloaded blockchain needs to fit the genesis block (in bitcoind software) and the end of the downloaded blockchain needs not match with the rest of the bitcoin network state - hashes of new block distrubuted within the peer-2-peer network need to match the downloaded blockchain head. So if you downloaded a manipulated blockchain it simply wouldn't work in practice. As long as you are not in a totally hostile environment where someone would be able to fake a whole network of peers and miners around you - this is secure enough for running a small funded full node to try out the lightning network.
If you dont trust the download or you want to run the RaspiBlitz in a more production like setup (on your own risk) then don't use the torrent/ftp download and choose the option to COPY the blockchain data from a more powerful computer (laptop or desktop) where you synced, verified and indexed the blockchain all by your yourself - see [README](README.md#4-copying-from-another-computer) for more details.
## Why is taking my torrent download of the blockchain so long?
Other users reported that opening up and forwarding the following port from their router to the RaspiBlitz helped speed up and getting started the torrent download: 6881-6889, 6969, 1337
## What is the "Base Torrent File"?
Inspired by the website getbitcoinblockchain.com we use one of their base torrent files to have a basic set of blocks - that will not change for the future. This torrent contains most of the data (the big file) and we dont need to change the torrent for a long time. This way the torrent can get establish a wide spread seeding and the torrent network can take the heavy load.
At the moment (Baseiteration=1) this is just the bitcoin blk and rev files up to the number:
- /blocks : 01390
- /testnet3/blocks: 00152
For litecoin (Baseiteration=1) its blk and rev files up to the number:
- /blocks : 00124
The base torrent file should always have the following naming scheme:
`raspiblitz-[CHAINNETWORK][BASEITERATIONNUMBER]-[YEAR]-[MONTH]-[DAY]-base.torrent`
So for example the second version of the base torrent for litecoin created on 2018-10-31 would have this name: raspiblitz-litecoin2-2018-10-31-base.torrent
## What is the "Update Torrent File" and how to create it?
All the rest of the files get packaged into a second torrent file. This file will be updated much more often. The seeding is expected to be not that good and download may be slower, but that's OK because it's a much smaller file.
This way a good balance between good seeding and up-to-date blockchain can be reached.
To create the Update Torrent file, follow the following step ...
Have a almost 100% synced bitcoind MAINNET with txindex=1 on a RaspiBlitz
(remove all funds from this node - because blockchain get messed with)
Stop bitcoind with:
```
sudo systemctl stop bitcoind
```
Delete base torrent blk-files with:
```
sudo rm /mnt/hdd/bitcoin/blocks/blk00*.dat
sudo rm /mnt/hdd/bitcoin/blocks/blk0{1000..1390}.dat
```
Delete base torrent rev-files with:
```
sudo rm /mnt/hdd/bitcoin/blocks/rev00*.dat
sudo rm /mnt/hdd/bitcoin/blocks/rev0{1000..1390}.dat
```
Now change to your computer where you package the torrent files and transfere the three directories into your torrent base directory (should be your current working directory):
```
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/blocks ./blocks
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/chainstate ./chainstate
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/indexes ./indexes
```
Also have an almost 100% synced bitcoind TESTNET with txindex=1 on a RaspiBlitz
Stop bitcoind with:
```
sudo systemctl stop bitcoind
```
Delete base torrent blk-files with:
```
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/blk000*.dat
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/blk00{100..152}.dat
```
Delete base torrent rev-files with:
```
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/rev000*.dat
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/rev00{100..152}.dat
```
Now change again to your computer where you package the torrent files and transfer the three directories into your torrent base directory (should be your current working directory):
```
mkdir testnet3
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/blocks ./testnet3/blocks
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/chainstate ./testnet3/chainstate
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/indexes ./testnet3/indexes
```
(Re-)name the "torrent base directory" to the same name as the torrent UPDATE file itself later (without the .torrent ending). The update torrentfile should always have the following naming schema:
`raspiblitz-[CHAINNETWORK][BASEITERATIONNUMBER]-[YEAR]-[MONTH]-[DAY]-update.torrent`
*So for example an update torrent created on 2018-12-24 for litecoin that is an update to the second base torrent version would have this name: raspiblitz-litecoin2-2018-12-24-update.torrent*
Now open your torrent client (e.g. qTorrent for OSX) and create a new torrent-file with the freshly renamed "torrent base directory" as source directory.
Add this list of trackers to your torrent and start seeding (keep a free/empty line between the three single trackers):
```
udp://tracker.justseed.it:1337
udp://tracker.coppersurfer.tk:6969/announce
udp://open.demonii.si:1337/announce
udp://denis.stalker.upeer.me:6969/announce
```
After successful creation of the torrent file:
* copy to `/home.admin/assets`
* push to master
* change in `50torrentHDD.sh script`
* add to Torrent-[RSS](https://github.com/rootzoll/raspiblitz/issues/285#issuecomment-457796120)
* seed at home and at services like justseed.it
* update [issue](https://github.com/rootzoll/raspiblitz/issues/285#issuecomment-457796120) and ask on twitter for help on seeding
## What is the process of creating a new sd card image release?
Work Nodes for the process of producing a new sd card image release:
* Start `Ubuntu LIVE` from USB stick on Build Computer (press F12 on startup)
* Connect secure WIFI (hardware switch on)
* Download latest Raspbian Desktop (without recommended software) from [raspberrypi.org](https://www.raspberrypi.org/downloads/raspbian/) to the NTFS formatted data USB stick
* Open terminal and compare checksum `shasum -a 256 /media/ubuntu/...[DOWNLOADED-RASPBIAN]`
* Use in file manager context on NTFS USB stick `extract here` to unzip
* Connect sd card reader with 8GB sd card
* Use in file manager context on img-file `write image` write to sd card
* Use in file manager context on `boot` drive free space `open in terminal`
* Run command `touch ssh`
* Close terminal and eject `boot`
* Connect a RaspiBlitz (without HDD) to network, insert sd card and power up
* Find IP if RaspiBlitz (arp -a or check router)
* In terminal `ssh pi@[IP-OF-RASPIBLITZ]`
* Password is `raspberry`
* `wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/build_sdcard.sh && sudo bash build_sdcard.sh`
* Check output for warnings/errors - install LCD
* Login new with `ssh admin@[IP-OF-RASPIBLITZ]` (pw:raspiblitz) and run `./XXprepareRelease.sh`
* Deconnect Wifi on build laptop (hardware switch off) and shutdown
* Remove `Ubuntu LIVE` USB stick and replace with `Ubuntu AIRGAP`
* PowerOn Build Laptop (press F12 for boot menu)
* Cut Power of RaspiBlitz, remove sd card and connect with sd card reader to build laptop
* Connect and open in Filemenager NTFS - context on white scace -> open terminal
* run `df`to check on sd card reader device name
* `sudo dd if=/dev/[sdcarddevice] | gzip > ./raspiblitz-vX.X-YEAR-MONTH-DAY.img.gz`
* Delete all IMG files from NTFS (just keep zips/gzs)
* Context on white space, `Open in Terminal`, run `shasum -a 256 [NEW-ZIP] > sha256.txt`
* [Do future author signing here with tools from airgap build machine]
* Shutdown build computer
* Connect NTFS USB stick to MacOS (its just readonly)
* Check if file can be unzipped on OSX
* Run tests with new image
* Upload new image to Download Server
* Copy SHA256-String into GutHub README and update downloadlink
## Can I run RaspiBlitz on other computers than RaspberryPi?
There is an experimental section in this GitHub that tries to build for other SingleBoardComputers. Feel free to try it out and share your experience: [dietpi/README.md](dietpi/README.md)
## Can I flip the screen?
For the default 3.5" LCD you need to edit the /boot/config.txt. Run `sudo nano /boot/config.txt`
look for the line `dtoverlay=tft35a:rotate=270` towards the end. To flip the screen with 180 degrees change the line to `dtoverlay=tft35a:rotate=90` and reboot with `sudo reboot`. Reference: https://github.com/goodtft/LCD-show/issues/34
## How to setup fresh/clean/reset and not getting into recovery mode?
When you put in a sd card with a new/clean RaspiBlitz image the RaspiBlitz will get into recovery mode because it detects the old data on your HDD and assumes you just want to continue to work with this data.
But there might be cases where you want to start a totally fresh/clean RaspiBlitz from the beginning. To do so you need to delete the old data from the HDD. You can do so by formating it on another computer (for example with FAT and name it "NEW"). Or when you can run the script "/home/admin/XXcleanHD.sh -all" on the terminal.
When the HDD is clean, then flash a new RaspiBlitz sd card and your setup should start fresh.
## 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. But there are other options:
1. Copy Blockchain from another Computer
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)*
## Can I run the RaspiBlitz without a display/LCD?
The display is one of the nice features of the RaspiBlitz but the raspberry can un without it. Maybe not all add-on feature could be used to the full extend, but you can get started without the LCD and even plug it on later.
Normally with the LCD its easy to see your local IP changes and you can get started quickly. Without it needs a bit more digging thru your network - you can find a good tutorial on that on the RaspiBolt tutorial (origin of RaspiBlitz):
https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#connecting-to-the-network
*Please Note: Without a LCD-Hat you cannot simply use the HDMI as alternative, because screen signal is routed to the GPIO pins. On how to switch that back manually - see [waveshare documentation](https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)).*
## I have two RaspiBlitz in my network - can they both be public?
Yes but you need to change at least on one RaspiBlitz the port number (for example to 9736) on one of your RaspiBlitzes - see how to change a port below. Then you can forward both ports from your home internet router to the matching RaspiBlitzes.
## How to change the public port LND/Lightning node is running on?
There is a experimental script you can call from the terminal that will make all changes for you ... see details here: https://github.com/rootzoll/raspiblitz/issues/100#issuecomment-466722712
## How to solve a "signature mismatch after caveat verification" error?
If you get this error by LND that means that something is wrong with the macaroons being used to communicate with LND .. see: https://github.com/lightningnetwork/lnd/blob/master/docs/macaroons.md
To fix this depends on where you get this error:
* If you get it in a mobile wallet, then redo the connection with the RaspiBlitz to get fresh macaroons.
* If you get this from RTL or from the scripts of the SSH menus of the RaspiBlitz, then go to "EXPORT Macacroons and TLS.cert" in SSH main menu and choose the the "RESET Macaroons & TLS" option.
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)
## Why is my node not routing?
1. You don't have inbound liquidity
2. Low uptime
3. Capital is committed to competitive destinations
4. Capital committed to destinations no one wants to send to
5. Fees are too high
6. Your inbound liquidity doesn't have good inbound liquidity itself
## How can I change the boot screen logo?
Just replace the file `/home/admin/raspiblitz/pictures/logoraspiblitz.png` with a PNG of the same dimensions.
NOTE: On updates this change will get lost and you might need to redo it.
## I cannot connect per SSH to my RaspiBlitz. What to do?
- Check the command again with how its on the display - do you have it typed in correctly?
- Replace `ssh` with `sudo ssh` and try it (laptop admin password might be required).
If that not works ry to ping the IP of the RaspiBlitz with `ping [IP-of-RaspiBlitz]`. If you get no response on the ping requests the device is not reachable try this check list:
- Make sure that your RaspiBlitz and your laptop are really on the same local network
- Check if you have a VPN running on your laptop - some VPNs block local network
- Some Routers have `IP Isolation` switched on - not allowing to devices to connect
If that all is not working: Join the conversation on [GitHub Issue #420](https://github.com/rootzoll/raspiblitz/issues/420).

594
README.md

@ -1,407 +1,587 @@
[ [Hardware](#hardware-needed-amazon-shopping-list) ] -- [ [Setup](#boot-your-raspiblitz) ] -- [ [Documentation](#documentation) ] -- [ [Development](#further-development-of-raspiblitz) ]
-----
# RaspiBlitz
Fastest and cheapest way to get your own Lightning Node running - on a RaspberryPi with a nice LCD.
*Build your own Lightning Node on a RaspberryPi with a nice Display.*
`Version 0.98 (1.0 RC1) with lnd 0.5.1 and bitcoin 0.17.0.1 & litecoin 0.16.3.`
`Version 1.1 with lnd 0.5.2-beta and bitcoin 0.17.0.1 or litecoin 0.16.3.`
![RaspiBlitz](pictures/raspiblitz.jpg)
*This tutorial is based on the RaspiBolt project - you can find in detail here: https://github.com/Stadicus/guides/blob/master/raspibolt The RaspiBlitz serves as a shortcut through this setup process with some changes and an additional LCD display so that you can quickly experiment with a Lightning node and start working on your LApps on a hacking event (or at home). This shortcut is fine for testnet usage and maybe trying some small things on mainnet. But if you choose to go full reckless afterwards … please consider taking the time and work thru the original RaspiBolt project. Don’t trust us, verify.*
**The RaspiBlitz is a all-switches-on Lightning Node based on LND running together with a Bitcoin- or Litecoin-Fullnode on a RaspberryPi3 - with a 1TB HDD and an nice Display for easy setup & monitoring.**
## Table of Contents
Its mainly targeted for learning how to run your own node decentralized from home. Discover & develop the growing ecosystem of the Lightning Network by becoming a part of it. Build it as part of a [workshop](WORKSHOP.md) or as a weekend project yourself.
* [ [Hardware](#hardware-needed-amazon-shopping-list) ] Shopping Lists and Putting all together
* [ [Setup](#boot-your-raspiblitz) ] Init and Setup your RaspiBlitz Lightning Node
* [ [Documentation](#documentation) ] Features and Usecases
* [ [Development](#further-development-of-raspiblitz) ] Lets work together on the RaspiBlitz
## Feature Overview
## Hardware Needed (Amazon Shopping List)
This is a quick look at the SSH main menu (once RaspiBlitz is SetUp):
*The RaspiBlitz software is build and tested for the following Hardware set that you can buy cheap on GERMAN Amazon:*
![MainMenu-A](pictures/mainmenu.png)
* RaspBerry Pi 3 (34,99 EUR) https://www.amazon.de/dp/B07BDR5PDW
* Micro SD-Card 16GB (7,99 EUR) https://www.amazon.de/gp/product/B073K14CVB/
* Power >=3A (9,91 EUR) https://www.amazon.de/dp/B01E75SB2C
* 1TB Hard Drive (44,98 EUR) https://www.amazon.de/dp/B07997KKSK?th=1
* Case (9,36 EUR) https://www.amazon.de/dp/B0173GQF8Y
* LCD-Display (16,88 EUR) https://www.amazon.de/gp/product/B06X191RX7
There are additional services that can be switched on:
**Total Price: 124,11 EUR** (thats under 150 USD)
![MainMenu-Services](pictures/mainmenu-services.png)
Amazon shopping lists for different countries:
[ [USA](shoppinglist_usa.md) ] [ [UK](shoppinglist_uk.md) ] [ [France](shoppinglist_fr.md) ] [ [China](shoppinglist_cn.md) ] [ [Australia](shoppinglist_au.md) ] [ [Czech](shoppinglist_cz.md) ] [ [Switzerland](shoppinglist_ch.md) ]
As an parallel alternative to the SSH menu there is also the RTL WebUI available (LND API Coverage at 57%):
You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning thru [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).
![RTL-preview](pictures/RTL-dashboard.png)
The shopping list for China refers to Taobao/T-Mall.
See more details in the [Feature Documentation](#feature-documentation) & of course you have all the [Fullnode APIs](#interface--apis).
### 3D Printed Case (optional)
## Time Estimate to Setup a RaspiBlitz
You can replace the generic case in the shopping lists above with a customized 3D printed for the RaspiBlitz called "Lightning Shell" - great work by @CryptoCloaks
The RaspiBlitz is optimized for being setup during a workshop at a hackday or conference (see [detailed workshop tutorial](WORKSHOP.md)). When it comes ready assembled together with a up-to-date synced blockchain its possible to have it ready in about 2 to 3 hours - most is waiting time.
https://thecryptocloak.com/product/lightningshell/
If you start at home ordering the parts from Amazon (see shopping list below) then its a weekend project with a lot of download and syncing time where you can do other stuff while checking on the progress from time to time.
![LightningShell](pictures/lightningshell.png)
## Hardware Needed
### More optional Hardware
The RaspiBlitz is build from the following parts:
*Some optional goodies to consider to add to your shopping list for your RaspiBlitz (Amazon DE/US):*
* RaspBerryPi 3 B+
* 1TB Hard Drive
* LCD-Display
* Micro SD-Card (min 16GB - go for quality)
* Powersupply >=3A (choose big & stable output)
* Cheap Casing
* SD-Card Writer https://www.amazon.de/dp/B01JWFZWUQ / http://a.co/6e03D7Z
* LAN Cable https://www.amazon.de/dp/B004SUEIE2 /http://a.co/g2IJd6i
* USB-LAN-Adapter https://www.amazon.de/dp/B00NPJV4YY / http://a.co/ccb26nF
* Transport Case https://www.amazon.de/dp/B007Y4NWSW / http://a.co/0c6wyM2
* Y-Cable https://www.amazon.de/dp/B00ZJBIHVY / http://a.co/0WTA7nz
**All together under 150 USD / 130 EUR (depending on country & shop)**
If you organizing an educational event where you want to support people learning on and with multiple RaspiBlitz, here is a package list of useful hardware to have at that event: [ [Event Package List](shoppinglist_event.md) ]
## Amazon Shopping Lists
## Prepare your Hardware
These are the community currated shopping lists based on country:
*There are two ways to start:*
* [Germany](shoppinglist_de.md) *(reference shopping list)*
* [USA](shoppinglist_usa.md)
* [Canada](shoppinglist_ca.md)
* [UK](shoppinglist_uk.md)
* [Switzerland](shoppinglist_ch.md)
* [France](shoppinglist_fr.md)
* [China](shoppinglist_cn.md)
* [Australia](shoppinglist_au.md)
* [Czech](shoppinglist_cz.md)
### Scenario 1: “At a Hackathon/Event”
If you are at an event, ask for a ready-2-go set or if you have your own hardware ask for assistance to prepare your SD-Card and HDD. Then you are all set and and you can proceed with "Setup your RaspiBlitz".
*You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning thru [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).*
### Scenario 2 “Start at Home”
You got all the hardware of the shopping list above and you have no further assistance. Then you need to prepare your SD-Card yourself .. this scenario is still experimental, feedback needed and can take some time.
* [What other case options do I have?](FAQ.md#what-other-case-options-do-i-have)
1. Download SD-Card image:
https://wiki.fulmo.org/downloads/raspiblitz-0.99-2018-12-24.img.gz
SHA-256: 9c9ee0dea2e892a0e665befc86f6bd2f5a11f4d290bda46ba9203bf9e5d0a3df
or [build your own SD card image](#build-the-sd-card-image)
## Assemble your RaspiBlitz
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
If your RaspiBlitz is not assembled yet, put the RaspberryPi board into the case and add the display like in picture below:
## Boot your RaspiBlitz
![LCD](pictures/lcdassm.png)
Connect all hardware like on photo and boot it up by connecting the power.
*Some cases from the shopping lists contain a topping for smaller displays - you can ignore that topping.*
Connect the HDD to one of the USB ports. In the end your RaspiBlitz should look like this:
![HardwareSetup](pictures/hardwaresetup.jpg)
* [How to attach the RaspberryPi to the HDD?](FAQ.md#how-to-attach-the-raspberrypi-to-the-hdd)
## Installing the Software
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:
**Download SD-Card image - Version 1.1:**
HTTP: http://wiki.fulmo.org/downloads/raspiblitz-v1.1-2019-03-18.img.gz
Torrent: https://github.com/rootzoll/raspiblitz/raw/master/raspiblitz-v1.1-2019-03-18.torrent
SHA-256: b7a449ce6444f9e7e9fd05156ff09c70a6e200be0b5e580d3317049eefc4f3b7
**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
* [How to update my RaspiBlitz?](FAQ.md#how-to-update-my-raspiblitz-after-version-098)
* [Whats new in Version 1.1 of RaspiBlitz?](FAQ.md#whats-new-in-version-11-of-raspiblitz)
* [Can I still get version 1.0 of RaspiBlitz?](FAQ.md#can-i-still-get-version-10-of-raspiblitz)
## Boot your RaspiBlitz
Insert the SD card and connect the power plug.
* Make sure to connect the raspberry with a LAN cable to the internet at this point.
* Make sure that your laptop and the raspberry are on the same local network.
* On Mac OS X you can also consider to connect the raspberry directly with your laptop and share your WLAN internet connection over ethernet (thats a nice mobile setup): https://mycyberuniverse.com/mac-os/connect-to-raspberry-pi-from-a-mac-using-ethernet.html
**Troubleshoot:**
* [I dont have a LAN port on my Laptop - how to connect to my RaspiBlitz?](FAQ.md#i-dont-have-a-lan-port-on-my-laptop---how-to-connect-to-my-raspiblitz)
* [Is it possible to connect the Blitz over Wifi instead of using a LAN cable?](FAQ.md#is-it-possible-to-connect-the-blitz-over-wifi-instead-of-using-a-lan-cable)
* [Can I directly connect the RaspiBlitz with my laptop?](FAQ.md#can-i-directly-connect-the-raspiblitz-with-my-laptop)
* [I connected my HDD but it still says 'Connect HDD' on the display?](FAQ.md#i-connected-my-hdd-but-it-still-says-connect-hdd-on-the-display)
When everything boots up correctly, you should see the local IP address of your RaspiBlitz on the LCD panel.
![LCD0](pictures/lcd0-welcome.png)
So 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`
**Now follow the dialoge in your terminal. This can take some time (prepare some coffee) - but in the end you should have a running Lightning node on your RaspberryPi that you can start to learn and hack on.**
## Documentation
* [I cannot connect per SSH to my RaspiBlitz. What to do?](FAQ.md#i-cannot-connect-per-ssh-to-my-raspiblitz-what-to-do)
## Support
If you run into a problem or you have still a question, follow the steps below to get support. Also check the [setup documentation](#setup-process-detailed-documentation) for details.
1. Lookup the [FAQ](FAQ.md) if you can find an answere to this question/problem.
2. Please determine if your problem/question is about RaspiBlitz or for example with LND. For example if you cant route a payment or get an error when opening a channel that is an LND question/problem an is best answered by the LND dev community: https://dev.lightning.community
3. Go to the GitHub issues of the RaspiBlitz: https://github.com/rootzoll/raspiblitz/issues Do a search there. Also check closed issues by removing 'is:open' from the filter/search-box.
4. If you havent found an answere yet, open a new issue on the RaspiBlitz GitHub. You may have to register an account with GitHub for this. If its a bug with the RaspiBlitz, please add (copy+paste) a Debug Report to your issue (see [FAQ](FAQ.md) how to generate) and/or add some screenshots/photos so the community gets more insight into your problem.
### Setup Process
## Setup Process (Detailed Documentation)
*The goal is, that all information needed is provided from the interaction with the RaspiBlitz itself during the setup. Documentation in this chapter is for background, comments for educators and help in special edge cases.*
*The goal is, that all information needed is provided from the interaction with the RaspiBlitz itself during the setup. Documentation in this chapter is for background, comments for educators and to mention edge cases.*
#### Init
If you are looking for a tutorial on how to oragnise a workshop to build the RaspiBlitz, [see here](WORKSHOP.md).
Automatically after login per SSH as admin to the RaspiBlitz, the user can choose if the RaspiBlitz should combine Bitcoin or Litecoin with Lightning:
### Init
Automatically after login per SSH as admin to the RaspiBlitz, the user can choose if the RaspiBlitz should run Bitcoin or Litecoin with Lightning:
![SSH0](pictures/ssh0-welcome2.png)
Setting Up the Raspi is the only option at this point, so we go with OK.
*Background: This menu is displayed by the script `00mainMenu.sh` and started automatically on every login of the admin user by admins `.bashrc`. If you want to get to the normal terminal prompt after login, just use CTRL-c. If you press OK in the dialog the script `10setupBlitz.sh` gets started*
*This menu is displayed by the script `00mainMenu.sh` and started automatically on every login of the admin user by admins `.bashrc`. If you want to get to the normal terminal prompt after login, just use CTRL-c or CANCEL. To return to the main menu from the terminal you can use the command `raspiblitz`.*
First thing to setup is giving your RaspiBlitz an name:
First thing to setup is giving your RaspiBlitz a name:
![SSH2](pictures/ssh2-passwords.png)
This name is given to the RaspiBlitz as hostname in the local network and later on also for the alias of the lightning node.
*Background: This and the following setup dialogues are part of the script `20setupDialog.sh`. The idea is to request much as needed setup information from the user at the start in this dialogs, so after that the setup can just run without many breaks.*
Then the user gets requested to write down 4 passwords:
Then the user gets requested to think of and write down 4 passwords:
![SSH1](pictures/ssh1-name.png)
*Background: The password A,B,C & D idea is directly based in the [RaspiBolt Guide Preperations](https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#write-down-your-passwords)*
*The password A,B,C & D idea is directly based in the [RaspiBolt Guide Preperations](https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#write-down-your-passwords) - check out for more background.*
Then the user is asked to enter the Password A:
![SSH3a](pictures/ssh3a-password.png)
On the next SSH login to the RaspiBlitz as admin, this new password has to be used. Its also set for the user existing user: root, bitcoin & pi. But only admin can be used to login per SSH.
This is the new password has to be used for every SSH login after this screen. Its also set for the user existing user: root, bitcoin & pi.
*Background: The bitcoin and lightning processes will run in the background (as daemon) and use the separate user “bitcoin” for security reasons. This user does not have admin rights and cannot change the system configuration.*
*The bitcoin and lightning services will later run in the background (as daemon) and use the separate user “bitcoin” for security reasons. This user does not have admin rights and cannot change the system configuration.*
Then the user is asked to enter the Password B:
![SSH3b](pictures/ssh3b-password.png)
*Background: The other passwords C & D get entered by the lightning wallet setup. This can just happen later ... so they will not get requested at this point.*
*The other passwords C & D will be needed later on. They will be used during the lightning wallet setup.*
After this the setup process needs some time and the user will see a lot of console outputs:
After this the setup process will need some time and the user will see a lot of console outputs:
![SSH4](pictures/ssh4-scripts.png)
*Background: After the user interaction the following scripts are started to automatically setup the RaspiBlitz:*
* 30initHDD.sh - it checks if the HDD needs to be formatted with Ext4
* 40addHDD.sh - adds the HDD for permanent mounting on /mnt/hdd
* 10setupBlitz.sh - now takes care that the HDD contains the blockchain
### Getting the Blockchain
*If you have a HDD with a prepared blockchain (e.g. a ready2go-set or you are at a workshop) you can skip to the [next chapter](#setup-lightning). If you started with an empty HDD - you will see the following screen:*
To get a copy of the blockchain, the RaspiBlitz offers the following options:
<img src="pictures/ssh5-blockchain2.png" alt="blockchain-options" width="600">
The options - and when to choose which - will be explained here shortly:
#### 1. Torrent
The following screen is just shown, if the HDD was not prepared with a copy of the Bitcoin blockchain (as part of a ready-2-go set). The following options are offered to get a copy:
This is the default way to download the blockchain data for the RaspiBlitz. If you choose it will show you the following screen:
![SSH5](pictures/ssh5-blockchain2.png)
![DOWNLOAD1](pictures/download-torrent.png)
The option "SYNC" should just be use as a fallback. So normally you have the following two options:
*This can take a while - normally it should be done if you keep it running over night, but some users reported that it took up to 3 days. If it takes longer than that or you cannot see any progress (downloading starting) for over an hour after you started this option consider to cancel the download and go with the COPY option or retry fresh.*
#### Download the Blockchain
It is safe to close the terminal window (shutdown your laptop) while the RaspiBlitz is doing the torrent download. To check on progress and to continue the setup you need to ssh back in again.
This is the recommended way for users that are making the setup at home without any further assistance but can take quite some time. You can choose to download over TORRENT or FTP-DOWNLOAD. Choose the FTP if the torrent is not working for you.
You can cancel the torrent download by keeping the key `x` pressed. Then the download will stop and you will be asked if you want to keep the progress so far. This makes sense if you need to shutdown the RaspiBlitz and you want to continue later or when you want to try another download option but want to keep the option to continue on torrent if the other option is slower or not working.
For more details: [Background on Download Blockchain](background_downloadBlockchain.md)
* [How can I avoid using a prepared blockchain and validate myself?](FAQ.md#how-can-i-avoid-using-a-prepared-blockchain-and-validate-myself)
* [Why is taking my torrent download of the blockchain so long?](FAQ.md#why-is-taking-my-torrent-download-of-the-blockchain-so-long)
#### Copy the Blockchain
To copy the blockchain from another HDD can be faster - if available. If you choose this option, the console requests you to connect the second HDD and will autmatically detect it:
#### 2. Copying from another Computer
![SSH6b](pictures/ssh6b-copy.png)
If you have another computer available (laptop, desktop or another raspiblitz) that already runs a working blockchain (with txindex=1) you can use this option to copy it over to the RaspiBlitz. This will be done over the local network by SCP (SSH file transfere). Choose this option and follow the given instructions.
You can simply use the HDD of another RaspiBlitz or you prepare a HDD yourself by:
This is also the best option if you dont like to run your RaspiBlitz with a prepared blockchain by a third party. Then install bitcoin-core in a more powerful computer, sync+validate the blockchain (with txindex=1) there by yourself and copy it over after that thru the local network.
* format second HDD with exFAT (availbale on Windows and Mac)
* copy an indexed Blockchain into the root folder "bitcoin"
* when your HDD is ready the content of your folder bitcoin should look like this:
More details: [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)
![BitcoinFolderData](pictures/seedhdd.png)
#### 3. Cloning from a 2nd HDD
To connect the 2nd HDD to the RaspiBlitz, the use of a Y cable to provide extra power is recommended (see optional shopping list). Because the RaspiBlitz cannot run 2 HDDs without extra power. For extra power you can use a battery pack, like in this picture:
If is a backup way to transfere a blockchain from another computer if copying over the network is not working. More details on the setup can be found [here](FAQ.md#how-do-i-clone-the-blockchain-from-a-2nd-hdd).
![ExtraPower](pictures/extrapower.png)
#### 4. Sync from Bitcoin-Network
**Background: If the blockchain was already on the HDD or was acquired successfully, the script `60finishHDD.sh` will be called. It will further prepare the HDD and start the bitcoin service.*
This is the fallback of last resort. A RaspberryPi has a very low power CPU and syncing+validating the blockchain directly with the peer2peer network can take multiple weeks - thats why the other options above where invented.
#### Lightning
### Setup Lightning
Before the lighting service can be started, the Bitcoin service needs to make sure that the blockchain is up to date. The downloaded blockchain data could be several weeks old - this could take some minutes. Then the Lightning Service gets started and a wallet can be created:
Lightning is installed and waiting for your setup if you see this screen.
![SSH7](pictures/ssh7-lndinit.png)
The creation of the Lightning Bitcoin Wallet gets done with the command: `lncli create` the RaspiBlitz is calling in the background.
The RaspiBlitz calling the LND wallet creation command for you:
![SSH8](pictures/ssh8-wallet.png)
After the wallet was created the Lightning service needs to scan the Blockchain ... this can take some time. If needed the user can close the SSH session with the RaspiBlitz during that time (progress is displayed on the LCD as status). On SSH back in just continue with the setup process.
First it will ask you to set your wallet unlock password - use your choosen PASSWORD C here and confirm it by inputting it a second time.
![SSH9](pictures/ssh9-lndscan.png)
Second it will ask you if you have an existing "cipher seed mnemonic" - if this is your first RaspiBlitz/LND just ansere `n`.
*Background: Blockchain synup, LND wallet creation and LND scanning is all done within the script `70initLND.sh`*
*The "cipher seed mnemonic" is the word list that contains the backup of your private key. If you dont have one from a former RaspiBlitz setup it will be created for you. If you want to recovcer on old LND wallet, thats the point in the setup to enter it.*
Now the setup process is almost done and the RaspiBlitz needs a reboot:
Third it will ask you if you want to protect your backup word list with an additional password. You can simple keep this empty and just press ENTER to continue. If you want to go for this extra protection use your chossen PASSWORD D here.
LND will now generate a fresh cipher seed (word list) for you. WRITE THIS DOWN before you continue - without you limit your chances to recover funds in case of failing hardware etc. If you just want to try/experiment with the RaspiBlitz at least take a photo with your smartphone just in case. If you might plan to keep your RaspiBlitz running after trying it out store this word list offline or in a password safe. Hit ENTER once your done.
It will now make sure your wallet is initialized correctly and may ask you to unlock it with your just set PASSWORD C.
![SSH9c](pictures/ssh9c-unlock.png)
*The LND wallet needs to get unlocked on every new start/reboot of the RaspiBlitz.*
The RaspiBlitz will now do final setup configuration like installing tools, moving the SWAP file to the HDD or activating the firewall. You will see some text moving across the screen until this screen:
![SSH9b](pictures/ssh9b-reboot.png)
After reboot the RaspiBlitz is showing that the Wallet needs to be unlocked on the LCD and its ready to SSH back in:
The basic setup is done - hooray ... but still prepare for some long waiting time after this before you can play around with your new RaspiBlitz. Press OK to make a reboot. Your terminal session will get disconnected and the raspberry pi restarts.
### First Start: Syncing & Scanning
After the reboot is done it takes a while for all services to start up - wait until you see on the LCD/display that LND wallet needs to get unlocked. Then SSH in again with the same command like in the beginning (check LCD/display) but this time (and every following login) use your PASSWORD A.
After terminal login LND will ask you (like on every start/reboot) to unlock the wallet again - use PASSWORD C:
![SSH9c](pictures/ssh9c-unlock.png)
*Background: The LND wallet needs to get unlocked on every new start of the RaspiBlitz. The status information loop on the LCD is done by the script '00infoBlitz.sh'*
Now on first start you will habe a longer waiting time (between 1 hour and 2-3 days, depending on your initial setup) ... but thats OK, just leave the RaspiBlitz running until its done. You can even close your terminal now and shutdown your laptop and ssh back in later on. You will see on the Blitz LCD/display that it is ready, when the blue backgound screen is gone and you see the status screen like further below.
After SSH back in as admin the main menu shows the unlock option:
To understand what is taking so long .. its two things:
![SSH9d](pictures/ssh9d-unlock.png)
1. Blockchain Sync
Once the wallet is unlocked the setup is finally over and the main menu shows the option and features of the RaspiBlitz:
![SSH9d1](pictures/ssh9d-blockchainsync.png)
![SSH9e1](pictures/ssh9e-mainmenu1.png)
The blockchain on you HDD is not absolutly up-to-date. Depending how you got it transferred to your RaspiBlitz it will be some hours, days or even weeks behind. Now the RaspiBlitz needs to catch-up the rest by directly syncing with the peer-2-peer network until it reaches almost 100%. But even if you see in the beginning a 99.8% this can take time - gaining 1% can be up to 4 hours (depending on network speed). So be patient here.
And if you scroll down .. you see even more feature options:
* [Why is my "final sync" taking so long?](FAQ.md#why-is-my-final-sync-taking-so-long)
![SSH9e2](pictures/ssh9e-mainmenu2.png)
2. LND Scanning
*Background: The script `00mainMenu.sh` is now the place to offer further features und extend the possibilities of the RaspiBlitz. Feel free to come up with ideas. Check out the developer section at the end of this page.*
![SSH9d2](pictures/ssh9d-lndscan.png)
### Features
Automatically if the Blockchain Sync is done LND will start to scan the blockchain and collect information. If you reached this point it should normally just take around 1 hour until the waiting time is over.
You can manually extend your RaspiBlitz with features listed in the RaspiBolt Guide: https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_60_bonus.md
Once all is done you should see this status screen on the RaspiBlitz LCD/display:
Already integrated features of the RaspiBlitz are/will be listed as part of the main menu after connecting via ssh as admin user.
![SSH9dz](pictures/ssh9z-ready.png)
*Background: The script `91addBonus.sh` is the place to put your setup of features you want to add to RaspiBlitz. Its run at the end of the automated setup process before final reboot. To make the feature executable for the user, add a new option to the `00mainMenu.sh`*
### Main Menu
#### Status Infoscreen
If you now login by SSH in your RaspiBlitz (or you are still logged in) you will the the Main Menu:
![feat-info](pictures/feature-info.png)
![SSH9e1](pictures/mainmenu1.png)
#### Detailed Balances and Channel Info
And if you scroll down .. you see even more options. All options of the main menu will be explained below in the feature documentation.
<img src="pictures/bonus-lnbalance.png" alt="bonus-lnbalance" width="600">
*OK .. so from here on your RaspiBlitz is ready to play with.*
<img src="pictures/bonus-lnchannels.png" alt="bonus-lnchannels" width="600">
If you need an idea what the most basic next steps to experience Lightning would be:
#### TOR Integration (experimental)
* Fund on-chain Wallet
* Open a channel
* Make a payment
You can use the Switch to TOR option from the main menu to make the node reachable thru TOR. This way you can get thru a NAT without needed to open/forward ports on your router. Bitcoin and LND will have a seperate onion-address displayed on LCD and the Status Info Screen option in menu.
If you like to do this all from a webbrowser with a dashboard UI instead from an SSH terminal, go to `SERVICES`, activate the `RTL Webinterface` and after the reboot open in your webbrowser: http://[LOCAL-IP-OF-YOU-NODE]:3000 (PASSWORD B is your RPC password).
![tor1](pictures/tor1.png)
Have fun and riding the lightning :D
*BTW always love seeing photos of new RaspBlitzes added to the network on twitter @rootzoll*
* [How can I get further help/support?](#support)
### Feature Documentation
These are the features available thru the RaspiBlitz SSH main menu and services. They have the goal to offer some basic/fallback functionality & configurations to you. More complex or user-friendly tasks are best to be done with wallets, apps and scripts you connect to your Lightning Node via [APIs](#interface--apis) - because you have a full Bitcoin- and Lightning-Node on the RaspiBlitz.
So lets take a look at the SSH main menu (3 pages to scroll down):
![MainMenu-A](pictures/mainmenu1.png)
#### INFO: Raspiblitz Status Screen
This is the screen that gets displayed on the LCD/display. Its useful to call in a remote situation from SSH if you dont have your RaspiBlitz next to you. But also if you want to copy+paste your nodeID or make a screenshot.
![SSH9dz](pictures/ssh9z-ready.png)
*Its not automatically updating. Its just for one-time info.*
* [Why is my bitcoin IP on the display red?](FAQ.md#why-is-my-bitcoin-ip-on-the-display-red)
* [Why is my node address on the display red?](FAQ.md#why-is-my-node-address-on-the-display-red)
* [Why is my node address on the display yellow (not green)?](FAQ.md#why-is-my-node-address-on-the-display-yellow-not-green)
#### FUNDING: Fund your on-chain Wallet
Before you can open channels with other nodes you need to put some coins onto your LND on-chain wallet. Use this option to generate an address to send funds to.
*Reminder: RaspiBlitz & LND is still experimental software. With funding your LND node you accept the risk of loosing funds. So just play with small amounts - something in then area of 20 EUR/USD should be enough to make your first experiences.*
#### CONNECT: Connect to a Peer
Before you can open a channel with another node on the network you need to connect this node as a peer to your node.
Opening a channel with a peer is just optional. Having another node a peer helps your node to receive information about the network thru the gossip protocol. It will help your node to find better routes thru the network.
#### CHANNEL: Open a Channel with Peer
To open a payment channel with another node you can use this option.
The TOR integration is experimental and at the moment there is no way to switch off TOR again.
Find interessting nodes to open channels with on online directories like [1ML.com](https://1ml.com/).
#### Connect to Mobile Wallet
*This is just a very basic shell script. For more usability try the RTL Webinterface (under Services) or connect a (mobile) wallet with your RaspiBlitz.*
There is now the option to connect and control your LND node with the mobile app called "Shango" - choose option in the main menu.
#### SEND: Pay an Invoice/PaymentRequest
![shango1](pictures/shango1.png)
Pay an invoice thru lightning.
#### RaspiBlitz as Backend for BTCPayServer (experimental)
*This is just a very basic shell script. For more usability try the RTL Webinterface (under Services) or connect a (mobile) wallet with your RaspiBlitz.*
BTCPay Server is a solution to be your own payment processor to accept Lightning Payments for your online store: https://github.com/btcpayserver/btcpayserver
#### RECEIVE: Create Invoice/PaymentRequest
You can find setup instructions here: https://goo.gl/KnTzLu
Create an invoice to send to someone or a service to be payed thru lightnig.
Thanks to @RobEdb (ask on twitter for more details) running his demo store with RaspiBlitz: https://store.edberg.eu - buy a picture of [him and Andreas](https://store.edberg.eu/produkt/jag-andreas/) :)
*This is just a very basic shell script. For more usability try the RTL Webinterface (under Services) or connect a (mobile) wallet with your RaspiBlitz.*
#### Public Domain with DynamicDNS
![MainMenu-B](pictures/mainmenu2.png)
This is a way to make your RaspiBlitz publicly reachable from the internet so that other nodes can open channels with you and you can connect with the
#### SERVICES: Activate/Deactivate Services
To do so you can register at an DynamicDomain service like freedns.afraid.org, forward the TCP ports 8333 (Bitcoin/mainnet),9735 (LND Node) & 10009 (LND RPC) from your internet router to the local IP of your RaspiBlitz and then activate unter "Services" the "DynamicDNS" option.
![MainMenu-Services](pictures/mainmenu-services.png)
##### Channel Autopilot
The autopilot is a feature of LND that you can switch on. It automatically uses around half of your your on-chain funds (if available) to open channels with other lightning nodes the autopilot thinks can be useful to improve your payment routes.
##### Testnet
You can switch from mainnet to testnet of your blockchain if you want to try things out and play with free test coins.
Please beware that to might take some time to sync the test blockchain and you need to setup a new lnd testnet wallet during the process.
##### DynamicDNS
This is a way to make your RaspiBlitz publicly reachable from the internet so that other nodes can open channels with you and you can connect with your mobile wallet from outside your local network.
To do so you can register at an DynamicDomain service like freedns.afraid.org and forward the TCP ports ...
* 8333 (Bitcoin/mainnet)
* 9735 (LND Node)
* 10009 (LND RPC)
... from your internet router to the local IP of your RaspiBlitz and then activate unter "Services" the "DynamicDNS" option.
You will be asked for your dynamic domain name such like "mynode.crabdance.org" and you can also optionally set an URL that will be called regularly to update your routers IP with the dynnamic domain service. At freedns.afraid.org this URL is called "Direct URL" under the menu "Dynamic DNS" once you added one.
## Auto-unlock LND on startup
##### Run behind TOR
You can run your Bitcoin- and Lightning-Node as a TOR hidden service - replacing your IP with an .onion-address
![tor1](pictures/tor1.png)
This has some benefits:
* You dont publish your IP running a node so its much harder to resolve your real name and location.
* You tunnel thru the NAT of your router and make Bitcoin and Lightning reachable to all other TOR nodes.
* By using a TOR address it's possible to move the node to a different IPv4 address and keep the existing (=preciously open and funded) channels functional.
But this also comes with the following side effects:
* Mobile wallets dont support connecting over TOR yet
* Lightning nodes that dont run TOR cannot reach you (like behind NAT)
To try it out just switch on the service - you can deactivate later on if its not working for you.
##### RTL Webinterface
The RTL Webinterface is a LND Control Dashboard you can run in your browser with a nice GUI - it offers much more control over your Lightning node than the RaspiBlitu SSH menus. Its recommended to give it a try.
![RTL](pictures/RTL-dashboard.png)
Feedback is welcome by the RTL programmer: https://github.com/ShahanaFarooqui/RTL
##### LND Auto-Unlock
This feature is based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_6A_auto-unlock.md
It can be activated under "Services" -> "Auto-unlock LND". Its recommended to be turned on, when DynamicDNS is used. Because on a public IP change of your router, LND gets restarted automatically and without Auto-Unlock it will stay inactive/unreachbale until you manually unlock it.
But keep in mind that when activated, your Password C will be stored on the RaspiBlitz SD card. That lowers your security in (physical) attack scenarios. On an update you would need to re-enter your password C.
* [When using Auto-Unlock, how much security do I lose?](FAQ.md#when-using-auto-unlock-how-much-security-do-i-lose)
## Get a Debug Report
#### MOBILE: Connect Mobile Wallet
If your RaspiBlitz is not working right and you like to get help from the community, its good to provide more debug information, so other can better diagnose your problem - please follow the following steps to generate a debug report:
This feature should support you in connecting your RaspiBlitz to a mobile wallet on your smartphone.
- ssh into your raspiblitz as admin user with your password A
- If you see the menu - use CTRL+C to get to the terminal
- If your RaspiBlitz is lower then version 0.96 then run: `./XXupdateScripts.sh` first
- To generate debug report run: `./XXdebugLogs.sh`
- Then copy all output beginning with `*** RASPIBLITZ LOGS ***` and share this
<img src="pictures/mobile.png" alt="mobile-wallets">
PLEASE NOTICE: Its possible that this logs can contain private information (like IPs, node IDs, ...) - just share publicly what you feel OK with.
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.
## Build the SD Card Image
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.
A ready to use SD card image of the RaspiBlitz for your RaspberryPi is provided as download by us to get everybody started quickly. But if you want to build that image yourself - here is a quick guide:
* [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)
* Get a fresh Rasbian RASPBIAN STRETCH WITH DESKTOP card image: [DOWNLOAD](https://www.raspberrypi.org/downloads/raspbian/)
* Write image to a SD card: [TUTORIAL](https://www.raspberrypi.org/documentation/installation/installing-images/README.md)
* Add a file called `ssh` to the root of the SD card when mounted to enable SSH login
* Start card in Raspi and login per SSH with `ssh pi@[IP-OF-YOUR-RASPI]` password is `raspberry`
#### EXPORT: Macaroons and TLS.cert
Now you are ready to start the SD card build script - copy the following command into your terminal and execute:
Offers the following options to get the Macaroon and TLS files to be used in other apps and wallets.
`wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh`
*Macaroons: Access Tokens that allow certain command executions on the LND node.*
As you can see from the URL you find the build script in this Git repo under `build.sdcard/raspbianStretchDesktop.sh`- there you can check what gets installed and configured in detail. Feel free to post improvements as pull requests.
*TLS: Certificate to secure/encrypt the communication with the LND node.*
The whole build process takes a while. At the end the LCD drivers get installed and a reboot is needed. A user `admin` is created during the process. Remember the default password is now `raspiblitz`. You can login per SSH again - this time use admin: `ssh admin@[IP-OF-YOUR-RASPI]`. An installer of the SD card image should automatically launch. If you do not want to continue with the installation at this moment, click `Cancel` and simply shutdown with `sudo shutdown now`. Once you see the LCD going white and the activity LED of the pi starts going dark, you can unplug power and remove the SD card. You have now built your own RaspiBlitz SD card image.
<img src="pictures/export.png" alt="export">
*Note: If you plan to use your self build sd card as a MASTER copy to backup image and distribute it. Use a smaller 8GB card for that. This way its ensured that it will fit on every 16 GB card recommended for RaspiBlitz later on.*
##### Hex-String
The Macaroons and TLS.cert files can be copy+pasted as Hex-Strings from RaspiBlitz to any other app that supports that. If you choose this option RaspiBlitz will all files print for you as Hex-String to do so.
And if you are a developer - to build a sd card from the dev-branch use this command to execute:
This method is recommended to export to:
* [Joule Browser Wallet](https://lightningjoule.com)
`wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh 'dev'`
##### SSH Download
## Working with a forked GitHub Repo
SCP is a SSH like command to transfer files. If were able to SSH into the RaspiBlitz also the SCP to transfere the files should work. If you choose these option, RaspiBlitz will print prepared SCP commands you can copy+paste to run in a second terminal.
If you fork the RaspiBlitz repo (much welcome) and you want to run that code on your RaspiBlitz, there are two ways to do that:
This method is recommended to export to:
* [Zap Desktop Wallet](https://github.com/LN-Zap/zap-desktop)
* The quick way: For small changes in scripts, go to `/home/admin` on your running RaspiBlitz, delete the old git with `sudo rm -r raspiblitz` then replace it with your code `git clone [YOURREPO]` and `./XXupdateScripts.sh`
##### Browserdownload
* The long way: If you like to install/remove/change services and system configurations you need to build a SD card from your own code. Prepare like in `Build the SD Card Image` but in the end run the command:
Opens an ad-hoc webserver so that you can download the files in your local network thru the browser.
`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh [BRANCH] [GITHUB-USERNAME]`
*This is a least secure way to transfere those file - everybody in your local network has access to those file during download. Remember with the Admin-Macaroon somebody could takeover your node and spend all your funds. Just use as last fallback.*
## Update to a new SD Card Release
##### Renew Macaroons & TLS
At the beginning of this README you can find the newest SD card we provide. Or you can build the newest SD card image yourself like in the chapter above. The SD card image is used to setup a fresh install of the RaspiBlitz. So what to do if you already have an older version running and you want to upgrade?
Use if you want to invalidate earlier exported Macaroons & TLS files - e.g. lost mobile wallet.
Until we reach version 1.0 the update process will be a bit rough .. so what you do is:
* close all open lightning channels you have (`lncli closeallchannels --force`)
* wait until all closing transactions are done
* move all on-chain funds to a wallet outside raspiblitz (`lncli --conf_target 3 sendcoins [ADDRESS]`)
* run the script `./XXcleanHDD.sh` in admin home directory (Blockchain will stay on HDD)
* shutdown RaspiBlitz (`sudo shutdown now`)
* flash SD card with new image
* Redo a fresh setup of RaspiBlitz
* Move your funds back in
* Re-Open your channels
#### NAME: Change Name/Alias of Node
We know that this is not optimal yet. But until version 1.0 we will change too much stuff to garantue any other save update mechanism. Also by redoing all the setup you help out on testing the lastest setup process.
Change the name of your node.
From the upcomming version 1.0 onwards the goal is to make it easier to keep up with the lastest RaspiBlitz updates.
#### PASSWORD: Change Passwords
## Recover your Coins from a failing RaspiBlitz
Change you passwords for security.
You might run into a situation where your hardware fails or the software starts to act buggy. So you decide to setup a fresh RaspiBlitz, like in the chapter above "Update to a new SD Card Release" - but the closing channels and cashing out is not working anymore. So whats about the funds you already have on your failing setup?
![MainMenu-C](pictures/mainmenu3.png)
There is not a perfect way yet to backup/recover your coins, but you can try the following to make the best out of the situation:
#### CHASHOUT: Remove Funds fro, on-chain Wallet
### 1) Recover from Wallet Seed
Use if the want to remove all funds from the RaspiBlitz.
Remember those 24 words you were writing down during the setup? Thats your "cipher seed" - now this words are important to recover your wallet. If you dont have them anymore: skip this chapter and read option 2. If you still have the cypher seed: good, but read the following carefully:
#### lnbalance: Detailed Wallet Balances
With the cypher seed you can recover the bitcoin wallet that LND was managing for you - but it does not contain all the details about the channels you have open - its just the key to your funding wallet. If you were able to close all channels or never opened any channels, then everything is OK and you can go on. If you had open channels with funds in there, the following is to consider:
<img src="pictures/bonus-lnbalance.png" alt="bonus-lnbalance" width="600">
#### lnchannels: Lightning Channel List
* You now rely on your channel counter parts to force close the channel at one point. If they do, the coins will be available to use in your funding wallet again at one point in the future - after force close delay.
* If your channel counter parts never force close the channel (because they are offline too) your channel funds can be frozen forever.
<img src="pictures/bonus-lnchannels.png" alt="bonus-lnchannels" width="600">
So going this way there is a small risk, that you will not recover your funds. But normally if your channel counter parts are still online, see that you will not come back online and they have themselves some funds on their channel side with you: They have an incentive to force close the channel to make use of their funds again.
#### OFF: PowerOff RaspiBlitz
So here is what todo if you want to "Recover from Wallet Seed" with RaspiBlitz:
A safe way to shutdown the RaspiBlitz. If then a reboot/restart is needed - un/replug the power.
- SetUp a fresh RaspiBlitz (fresh SD-Card image and clean HDD).
- During the new SetUp you get to the point of creating the LND wallet (see image below).
- When you get asked "do you have an existing cypher wallet" answere `y` this time.
- Follow the dialog and enter the cypher seed.
- If you get asked at the end for the password D to encrypt your cypher seed, use the same as the last time. If you havent entered one last time, just press Enter again.
#### X: Console Terminal
![SSH8](pictures/ssh8-wallet.png)
Closes the SSH main menu and exits to the terminal - where the user can make use of the CLI clients `bitcoin-cli` & `lncli` directly to make use of the Bitcoin- and Lightningnode.
With the command `raspiblitz` it's possible to return to the main menu.
## Interface / APIs
To develop your own scripts/apps and to connect other servcies/apps to your RaspiBlitz you have multiple interfaces/APIs available:
### Bitcoin
* `bitcoin-cli` command line interface on the terminal
* `bitcoind` running on port 8333 (public)
* `JSON-RPC` running on port 8332 (local) [DOC](https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29)
### LND-Lightning
* `lncli` command line interface on the terminal [DOC](https://api.lightning.community/)
* `lnd` running on port 9735 (public)
* `gRPC` running on port 10009 (public) [DOC](https://api.lightning.community/)
* `REST` running on port 8080 (public) [DOC](https://api.lightning.community/rest/index.html)
## Updating to new Version
If you have a RaspiBlitz older then verison 0.98 please [see here](FAQ.md).
If you have a RaspiBlitz version 0.98 or newer do the following:
* Main menu > OFF
* Remove power
* Remove SD card
Now download the new RaspiBlitz SD card image and write it to your SD card .. yes you simply overwrite the old one, it's OK, the RaspiBlitz stores all your personal data on the HDD. See details about latest SD card image [here](#installing-the-software).
Then give LND some time to rescan the blockchain. In the end you will have restored your funding wallet. You maybe need to wait for your old channel counter parts to force close the old channels until you see the coins back displayed.
*If you have done manual changes to the system (installed packages, added scripts, etc) you might need to do some preparations before overwriting your sd card - see [FAQ](FAQ.md#why-do-i-need-to-re-burn-my-sd-card-for-an-update).*
### 2) LND Channel State Backup
If done successfully, simply put the SD card into the RaspiBlitz and power on again. Then follow the instructions on the display ... and dont worry, you dont need to re-download the blockchain again.
This second option is very very risky and can lead to complete loss of funds. And it olny can work, if you can still access the HDD content of your failing RaspiBlitz. It should only be used if you lost your cypher seed for the option above, forgot your cypher seed encryption password or your old channel counter parts are offline, too.
* [Why do I need to re-burn my SD card for an update?](FAQ.md#why-do-i-need-to-re-burn-my-sd-card-for-an-update)
## Build the SD Card Image
A ready to use SD card image of the RaspiBlitz for your RaspberryPi is provided as download by us to get everybody started quickly (see above). But if you want to build that image yourself - here is a quick guide:
* Get a fresh Rasbian RASPBIAN STRETCH WITH DESKTOP card image: [DOWNLOAD](https://www.raspberrypi.org/downloads/raspbian/)
* Write image to a SD card: [TUTORIAL](https://www.raspberrypi.org/documentation/installation/installing-images/README.md)
* Add a file called `ssh` to the root of the SD card when mounted to enable SSH login
* Start card in Raspi and login per SSH with `ssh pi@[IP-OF-YOUR-RASPI]` password is `raspberry`
Now you are ready to start the SD card build script - copy the following command into your terminal and execute:
`wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/build_sdcard.sh && sudo bash build_sdcard.sh`
As you can see from the URL you find the build script in this Git repo under `build_sdcard.sh` - there you can check what gets installed and configured in detail. Feel free to post improvements as pull requests.
The whole build process takes a while. At the end the LCD drivers get installed and a reboot is needed. A user `admin` is created during the process. Remember the default password is now `raspiblitz`. You can login per SSH again - this time use admin: `ssh admin@[IP-OF-YOUR-RASPI]`. An installer of the SD card image should automatically launch. If you do not want to continue with the installation at this moment and use this sd card as a template for setting up multiple RaspiBlitze, click `Cancel` and run `/home/admin/XXprepareRelease.sh`. Once you see the LCD going white and the activity LED of the pi starts going dark, you can unplug power and remove the SD card. You have now built your own RaspiBlitz SD card image.
*Note: If you plan to use your self build sd card as a MASTER copy to backup image and distribute it. Use a smaller 8GB card for that. This way its ensured that it will fit on every 16 GB card recommended for RaspiBlitz later on.*
What you do is in priciple:
- Make a copy of the HDD directory "/mnt/hdd/lnd"
- Setup a fresh RaspiBlitz
- Stop LND
- Replace the new "/mnt/hdd/lnd" with your backuped version
- Reboot the RaspiBlitz
* [Can I run RaspiBlitz on other computers than RaspberryPi?](FAQ.md#can-i-run-raspiblitz-on-other-computers-than-raspberrypi)
* [How can I build an SD card other then the master branch?](FAQ.md#how-can-i-build-an-sd-card-other-then-the-master-branch)
* [How can I build an SD card from my forked GitHub Repo?](FAQ.md#how-can-i-build-an-sd-card-from-my-forked-github-repo)
This is highly experimental. And again: If you restore the LND with an backup that is not representing the latest channel state, this will trigger the lightning "penalty" mechanism - allowing your channel counter part to grab all the funds from a channel. Its a measure of last resort. But if its working for you, let us know.
## FAQ
## Mobile Development: Connect RaspiBlitz without a Router/Switch
Here is a just a short selection of the very frequently asked questions:
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:
* [How to backup my Lightning Node?](FAQ.md#how-to-backup-my-lightning-node)
* [How can I recover my coins from a failing RaspiBlitz?](FAQ.md#how-can-i-recover-my-coins-from-a-failing-raspiblitz)
* [Are those "Under-Voltage detected" warnings a problem?](FAQ.md#are-those-under-voltage-detected-warnings-a-problem)
* [Can I run RaspiBlitz on other computer boards than RaspberryPi?](FAQ.md#can-i-run-raspiblitz-on-other-computers-than-raspberrypi)
* connect with LAN directly
* Settings > Sharing/Freigaben > activate "internet sharing" from WLAN to Ethernet
* Settings > Network > Ethernet-Adapter > set to DHCP
* in terminal > `ifconfig` there you should the the IP of the bridge100
* in terminal > `arp -a` and check for an IP of a client to the bridge
* in terminal > ssh admin@[clientIP]
You have still more questions? Check the [RaspiBlitz-FAQ-Archive](FAQ.md).
## Further Development of RaspiBlitz
## Community Development
The RaspiBlitz was developed on the basis of the RaspiBolt Guide to run LND on a RaspberryPi: https://github.com/Stadicus/guides/blob/master/raspibolt - the idea was to prepare as much as possible and have it on a SD-card ready to startup quickly. The configuration should be automated by scripts combined with some very basic user interaction thru the terminal for adminstration. The LCD should provide basic information, so that the health and state of the RaspiBlitz could be monitored with ease. The LCD has also basic touch support and could be used for direct and fast daily interactions.
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`.
The goal of the RaspiBlitz is to provide a out-of-the-box hardware lightning node to learn the basics of being part of the decentralized network and to quickly start building your own applications based on lightning (LApps) - at home or at educational/hacking events. With the well known [GPIO-Pins](https://www.raspberrypi.org/documentation/usage/gpio/) of the RaspberryPi, low-cost entry point and its rich hardware extension ecosystem it seems like the perfect device to foster the communities creativity. Lets keep crypto weird.
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 :)
Everybody is welcome to join, improve and extend the RaspiBlitz - its a work in progress. Check the 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`. More to come.
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 :)
Join me on twitter [@rootzoll](https://twitter.com/rootzoll), visit us at a [#lightninghackday](https://twitter.com/hashtag/LightningHackday?src=hash) in Berlin or drop by the Bitcoin Assembly at the [#35C3](https://twitter.com/hashtag/35C3).
* [How can I get further help/support?](#support)
IRC channel on Freenode `irc://irc.freenode.net/raspiblitz` (unmoderated)

187
WORKSHOP.md

@ -0,0 +1,187 @@
# RaspiBlitz Workshop Tutorial
One goal of the RaspiBlitz project is to provide a open DIY platform for workshops - to setup your own lightning node and learn to manage it. This tutorial is collecting best practices on how to organise a RaspiBlitz workshop.
# Time Planning
First thing on planning a RaspiBlitz workshop is to calculate the time needed correctly. Because the setup from scratch with no further support is still a weekend project - mostly because downloading and syncing the blockchain takes a lot of time.
So it all depends on what you as a workshop organizer provide on prepartion for the workshop participants. Basically you can choose one of the following starting configurations ... going from most prepared to least prepared.
Also the time estimates below are about getting a node to a "clean setup". That is not containing the funding & setting up channels process - which is adding an additional 30 min to 1 hour to the calculation.
Also if your group is lager then 5 participants, calculate some extra time for individual support. You can compensate for that if you let two participants together work on one RaspiBlitz setup - this way you limit individual support and let them help each other.
## A) Provide a Ready-2-Go RaspiBlitz
Estimated Duration: 2 hours
Sure one part of the fun for participents is to assemble the hardware themselves. But if you aim for the shortest workshop possible, by keeping it at around 2 hours lenght, then this is your way to go. Because if you have the RaspiBlitz already assembled to be operational at the workshop, you can utilize one big time saver feature: "The Pre-Sync" - before the workshop starts you can already plug a assembled RaspiBlitz into power+network and when there is a preloaded bitcoin blockchain on the HDD it will already start catching up. So your participants start with a on-the-spot synced blockchain and will just have to deal with waiting times during the lightning node setup. But keep in mind that you need budget to buy all the hardware and lots of time in preparation for this - order the parts two weeks before and start peparing at least 3 days before the workshop.
These are the following steps you need to prepare (follow links for details):
* [Buy all the Hardware](WORKSHOP.md#buy-all-the-hardware)
* [Assemble all the Hardware](WORKSHOP.md#assemble-all-the-hardware)
* [Prepare HDDs with Blockchain Data](WORKSHOP.md#prepare-hdds-with-blockchain-data)
* [Prepare SD cards with latest RaspiBlitz image](WORKSHOP.md#prepare-sd-cards-with-latest-raspiblitz-image)
* [Setup Workshop Environment](WORKSHOP.md#setup-workshop-environment)
* [Pre-Sync RaspiBlitzes at Workshop Location]()
## B) Provide a RaspiBlitz Hardware-Kit
Estimated Duration: 3 hours
In this workshop scenario you buy all the hardware but let participants assemble the RaspiBlitz themselves - thats half the fun and people get a feel for the gear. But to keep the blockchain sync time short and being able to keep in a 3 hour timeframe you need to prepare the HDDs with Blockchain Data not much older than one day. So start ordering the parts minimum one week before the workshop (budget needed) and plan the day before completly for copy blockchain data to all those HDDs.
These are the following steps you need to prepare (follow links for details):
* [Buy all the Hardware](WORKSHOP.md#buy-all-the-hardware)
* [Prepare HDDs with Blockchain Data](WORKSHOP.md#prepare-hdds-with-blockchain-data)
* [Prepare SD cards with latest RaspiBlitz image](WORKSHOP.md#prepare-sd-cards-with-latest-raspiblitz-image)
* [Setup Workshop Environment](WORKSHOP.md#setup-workshop-environment)
Variation: If you dont have a big bugdet to prefinance the part shoppings or people have already hardware they want to bring to can just buy the HHDs and SD cards and prepare them to run this scenario.
## C) Bring your own Hardware
Estimated Duration: 4-6 hours
This scenario is just adviced for small groups or you need to bring multiple blockchain copy stations - see details on "Prepare HDDs with Blockchain Data". Otherwise it needs the least prepartion time and prefinance and can be announced about participants 5 days before, so that they have time to order all the parts online.
* [Instruct Participants to bring Hardware](WORKSHOP.md#instruct-participants-to-bring-hardware)
* [Prepare Blockchain Copy Station](WORKSHOP.md#prepare-blockchain-copy-station)
* [Setup Workshop Environment](WORKSHOP.md#setup-workshop-environment)
Make sure that as early as the participants arrive at the workhop location to check their hardware list and even before official starting time take their HDDs and start the blockchain copy process.
# Checklist for running a Workshop
Make sure you have the following Hardware and Infrastructure ready for the workshop:
- Lots of 'multiple power outlets/extensions' (min. 2 per participants - RaspiBlitz +Laptop)
- Network-Switch with enough ports (min 1 per RaspiBlitz)
- Enough LAN network cables (short ones to connect the RaspiBlitzes)
- Good internet connection at location with LAN port (or a WLAN to LAN adapter)
- Extra WLAN Router (if you are not sure if LAN & WLAN is not on the same network at location)
- One or two USB SD card adapters
- One or two USB-C to USB-A adapters
- Some Tape, Marker & Pens come always handy (also for participants to wirte down seed & passwords)
- And eventually some Bitcoin funds (if people dont have their own to start small funding channels)
Participants need at least to bring their laptops.
# Running of the Workshop
*The basic structure of the workshop is set by the RaspiBlitz setup process. Simply you just follow that. The following parts should share some experiences and suggestions how you can optimize the time and the mentoring during this process. Feel free to share your experience here.*
## Welcome and Intro
In the beginning it would be great to give a small introduction into Lightning and show the RaspiBlitz GitHub page to let everybody know where to find the basic infos. But try to keeo it in the area of 10min to not waste time.
Also even before the intro take care about the blockchain preparation. If people bring clean HDDs hook them up to your blockchain copy station as soon as possible. If you have to copy on location, plan to bringe the time for some deeper educational intro while the HDDs getting prepared.
## Assembling
If you hand out hardware kits or people bring their own hardware its time to put it together. If you are in a ready-2-go scenario of course skip this and just hand them out.
## Basic Setup
Connect everybodies Laptop to the same local network the RaspiBlitzes are connected to. Prepare to explain how to open a terminal - especially windows users need some help here (see README on this).
Then everybody is SSHing into the RaspiBlitz and is following the setup dialog. Hand out paper and pens for people to write down their passwords and the word seed.
## Waiting Time
After the lightning wallet setup you have the longest waiting time during the workshop - around 30min when you have a presynced ready-2-go or up to 1 hour in the other scenarios. Its he time when the node is syncing up the blockchain and LND is scanning. If you see somebodies blockchain progress under 97% something is wrong - possibly the HDD was not correctly preparred or blockchain is way to old to finish during workshop time.
Use this time for a more in-depth educational segment on lightning in general. Also this time can be used to demo with one RaspiBlitz that is already on clean-setup (you prepared before the workshop) how the funding, setting up channels and the other features of the RaspiBlitz work. That way people see what are the next steps once their node is ready and even if your workshop time is over by then they can know the next steps to do at home.
Also this time is good for trouble shooting in individal sessions. If someone is not able to finish the sync on location in time shutdown the Raspiblitz from SSH terminal with CTRL+C and then `shutdown now`. If the device gets connected back up at home it should pickup the sync/scan process (let people know about the wallet unlock).
## Finalizing Setup
Once the RaspiBlitz is ready (LCD shows status screen) and people can SSH into the main menu, let them go into the `SERVICES` section and activate the `RTL WebUI`. Its the best interface to then continue with the peering, funding and channel opening.
## Funding, Channels, API
Check how much time is left to go thru the next steps of connecting to peers, funding and opening channels. While you wait on funding or channel opening confirmations, its a good moment to try to connect users mobile wallets with the device. But just so that on the local network for demo - dynamicDNS is something people then can try at home with port forwarding on theior routers.
Its also nice to add casual social open-end segment to the end of the workshop. So people can already go into personal conversations, music and beverages while some last nodes sync up, confirmations come in and people sending their first satoshis on some lightning chess or from node to node.
# Organisation Tasks
*Which of the follwoing organisation tasks are relevant for you depends on which starting scenario you choose (see above). Here is the complete possible list with details:*
## Buy all the Hardware
See the shopping list on the RaspiBlitz Github README - you need to buy all of those and also dont forget that every participant needs a short (about 1m) network cable.
From experience start ordering two weeks before the workshop (if you need to assembly) and minimum one week if you handing out hardware kits - even if you have Amazon Prime. There is always a shipment comming late - its a lot of packages.
## Instruct Participants to bring Hardware
If you run the scenario of people bringing their own hardware. Make sure to let them know at least a week before the event so that there is enough time for online ordering. Also make sure that especially the power supply needs to provide 3A and a stable current (big fat with a thick cable is good) - because thats the most often error source if people just reuse some old weak power supply.
In all scenarios make sure people bring their laptops.
## Assemble all the Hardware
Basically you follow the assemble instructions on the RaspiBlitz GuitHUb README. Think of a safe way to transport the assambled devices to the workshop location - HHDs like it soft.
## Prepare HDDs with Blockchain Data
This is the most time consuming part of the preparation. Try it once to get a feel for how much time you need to prepare one HDD.
A prepared HDD is formatted in EXT4 and named "BLOCKCHAIN". In folder called `bitcoin` it contains a copy of the following data folders from a running Bitcoin core client (same version on RaspiBlitz).
```
/bitcoin/blocks
/bitcoin/chainstate
/bitcoin/indexes
```
optionaly you can add also the testnet data:
```
/bitcoin/testnet3/blocks
/bitcoin/testnet3/chainstate
/bitcoin/testnet3/indexes
```
The bitcoin core client the folders are from needs to have `txindex=1` in the bitcoin.conf and needs to be stopped while the data is copied to the HDD.
The easiest way to get a "template" of such HDD is to setup a fresh RaspiBlitz (without channel and fundings) and then run the script `/home/admin/XXcleanHDD.sh` and manually delete all rest data from the HDD and just leave those folders.
Once you have that "template" you can make a image from that and write that image to the other HDDs. This works for HDDs that all habe
## Prepare Blockchain Copy Station
At the moment the "Blockchain Copy Station" is just a computer (laptop - not a RaspberryPi) having a image of a "template" HDD (see above) and you can attach (with a USB3.0 Hub) multiple fresh HHDs to it and start writing in the template image to that.
To update the "template" HDD for the next workshop use it for a fresh clean RaspiBllitz setup just days before, sync the blockchain to 100% and repeat the process above.
*This version is not tested, but seems like the easiest to setup so far. Images can have the problem of being too large when some 1TB HDDs are just some bytes smaller. So for the template HDD it would be best to find the smallest 1TB HDD possible or just writing the image to HDDs of the same brand & model.*
Copying the blockchain between RaspberryPis during the workshop is not an option, because the network and its USB2 is too slow and will take 3 to 4 hours.
For former workshops i had a Laptop just with the data and had a script that was formatting and rsyning that data over to a fresh HDD. That took around 1,5 hours per HDD.
*If someone has a better idea for a 'Blockchain Copy Station' - please feel free to contribute.*
## Prepare SD cards with latest RaspiBlitz image
Download the latest RasopiBlitz SD card image from the README page. `Balena Etcher` is the best image writing softare forn thsi usecase because if you have multiple sd card adapters, you can write multiple crads at once - that is cutting down your preperation time.
## Setup Workshop Environment
See hardware checklist what to bring to the workshop in the earlier chapter.
Setup power outlets for everybody. Its always good to be way early at the workshop location for setup, especially if you run the "pre-sync" of the ready-2-go scenario.
Most important is the network setup. Every RaspiBlitz needs a LAN port in the switch and that switch needs to be on the same local network as the WLAN so that participants laptop can SSH into the RaspiBlitz. If that is not the case or you cannot confirm that before the event its best to bring an additional WLAN router. Then you give the WLAN router internet uplink thru the available LAN cable and you put the network switch for the Raspiblitzes behind that router and open an additional WLAN on that WLAN router for everybody to connect to. Its OK to be behind a NAT - its just important for everybody to be behind the same NAT.
## Pre-Sync RaspiBlitzes at Workshop Location
In the ready-2-go scenario you have the RaspiBlitzes already assembled and a recent blockchain copy on the HDD. So one ot two hours before the workshop you setup your environment and already plug all RaspiBlitzes with power & network. You will see on the LCD at the top a pre-sync info and progress .. if its something '99.99..' its good to go. Just leave it running until the workshop starts. You dont need to stop it - just let participents SSH in and they can to the setup.
Its also best practice that you pre-sync all devices before you move them over to the workshop location. You dont need to SSH to shut them down before packing up - just unplug the network cable first, wait until the HDD is stopping to flash and then remove the power.

153
background_downloadBlockchain.md

@ -1,153 +0,0 @@
# Background: Blockchain Download
## Why do we need to download the blockchain and not syncing it?
The RaspiBlitz is powered by the RaspberryPi. The processing power of this SingleBoardComputer is too low to make a fast sync of the blockchain from the bitcoin peer to peer network during setup process (validation). To sync and index the complete blockchain could take weeks or even longer. Thats why the RaspiBlitz needs to download a prepared blockchain from another source.
## Is downloading the blockchain secure?
The downloaded Blockchain is pre-indexed and pre-validated. That is secure enough because if the user gets a "manipulated" blockchain it would not work after setup. The beginning of the downloaded blockchain needs to fit the genesis block (in bitcoind software) and the end of the downloaded blockchain needs not match with the rest of the bitcoin network state - hashes of new block distrubuted within the peer-2-peer network need to match the downloaded blockchain head. So if you downloaded a manipulated blockchain it would simply just dont work in practice.
There might be theoretical scenarios why it would be bad for the whole network if anybody is downloading a prepared blockchain and not syncing and self-validating every block, but with a lot of self-validating full nodes already out there, just putting some RaspiBlitz with a downloaded blockchain into the mix and runnig as a self-valifating full node from that point on, is practically just strengthening the the overall network. And dont forget, the most important part of running a full node is to validate the new blocks summited by the miners - to balance out there power and to keep the Bitcoin network running by our rules.
If you have any link to a more detailed discussion of this topic, please add it here for people to do their own research.
## Blockchain Data
The RaspiBlitz needs the following files from a bitcoind (>=0.17.0) that is fully sync and has indexing switched on (txindex=1) - all files from the directories:
```
/blocks
/chainstate
/indexes
```
Make sure not to add other files like wallet data or lock files to a prepared download.
You might want to include the testnet data also - then add the testnet3 folder that just contains the same three folders from the testnet blockchain.
On download all those files need to be placed finally in the /mnt/hdd/bitcoin folder of the RaspiBlitz.
## Download Process
At the moment the RaspiBlitz offers two technical ways to download the blockchain:
### FTP Download (fallback)
The easiest way is to put the blockchain data on a FTP server and let people download it. FTP is able to download complete directories - HTTP can just handle single file. FTP clients and server hosting is widly available.
The downside that this is a central point solution and is hard to scale up (without spending a lot of money). But it is available as a backup, if other solutions do not work.
### Torrent Download (default)
The preferred way is to to download the blockchain data thru the peer2peer torrent network. This way the community can help to seed the torrents (at least while downloading). Supporters of the project can setup constant seeding. There is no single point of failure within the download structure.
In the beginning we used just on torrent file - containing all the directories and data like mentioned above. But this had the downside, that everytime when we update the torrent the seeding is bad in the beginning and downloads are slow. Good seeding needs time to build up.
Thats why there are two torrent files now:
#### Base Torrent File
Inspired by the website getbitcoinblockchain.com we use one of their base torrent files to have a basic set of blocks - that will not change for the future. This torrent contains most of the data (the big file) and we dont need to change the torrent for a long time. This way the torrent can get establish a wide spread seeding and the torrent network can take the heavy load.
At the moment this is just the bitcoin blk and rev files up to the number:
- /blocks : 01390
- /testnet3/blocks: 00152
For litecoin its blk and rev files up to the number:
- /blocks : 00124
#### Update Torrent File (Description)
All the rest of the files get packaged into a second torrent file. This file will be updated much more often. The seeding is expected to be not that good and download may be slower, but thats OK because its a much smaller file.
This way a good balance between good seeding and up-to-date blockchain can be reached.
#### Update Torrent File (Creation)
To create the Update Torrent file, follow the following step ...
Have a almost 100% synced bitcoind MAINNET with txindex=1 on a RaspiBlitz
Stop bitcoind with:
```
sudo systemctl stop bitcoind
```
Delete base torrent blk-files with:
```
sudo rm /mnt/hdd/bitcoin/blocks/blk00*.dat
sudo rm /mnt/hdd/bitcoin/blocks/blk0{1000..1390}.dat
```
Delete base torrent rev-files with:
```
sudo rm /mnt/hdd/bitcoin/blocks/rev00*.dat
sudo rm /mnt/hdd/bitcoin/blocks/rev0{1000..1390}.dat
```
Now change to your computer where you package the torrent files and transfere the three directories into your torrent base directory (should be your current working directory):
```
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/blocks ./blocks
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/chainstate ./chainstate
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/indexes ./indexes
```
Also have a almost 100% synced bitcoind TESTNET with txindex=1 on a RaspiBlitz
Stop bitcoind with:
```
sudo systemctl stop bitcoind
```
Delete base torrent blk-files with:
```
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/blk000*.dat
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/blk00{100..152}.dat
```
Delete base torrent rev-files with:
```
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/rev000*.dat
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/rev00{100..152}.dat
```
Now change again to your computer where you package the torrent files and transfere the three directories into your torrent base directory (should be your current working directory):
```
mkdir testnet3
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/blocks ./testnet3/blocks
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/chainstate ./testnet3/chainstate
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/indexes ./testnet3/indexes
```
(Re-)name the "torrent base directory" to the same name as the torrent UPDATE file itself later (without the .torrent ending). For the correct naming see the chapter "Torrent Files Naming Schema" below.
Now open your torrent client (e.g. qTorrent for OSX) and create a new torrent-file with the freshly renamed "torrent base directory" as source directory.
Add this list of trackers to your torrent and start seeding (keep a free/empty line between the three single trackers):
```
udp://tracker.justseed.it:1337
udp://tracker.coppersurfer.tk:6969/announce
udp://open.demonii.si:1337/announce
udp://denis.stalker.upeer.me:6969/announce
```
Name the new torrent file
To create the torrent file can take some time. Finally add the generated torrent file to the /home.admin/assets/ of the github and change the name of the updateTorrent varibale file in the script 50torrentHDD.bitcoin.sh
#### Torrent Files Naming Schema
The base torrent file should always have the following naming scheme:
`raspiblitz-[CHAINNETWORK][BASEITERATIONNUMBER]-[YEAR]-[MONTH]-[DAY]-base.torrent`
So for example the second version of the base torrent for litecoin created on 2018-10-31 would have this name: raspiblitz-litecoin2-2018-10-31-base.torrent
The update torrentfile should always have the following naming schema:
`raspiblitz-[CHAINNETWORK][BASEITERATIONNUMBER]-[YEAR]-[MONTH]-[DAY]-update.torrent`
So for exmaple an update torrent created on 2018-12-24 for litecoin that is an update to the second base torrent version would have this name: raspiblitz-litecoin2-2018-12-24-update.torrent

43
background_raspiblitzSettings.md

@ -1,43 +0,0 @@
# Background: RaspiBlitz Settings
## Before Version 1.0
The RaspiBlitz started as small collection of shell scripts to setup a bitcoin+lightning node. At this time it was not needed to have settings file. The idea was that the scripts analyse the system state and make the changes required - automatically trying to catch up. That was OK as long RaspiBlitz was just a helper to setup your Lightning node and the rest was up to you.
Over time users that are running a RaspiBlitz expected that it can handle more complex setup and customization. Also it should be easy to update the system (exchange sd card with a newer image) and should be able to have the same configuration afterwards - keeping its state. Thats why starting from version 1.0 there will be a raspiblitz config file stored on the HDD that stores stores the config state.
## The Config File
The RaspiBlitz config file is stored on the HDD root:
`/mnt/hdd/raspiblitz.conf`
Its simple structure is: one key-value pair per line. In the end its bash-script syntax to define varibales. The RaspiBlitz shell scripts can import this file with:
`source /mnt/hdd/raspiblitz.conf`
After this line all the config values are available and can be worked with. I prefer to call this line in scripts explicitly and not setting this values as environment variables, because when you read as a newbie such a script, you get an idea where the config file is stored.
## The Config Values
So see what config parameters are available check the comments in the following script:
`/home/admin/_bootstrap.sh`
## Adding new Config Values
If you extend the RaspiBlitz scripts and you have the need to add a new config key-value add it to the `/home/admin/00enforceConfig.sh` script. There is a section for default values and setting them in the config file, if they dont exist there yet. Because this script runs on every startup, you can be sure that the default value is then available to your extended script - especially if people update their system.
## Bootstrap Service: Enforcing the Config
On every start of the RaspiBlitz take the config file and check if the system is running as stated in the config file and when needed make changes to the system. This is done by calling this script on startup with systemd:
`/home/admin/_bootstrap.sh`
So if you change the config by hand or you write a script that changes the config, then simply trigger a restart the RaspiBliz.
Having this script checking the system on every startup, the user can easily update the SD card with a fresh image and the system will automatically establish the old state.
## What to put into the config file and what not
All values users put into setup or setting dialogs and that is not stored on the HDD (for example in the config files of lnd or bitcoin) is a hot cadidate to put into the raspi config file. Some values make sense to get stored as a duplicate (for performance or easy of access) - but dont get to wild.

240
build.sdcard/raspbianStretchDesktop.sh → build_sdcard.sh

@ -4,13 +4,15 @@
# RASPBIAN STRETCH WITH DESKTOP (2018-11-13)
# https://www.raspberrypi.org/downloads/raspbian/
# SHA256: a121652937ccde1c2583fe77d1caec407f2cd248327df2901e4716649ac9bc97
#
# or download the image for your ARM based SBC on https://DietPi.com
##########################################################################
# setup fresh SD card with image above - login per SSH and run this script:
##########################################################################
echo ""
echo "*****************************************"
echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.99 *"
echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.1 *"
echo "*****************************************"
echo ""
@ -25,7 +27,7 @@ echo "will use code from branch --> '${wantedBranch}'"
# 2nd optional parameter is the GITHUB-USERNAME to get code from when
# provisioning sd card with raspiblitz assets/scripts later on
# if 2nd paramter is used - 1st is mandatory
# if 2nd parameter is used - 1st is mandatory
echo "*** CHECK INPUT PARAMETERS ***"
githubUser="$2"
if [ ${#githubUser} -eq 0 ]; then
@ -69,6 +71,11 @@ else
echo "OK running ${baseImage}"
fi
# setting static DNS server
# see https://github.com/rootzoll/raspiblitz/issues/322#issuecomment-466733550
sudo sed -i "s/^#static domain_name_servers=192.168.0.1*/static domain_name_servers=1.1.1.1/g" /etc/dhcpcd.conf
systemctl daemon-reload
# fixing locales for build
# https://github.com/rootzoll/raspiblitz/issues/138
# https://daker.me/2014/10/how-to-fix-perl-warning-setting-locale-failed-in-raspbian.html
@ -92,13 +99,27 @@ sudo apt-get upgrade -f -y --allow-change-held-packages
if [ "${baseImage}" = "dietpi" ]; then
echo ""
echo "*** PREPARE DietPi ***"
echo "renaming dietpi user ti pi"
echo "renaming dietpi user to pi"
sudo usermod -l pi dietpi
echo "install pip"
sudo apt-get update
sudo apt-get remove -y fail2ban
sudo apt-get install -y build-essential
sudp apt-get install -y python-pip
sudo apt-get install -y python-pip
# rsync is needed to copy from HDD
sudo apt install -y rsync
# install ifconfig
sudo apt install -y net-tools
#to display hex codes
sudo apt install -y xxd
# setuptools needed for Nyx
sudo pip install setuptools
# netcat for 00infoBlitz.sh
sudo apt install -y netcat
# install OpenSSH client + server
sudo apt install -y openssh-client
sudo apt install -y openssh-sftp-server
fi
# special prepare when Raspbian
@ -111,6 +132,8 @@ if [ "${baseImage}" = "raspbian" ]; then
sudo raspi-config nonint do_boot_wait 0
# set WIFI country so boot does not block
sudo raspi-config nonint do_wifi_country US
# see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840
echo "max_usb_current=1" | sudo tee -a /boot/config.txt
# extra: remove some big packages not needed
sudo apt-get remove -y --purge libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi minecraft-pi python-pygame
sudo apt-get clean
@ -132,6 +155,75 @@ sudo bash -c "echo '[Service]' >> /etc/systemd/system/getty@tty1.service.d/autol
sudo bash -c "echo 'ExecStart=' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf"
sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf"
# change log rotates
# see https://github.com/rootzoll/raspiblitz/issues/394#issuecomment-471535483
echo "/var/log/syslog" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 7" >> ./rsyslog
echo " daily" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
echo "" >> ./rsyslog
echo "/var/log/mail.info" >> ./rsyslog
echo "/var/log/mail.warn" >> ./rsyslog
echo "/var/log/mail.err" >> ./rsyslog
echo "/var/log/mail.log" >> ./rsyslog
echo "/var/log/daemon.log" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 4" >> ./rsyslog
echo " size=100M" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " sharedscripts" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
echo "" >> ./rsyslog
echo "/var/log/kern.log" >> ./rsyslog
echo "/var/log/auth.log" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 4" >> ./rsyslog
echo " size=100M" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " sharedscripts" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
echo "" >> ./rsyslog
echo "/var/log/user.log" >> ./rsyslog
echo "/var/log/lpr.log" >> ./rsyslog
echo "/var/log/cron.log" >> ./rsyslog
echo "/var/log/debug" >> ./rsyslog
echo "/var/log/messages" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 4" >> ./rsyslog
echo " weekly" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " sharedscripts" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
sudo mv ./rsyslog /etc/logrotate.d/rsyslog
sudo chown root:root /etc/logrotate.d/rsyslog
sudo service rsyslog restart
echo ""
echo "*** SOFTWARE UPDATE ***"
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#software-update
@ -139,6 +231,21 @@ echo "*** SOFTWARE UPDATE ***"
# installs like on RaspiBolt
sudo apt-get install -y htop git curl bash-completion jq dphys-swapfile
# installs bandwidth monitoring for future statistics
sudo apt-get install -y vnstat
# prepare for BTRFS data drive raid
sudo apt-get install -y btrfs-tools
# prepare for display graphics mode
# see https://github.com/rootzoll/raspiblitz/pull/334
sudo apt-get install -y fbi
# prepare dor display service
# see https://github.com/rootzoll/raspiblitz/issues/88#issuecomment-471342311
sudo apt-get install -y redis-server
sudo -H pip3 install redis
echo ""
echo "*** ADDING MAIN USER admin ***"
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#adding-main-user-admin
@ -224,11 +331,14 @@ then
echo "!!! FAIL !!! Download laanwj-releases.asc not success."
exit 1
fi
gpg ./laanwj-releases.asc
fingerprint=$(gpg ./laanwj-releases.asc 2>/dev/null | grep "${laanwjPGP}" -c)
if [ ${fingerprint} -lt 1 ]; then
echo ""
echo "!!! BUILD FAILED --> Bitcoin download PGP author not OK"
exit 1
echo "!!! BUILD WARNING --> Bitcoin PGP author not as expected"
echo "Should contain laanwjPGP: ${laanwjPGP}"
echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
read key
fi
gpg --import ./laanwj-releases.asc
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc
@ -293,8 +403,8 @@ echo ""
echo "*** LND ***"
## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd
lndVersion="0.5.1-beta"
lndSHA256="c8be77708fe95d5076fa6988229100598c14ae6c54e92a56d5f09f3e17732244"
lndVersion="0.5.2-beta"
lndSHA256="9adf9f3d0b8a62942f68d75ffe043f9255319209f751dee4eac82375ec0a86cd"
olaoluwaPGP="BD599672C804AF2770869A048B80CD2BB8BD8132"
# get LND resources
@ -313,11 +423,14 @@ if [ "${binaryChecksum}" != "${lndSHA256}" ]; then
fi
# check gpg finger print
gpg ./pgp_keys.asc
fingerprint=$(gpg ./pgp_keys.asc 2>/dev/null | grep "${olaoluwaPGP}" -c)
if [ ${fingerprint} -lt 1 ]; then
echo ""
echo "!!! BUILD FAILED --> LND download author PGP not OK"
exit 1
echo "!!! BUILD WARNING --> Bitcoin PGP author not as expected"
echo "Should contain olaoluwaPGP: ${olaoluwaPGP}"
echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
read key
fi
gpg --import ./pgp_keys.asc
sleep 3
@ -437,13 +550,23 @@ sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
# bash aoutstart for admin
# add /sbin to path for all
sudo bash -c "echo 'PATH=\$PATH:/sbin' >> /etc/profile"
# profile path for admin
sudo bash -c "echo '' >> /home/admin/.profile"
sudo bash -c "echo 'GOROOT=/usr/local/go' >> /home/admin/.profile"
sudo bash -c "echo 'PATH=\$PATH:\$GOROOT/bin' >> /home/admin/.profile"
sudo bash -c "echo 'GOPATH=/usr/local/gocode' >> /home/admin/.profile"
sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/bin' >> /home/admin/.profile"
# bash autostart for admin
sudo bash -c "echo '# shortcut commands' >> /home/admin/.bashrc"
sudo bash -c "echo 'source /home/admin/_commands.sh' >> /home/admin/.bashrc"
sudo bash -c "echo '# automatically start main menu for admin' >> /home/admin/.bashrc"
sudo bash -c "echo './00mainMenu.sh' >> /home/admin/.bashrc"
# bash aoutstart for pi
# bash autostart for pi
# run as exec to dont allow easy physical access by keyboard
# see https://github.com/rootzoll/raspiblitz/issues/54
sudo bash -c 'echo "# automatic start the LCD info loop" >> /home/pi/.bashrc'
@ -475,27 +598,21 @@ sudo chmod +x /home/admin/_bootstrap.sh
sudo cp ./assets/bootstrap.service /etc/systemd/system/bootstrap.service
sudo systemctl enable bootstrap
# *** BOOTSTRAP ***
# see background README for details
# *** BACKGROUND ***
echo ""
echo "*** RASPI BACKGROUND SERVICE ***"
sudo chmod +x /home/admin/_background.sh
sudo cp ./assets/background.service /etc/systemd/system/background.service
sudo systemctl enable background
# Prepare for TOR service
echo "*** Adding Tor Sources to sources.list ***"
echo "deb http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
# *** TOR Prepare ***
echo "*** Prepare TOR source+keys ***"
sudo /home/admin/config.scripts/internet.tor.sh prepare
echo ""
echo "*** Installing dirmngr ***"
sudo apt install dirmngr
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "If you see fails above .. please run again later on:"
echo "sudo /home/admin/config.scripts/internet.tor.sh prepare"
echo ""
echo "*** Fetching GPG key ***"
sudo gpg --keyserver keys.gnupg.net --recv 886DDD89
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
echo "!!!!!! Please check if the above really worked!"
# *** RASPIBLITZ IMAGE READY ***
echo ""
@ -509,20 +626,30 @@ echo ""
echo "Maybe take the chance and look thru the output above if you can spot any errror."
echo ""
echo "After final reboot - your SD Card Image is ready."
echo "Press ENTER to install LCD and reboot ..."
read key
echo ""
echo "IMPORTANT IF WANT TO MAKE A RELEASE IMAGE FROM THIS BUILD:"
echo "login once after reboot without HDD and run 'XXprepareRelease.sh'"
echo ""
echo "to continue reboot with sudo shutdown -r now and login with admin"
# give Raspi a default hostname (optional)
sudo raspi-config nonint do_hostname "RaspiBlitz"
# install LCD only on an rPI running Raspbian
if [ "${baseImage}" = "raspbian" ]; then
echo "Press ENTER to install LCD and reboot ..."
read key
# *** Display selection ***
dialog --title "Display" --yesno "Are you using the default display available from Amazon?\nSelect 'No' if you are using the Swiss version from play-zone.ch!" 6 80
defaultDisplay=$?
# give Raspi a default hostname (optional)
sudo raspi-config nonint do_hostname "RaspiBlitz"
# *** Display selection ***
dialog --title "Display" --yesno "Are you using the default display available from Amazon?\nSelect 'No' if you are using the Swiss version from play-zone.ch!" 6 80
defaultDisplay=$?
if [ "${defaultDisplay}" = "0" ]; then
if [[ $defaultDisplay -eq 0 ]]
then
# *** RASPIBLITZ / LCD (at last - because makes a reboot) ***
# based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip
echo "--> LCD DEFAULT"
cd /home/admin/
sudo apt-mark hold raspberrypi-bootloader
git clone https://github.com/goodtft/LCD-show.git
@ -530,40 +657,45 @@ then
sudo chown -R admin:admin LCD-show
cd LCD-show/
sudo ./LCD35-show
else
else
# Download and install the driver
# based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps
echo "--> LCD ALTERNATIVE"
cd /boot
sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin
sudo mv dt-blob-For-3B-plus.bin dt-blob.bin
cat <<EOF >> config.txt
dtparam=spi=off
dtparam=i2c_arm=off
dtparam=spi=off
dtparam=i2c_arm=off
# Set screen size and any overscan required
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0
framebuffer_width=800
framebuffer_height=480
# Set screen size and any overscan required
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0
framebuffer_width=800
framebuffer_height=480
enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x6f015
enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x6f015
# set up the size to 800x480
hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6
# set up the size to 800x480
hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6
#rotate screen
display_rotate=3
#rotate screen
display_rotate=3
dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23
dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23
fi
EOF
init 6
fi
fi

BIN
case.3dprint/standard/RaspiBlitz_Standard_Bottom.stl

Binary file not shown.

BIN
case.3dprint/standard/RaspiBlitz_Standard_Top.stl

Binary file not shown.

126
dietpi/Odroid_HC1_HC2.md

@ -0,0 +1,126 @@
# ⚡️ RaspiBlitz-on-DietPi ⚡️
# For the Odroid HC1 / HC2 / XU3 / XU4
![](pictures/DroidBlitz.jpg)
## There are 3 options provided:
* a trusted fully prebuilt SDcard image
* building your own SDcard from an updated DietPi image.
* Build your own SDcard from the image downloaded from [Dietpi.com](dietpi.com#download)
---
### Download the fully prebuilt RaspiBlitz-on-DietPi SDcard image
* [torrent](https://github.com/openoms/raspiblitz/blob/raspiblitz-dev/dietpi/RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.torrent)
* [mega.nz link](https://mega.nz/#F!EVNAAQiB!ZyLHP2dJMRSVjZOTCQMIYA)
sha256sum RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.img: 96ee8700f52a12fb5b13fab3fffcdcf5d364c6dd16c580d969e421cef2cd7cc2
Steps to run:
- download the .img file,
- burn to a 16 GB SD with [Etcher](https://www.balena.io/etcher/)
- extend the rootFS partition with a partition manager (disks, Gparted, etc.)
- boot the Odroid with the SDcard
- login with `ssh admin@at.your.raspiblitz.ip`
password: `raspiblitz`
Using this image you can skip the rest of this guide as it is mostly about how this image was built.
The setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation)
---
### Download the updated DietPi image
For the Odroid HC1 / HC2 / XU3 / XU4 a v6.20.6 DietPi image with fail2ban installed is uploaded [here](
https://mega.nz/#!AcdVBAbR!O-W3jP5LUgw7lMY8S9XcBWcKX3IhRNAAFmaYzDXIUC0).
sha256sum DietPi_v6.20.6_OdroidXU4-ARMv7-Stretch.img:
1459b91f66b9db98f3437c31231e44497b7b7dcd9146d2cc41a3da653f9a9215
* Burn the image to the SDCard with [Etcher](https://www.balena.io/etcher/) and extend the rootfs partition to the size of your card with a partition manager (disks, Gparted, etc).
* Insert the SDcard into the Odroid.
* Power up and continue with [running the RaspiBlitz build_sdcard.sh script](#Run-the-RaspiBlitz-build_sdcard.sh-script)
---
### Build your own DietPi image:
Watch out this is an ardous process.
Updating from a v6.14 DietPi image is causing a bootloop under some circumstances. Will be sorted once the current, >6.2 version is uploaded for the Odroids.
* For the Odroid HC1 / HC2 / XU3 / XU4 the start is this image:
https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z
* Burn it to the SD with [Etcher](https://www.balena.io/etcher/)
* In the desktop terminal on Linux / MacOS or Putty on Windows:
`ssh root@[IP-OF-DIETPI]`
password: `dietpi`
Getting started with DietPi: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9
* Ok > Cancel > Cancel
automatic apt update & apt upgrade and asks to reboot
![](pictures/dietpi_1st_reboot.png)
* Log back in:
`ssh root@[IP-OF-DIETPI]`
password: `dietpi`
* after the update the ssh keys might change:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
run (can be copied from the terminal output):
`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"`
`ssh root@[IP-OF-DIETPI]`
yes >
password: `dietpi`
* At this point if the DietPi OS was not updated from 6.14 it does not manage to save settings going forward.
Exit the software installer (press Tab to jump to Exit)
![](pictures/dietpi-software_exit.png)
* in the bash prompt run:
`dietpi-update`
Ok > Cancel the recovery point
update > Opt out of survey > Ok
Reboots
* Log back in:
`ssh root@[IP-OF-DIETPI]`
password: `dietpi`
* In the DietPi software menu install fail2ban and make OpenSSH server the default SSH server.
Ok > Cancel > Cancel
Search `fail2ban` > Space to select > Enter
SSH server > switch from Dropbear to the OpenSSH-server
Install > Ok
Opt out of survey > Ok
Reboots again
* Log back in:
`ssh root@[IP-OF-DIETPI]`
password: `dietpi`
Changing the SSH server will change the SSH keys again. To clear:
`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"`
### Run the RaspiBlitz build_sdcard.sh script
* Format of the command to build the SDcard:
`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]`
If you are working from a forked repo be aware of that the fork needs to be called `raspiblitz` for the git downloads to work.
* Run the forked version of @openoms:
`wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build_sdcard.sh && sudo bash build_sdcard.sh raspiblitz-dev openoms`
This will take a couple minutes depending on your internet ceonnection and the processing power of the SBC.
* Restart when done and log back in now as `admin`:
`ssh admin@[IP-OF-DROIDBLITZ]`
password: `raspiblitz`
* From here he setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation)
---
### Examples of copying the blockchain data from a HDD using a powered USB to SATA adapter
![example setup](pictures/HDD_copy_example.jpg)
![](pictures/adapterHDD_HC1.jpg)

126
dietpi/README.md

@ -0,0 +1,126 @@
# ⚡️ RaspiBlitz-on-DietPi ⚡️
# A hardware agnostic platform
This guide was tested on:
* Odroid HC1
* Odroid HC2 (the same board except it accommodates a 3.5" 12V HDD)
* Raspberry Pi 3 B Plus - no LCD support so far
* hoping to extend this list with more compatible boards especially the ROCK64
See the [hardware comparison](hw_comparison.md).
---
### Downloads and walkthrough for the [Odroid HC1 / HC2 / XU3 / XU4](Odroid_HC1_HC2.md)
---
## General guide for the RaspiBlitz-on-DietPi
### Setting up the DietPi OS
Getting started with DietPi: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9
* Start with an ARM based Single Board Computer listed on DietPi.com.
At least 1GB RAM is recommended.
Look for the SD card image for the specific SBC in the [download section](https://dietpi.com/#download).
* Burn the image to the SDCard with [Etcher](https://www.balena.io/etcher/) and extend the rootfs partition to the size of your card with a partition manager.
* Insert the SDcard into your SBC.
* Connect the HDD with a powered suitably powered adapter.
A USB 2.0 port will not be able to power an HDD so you will need extra cable
If you are connecting the HDD to a USB 3.0 port and have an at least 2A power supply, you might be able to run without an extra cable.
* Power up and log in with the desktop terminal on Linux / MacOS or Putty on Windows:
`ssh root@[IP-OF-DIETPI]`
password: `dietpi`
* You might be asked about updating DietPi. This is not a straightforward process if starting from a version <6.20. Try to update, it is best to build on the latest version.
* In the DietPi software menu install `fail2ban` and make `OpenSSH server` the default SSH server.
Changing the SSH server will change the SSH keys again. To clear:
`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"`
* After every reboot log back in:
`ssh root@[IP-OF-DIETPI]`
password: `dietpi`
* Should end up here on version v6.20.6 or higher:
![](pictures/bash_prompt.png)
### Run the RaspiBlitz build_sdcard.sh script
* Use this format to build the SDcard with the Raspiblitz script:
`wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]`
If you are working from a forked repo be aware of that the fork needs to be called `raspiblitz` for the git downloads to work.
* Run the forked version of @openoms:
`wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build_sdcard.sh && sudo bash build_sdcard.sh raspiblitz-dev openoms`
This will take a couple minutes depending on your internet connection and the processing power of the SBC.
* Restart when done and log back in now as `admin`:
`ssh admin@[IP-OF-DROIDBLITZ]`
password: `raspiblitz`
* From here he setup continues with the [RaspiBlitz Setup Process](https://github.com/rootzoll/raspiblitz/blob/master/README.md#setup-process-detailed-documentation)
---
### Useful commands for debugging:
To test a new configuration run XXcleanHDD.sh and strictly restart
(this makes _bootstrap.sh and 00mainMenu.sh run in the right order)
`tail -n1000 -f /var/tmp/dietpi/logs/dietpi-automation_custom_script.log` follow startup setup script log
`lsblk` see the partitions
`tail -n1000 -f raspiblitz.log` - debug logs of bootstrap.sh
`sudo tail -f /mnt/hdd/bitcoin/debug.log` - continuous monitoring
`sudo tail -n100 /mnt/hdd/bitcoin/debug.log` - shows the last 100 lines
`sudo systemctl status lnd`
`sudo journalctl -f -u lnd`
`./home/admin/XXdebugLogs.sh` - debug log collection on the RaspiBlitz
---
## Excerpts from the default [dietpi.txt](https://github.com/Fourdee/DietPi/blob/master/dietpi.txt)
to be used for a fully automatic SDcard building process.
### Automate installation with the dietpi.txt
Need to copy to SDcard /boot/dietpi.txt after burning the image with Etcher.
IMPORTANT:
- Modifications to /boot/dietpi.txt will not be preserved on reboot.
- Please ensure you edit from the DietPi-RAMdisk location: /DietPi/dietpi.txt
NB: This is intended for advanced users, unless you know what you are doing, do not edit this file. ease use the DietPi programs instead.
NB: Do not remove uncommented lines, as the items are scraped by DietPi programs, on demand.
DietPi-Automation settings, applied on the 1st boot of DietPi, ONCE
Sample:
https://github.com/Fourdee/DietPi/blob/master/dietpi.txt
### DietPi-Software to automatically install.
Requires `AUTO_SETUP_AUTOMATED=1 `
For a list of software index's (ID's), run '/DietPi/dietpi/dietpi-software list'
No limit on number entries, add as many as you need and uncomment the line.
DietPi will automatically install all pre-reqs (eg: ALSA/XSERVER for desktops etc)
>install fail2ban
AUTO_SETUP_INSTALL_SOFTWARE_ID=73
install OpenSSH Client
AUTO_SETUP_INSTALL_SOFTWARE_ID=0
install OpenSSH Server
AUTO_SETUP_INSTALL_SOFTWARE_ID=105
### Custom Script (post-networking and post-DietPi install)
Runs after DietPi installation is completed
Allows you to automatically execute a custom script at the end of DietPi installation.
Option 1 = Copy your script to /boot/Automation_Custom_Script.sh and it will be executed automatically.
Option 2 = Host your script online, then use AUTO_SETUP_CUSTOM_SCRIPT_EXEC=http://myweb.com/myscript.sh, it will be downloaded and executed automatically. | 0=disabled
NB: Executed script log /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
### Guide to clone your SD-cards in Windows, MacOS and Linux and shrink the image in Linux:
https://beebom.com/how-clone-raspberry-pi-sd-card-windows-linux-macos/

262
dietpi/RaspiBlitz1.0_OdroidHC1_DietPi6.21.1.torrent

File diff suppressed because one or more lines are too long

1
dietpi/boot/Automation_Custom_Script.sh

@ -0,0 +1 @@
wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh raspiblitz-dev openoms

264
dietpi/boot/dietpi.txt

@ -0,0 +1,264 @@
# IMPORTANT:
# - Modifications to /boot/dietpi.txt will not be preserved on reboot.
# - Please ensure you edit from the DietPi-RAMdisk location: /DietPi/dietpi.txt
# NB: This is intended for advanced users, unless you know what you are doing, do not edit this file. Please use the DietPi programs instead.
# NB: Do not remove uncommented lines, as the items are scraped by DietPi programs, on demand.
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Automation settings, applied on the 1st boot of DietPi, ONCE
#------------------------------------------------------------------------------------------------------
##### Networking Options #####
# If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled.
# 1=enabled
AUTO_SETUP_NET_ETHERNET_ENABLED=1
AUTO_SETUP_NET_WIFI_ENABLED=0
# If using WiFi, please edit the following to pre-enter creds /boot/dietpi-wifi.txt
# Enter your Static Network details below, if applicable.
AUTO_SETUP_NET_USESTATIC=0
AUTO_SETUP_NET_STATIC_IP=192.168.0.100
AUTO_SETUP_NET_STATIC_MASK=255.255.255.0
AUTO_SETUP_NET_STATIC_GATEWAY=192.168.0.1
AUTO_SETUP_NET_STATIC_DNS=8.8.8.8
# Hostname
AUTO_SETUP_NET_HOSTNAME=DietPi
# Force ethernet speeds
# NB: This is mainly aimed at Pine A64's which may have an HW issue that causes unstable 1Gbit link.
# 0=automatic speed | 10 = 10mbit, 100 = 100mbit etc
AUTO_SETUP_NET_ETH_FORCE_SPEED=0
##### Misc Options #####
# Size of swapfile to generate (MB)
# 0=Disabled | 1=auto (2GB-RAM = size) | 2+=manual
AUTO_SETUP_SWAPFILE_SIZE=1
# Optional swapfile location
AUTO_SETUP_SWAPFILE_LOCATION=/var/swap
# Unmask (enable) systemd-logind service, which is masked by default on DietPi
AUTO_UNMASK_LOGIND=0
##### Software Automation Options #####
# Fully automate the installation
# 1=Automated installation with no user inputs.
# It is HIGHLY recommended to also set CONFIG_BOOT_WAIT_FOR_NETWORK=2, to force infinite wait for network connection during boot, preventing no connection errors due to timeout.
AUTO_SETUP_AUTOMATED=1
# Global Password to be applied for the system
# Requires AUTO_SETUP_AUTOMATED=1
# Affects user "root" and "dietpi" login passwords, and, all software installed by dietpi-software, that requires a password
# eg: MySQL, Transmission, Deluge etc.
# WARN: Passwords with the any of the following characters are not supported: \"$
# WARN: Do NOT change this entry after 1st run setup of DietPi has been completed. It is always scraped by dietpi-software.
AUTO_SETUP_GLOBAL_PASSWORD=dietpi
# DietPi-Software to automatically install. | requires AUTO_SETUP_AUTOMATED=1
# For a list of software index's (ID's), run '/DietPi/dietpi/dietpi-software list'
# No limit on number entries, add as many as you need and uncomment the line.
# DietPi will automatically install all pre-reqs (eg: ALSA/XSERVER for desktops etc)
# - Examples:
#AUTO_SETUP_INSTALL_SOFTWARE_ID=23 #will install Desktop LXDE
#AUTO_SETUP_INSTALL_SOFTWARE_ID=74 #will install LAMP webserver stack
#AUTO_SETUP_INSTALL_SOFTWARE_ID=44 #will install Bittorrent transmission
# install fail2ban
AUTO_SETUP_INSTALL_SOFTWARE_ID=73
# install OpenSSH Client
# AUTO_SETUP_INSTALL_SOFTWARE_ID=0
# install OpenSSH Server
# AUTO_SETUP_INSTALL_SOFTWARE_ID=105
# DietPi-Software Choice System
# SSH Server Selection:
# 0=none
# -1=dropbear
# -2=opensshserver
AUTO_SETUP_SSH_SERVER_INDEX=-1
# File Server Selection:
# 0=none/manual
# -1=proftp
# -2=samba
AUTO_SETUP_FILE_SERVER_INDEX=0
# Logging Mode Selection:
# 0=none/manual
# -1=ramlog 1h clear
# -2=ramlog 1h save clear
# -3=logrotate + rsyslog
AUTO_SETUP_LOGGING_INDEX=-1
# RAMlog max tmpfs size (MB). 50MB should be fine for single use. 200MB+ for heavy webserver and access log use etc.
AUTO_SETUP_RAMLOG_MAXSIZE=50
# Webserver Preference Selection:
# NB: This will get ignored, if you have manually selected any WEBSERVER_Stack.
# 0=Apache2
# -1=Nginx
# -2=Lighttpd
AUTO_SETUP_WEB_SERVER_INDEX=-2
# DietPi-Autostart | Requires AUTO_SETUP_AUTOMATED=1
# After installation is completed, which program should the system boot to?
# 0=Console 7=Console+auto root login | 1=Kodi 2=Desktops (LXDE/MATE etc) 5=DietPi-Cloudshell 6=Uae4ARM (Fastboot) 8=Uae4ARM (standard boot) 9=dxx-rebirth
AUTO_SETUP_AUTOSTART_TARGET_INDEX=0
# Language/Regional settings | Requires AUTO_SETUP_AUTOMATED=1
# Timezone eg: Europe/London America/New_York | Full list (TZ*): https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
AUTO_SETUP_TIMEZONE=Europe/London
# Locale eg: en_GB.UTF-8 / en_US.UTF-8 etc. One entry ONLY.
AUTO_SETUP_LOCALE=en_GB.UTF-8
# Keyboard Layout eg: gb us de fr
AUTO_SETUP_KEYBOARD_LAYOUT=gb
# Custom Script (pre-networking and pre-DietPi install) | Runs before DietPi installation and networking
# Allows you to automatically execute a custom script before networking and DietPi installation is started
# Option 1 = Copy your script to /boot/Automation_Custom_PreScript.sh and it will be executed automatically.
# NB: Executed script log /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log
# Custom Script (post-networking and post-DietPi install) | Runs after DietPi installation is completed
# Allows you to automatically execute a custom script at the end of DietPi installation.
# Option 1 = Copy your script to /boot/Automation_Custom_Script.sh and it will be executed automatically.
# Option 2 = Host your script online, then use AUTO_SETUP_CUSTOM_SCRIPT_EXEC=http://myweb.com/myscript.sh , it will be downloaded and executed automatically. | 0=disabled
# NB: Executed script log /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
AUTO_SETUP_CUSTOM_SCRIPT_EXEC=0
#Disable HDMI (and GPU/VPU where supported) output for supported devices:
# RPi | Odroid C1 | Odroid C2
AUTO_SETUP_HEADLESS=0
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Config settings
#------------------------------------------------------------------------------------------------------
#Cpu Governor | ondemand | powersave | performance | conservative
CONFIG_CPU_GOVERNOR=ondemand
CONFIG_CPU_USAGE_THROTTLE_UP=50
#CPU Frequency Limits
# NB: Intel CPU's use a percentage value (%) from 0-100 (eg: 55)
# NB: All other devices must use a specific MHz value (eg: 1600)
# Limit the MAX CPU frequency for all cores | Disabled=disabled
CONFIG_CPU_MAX_FREQ=Disabled
# Limit the MIN CPU frequency for all cores | Disabled=disabled
CONFIG_CPU_MIN_FREQ=Disabled
# Disable Intel-based turbo/boost stepping. This flag should not be required, setting <100% MAX frequency should disable Turbo on Intel CPU's.
CONFIG_CPU_DISABLE_TURBO=0
#Min value 10000 microseconds (10ms)
CONFIG_CPU_ONDEMAND_SAMPLE_RATE=25000
#sampling rate * down factor / 1000 = Milliseconds (40 = 1000ms when sampling rate is 25000)
CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=80
#Proxy settings | System-wide proxy settings. Use dietpi-config > networking options to apply.
# NB: Do not modify, you must use dietpi-config to configure/set options
CONFIG_PROXY_ENABLED=0
CONFIG_PROXY_ADDRESS=MyProxyServer.com
CONFIG_PROXY_PORT=8080
CONFIG_PROXY_USERNAME=
CONFIG_PROXY_PASSWORD=
#Delay boot until network is established: 0=disabled | 1=10 second wait max (default) | 2=infinite wait
CONFIG_BOOT_WAIT_FOR_NETWORK=2
#DietPi checks for updates (allows dietpi to check for updates on a daily basis and boot using a <1kb file download.)
CONFIG_CHECK_DIETPI_UPDATES=1
# Optional: Automatically update DietPi when updates are available. | requires CONFIG_CHECK_DIETPI_UPDATES=1
CONFIG_AUTO_DIETPI_UPDATES=0
#NTPD Update Mode: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift
CONFIG_NTP_MODE=2
#WiFi country code. 2 character value (eg GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
CONFIG_WIFI_COUNTRY_CODE=GB
#Serial Console: Set to 0 if you do not require serial console.
CONFIG_SERIAL_CONSOLE_ENABLE=1
#Soundcard
CONFIG_SOUNDCARD=none
#LCD Panel addon
# NB: Do not modify, you must use dietpi-config to configure/set options
CONFIG_LCDPANEL=none
#IPv6
CONFIG_ENABLE_IPV6=1
#Prefer IPv4 with APT and wget, NB: This has no effect if IPv6 is disabled anyway!
CONFIG_PREFER_IPV4=1
#APT mirrors which are applied to /etc/apt/sources.list | Values here will also be applied during 1st run setup
# Raspbian = https://www.raspbian.org/RaspbianMirrors
# Debian = https://www.debian.org/mirror/official#list
CONFIG_APT_RASPBIAN_MIRROR=http://raspbian.raspberrypi.org/raspbian
CONFIG_APT_DEBIAN_MIRROR=https://deb.debian.org/debian/
#NTPD mirror, applied to /etc/ntp.conf
# For a full list, please see http://www.pool.ntp.org
# Please remove the initial integer and full stop from the value (removing 0.). eg: debian.pool.ntp.org
CONFIG_NTP_MIRROR=debian.pool.ntp.org
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Software settings
#------------------------------------------------------------------------------------------------------
#Enter your EmonCMS.org write API key here. It will be applied automatically during EmonPi/Hub installation.
# eg: SOFTWARE_EMONHUB_APIKEY=b4dfmk2o203mmxx93a
SOFTWARE_EMONHUB_APIKEY=
#VNC Server Options
SOFTWARE_VNCSERVER_WIDTH=1280
SOFTWARE_VNCSERVER_HEIGHT=720
SOFTWARE_VNCSERVER_DEPTH=16
SOFTWARE_VNCSERVER_DISPLAY_INDEX=1
SOFTWARE_VNCSERVER_SHARE_DESKTOP=0
#Optional username for ownCloud/Nextcloud admin account, the default is 'admin'. Applied during installation.
SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=admin
#Optional data directory for ownCloud, default is '/mnt/dietpi_userdata/owncloud_data'. Applied during installation.
# This option is for advanced users. For full compatibility, please keep this options defaults, and, use dietpi-drive_manager to move the DietPi user data location.
SOFTWARE_OWNCLOUD_DATADIR=/mnt/dietpi_userdata/owncloud_data
#Optional data directory for Nextcloud, default is '/mnt/dietpi_userdata/nextcloud_data'. Applied during installation.
# This option is for advanced users. For full compatibility, please keep this options defaults, and, use dietpi-drive_manager to move the DietPi user data location.
SOFTWARE_NEXTCLOUD_DATADIR=/mnt/dietpi_userdata/nextcloud_data
#Wifi Hotspot
SOFTWARE_WIFI_HOTSPOT_SSID=DietPi-HotSpot
# minimum of 8 characters
SOFTWARE_WIFI_HOTSPOT_KEY=dietpihotspot
SOFTWARE_WIFI_HOTSPOT_CHANNEL=3
#Xorg options
# DPI 96(default) 120(+25%) 144(+50%) 168(+75%) 192(+100%)
SOFTWARE_XORG_DPI=96
#Chromium Options
SOFTWARE_CHROMIUM_RES_X=1280
SOFTWARE_CHROMIUM_RES_Y=720
SOFTWARE_CHROMIUM_AUTOSTART_URL=https://google.com
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Dev settings
#------------------------------------------------------------------------------------------------------
DEV_GITBRANCH=master
DEV_GITOWNER=Fourdee
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Settings, automatically added by dietpi-update
#------------------------------------------------------------------------------------------------------

256
dietpi/boot/dietpi.txt.sample

@ -0,0 +1,256 @@
# IMPORTANT:
# - Modifications to /boot/dietpi.txt will not be preserved on reboot.
# - Please ensure you edit from the DietPi-RAMdisk location: /DietPi/dietpi.txt
# NB: This is intended for advanced users, unless you know what you are doing, do not edit this file. Please use the DietPi programs instead.
# NB: Do not remove uncommented lines, as the items are scraped by DietPi programs, on demand.
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Automation settings, applied on the 1st boot of DietPi, ONCE
#------------------------------------------------------------------------------------------------------
##### Networking Options #####
# If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled.
# 1=enabled
AUTO_SETUP_NET_ETHERNET_ENABLED=1
AUTO_SETUP_NET_WIFI_ENABLED=0
# If using WiFi, please edit the following to pre-enter creds /boot/dietpi-wifi.txt
# Enter your Static Network details below, if applicable.
AUTO_SETUP_NET_USESTATIC=0
AUTO_SETUP_NET_STATIC_IP=192.168.0.100
AUTO_SETUP_NET_STATIC_MASK=255.255.255.0
AUTO_SETUP_NET_STATIC_GATEWAY=192.168.0.1
AUTO_SETUP_NET_STATIC_DNS=8.8.8.8
# Hostname
AUTO_SETUP_NET_HOSTNAME=DietPi
# Force ethernet speeds
# NB: This is mainly aimed at Pine A64's which may have an HW issue that causes unstable 1Gbit link.
# 0=automatic speed | 10 = 10mbit, 100 = 100mbit etc
AUTO_SETUP_NET_ETH_FORCE_SPEED=0
##### Misc Options #####
# Size of swapfile to generate (MB)
# 0=Disabled | 1=auto (2GB-RAM = size) | 2+=manual
AUTO_SETUP_SWAPFILE_SIZE=1
# Optional swapfile location
AUTO_SETUP_SWAPFILE_LOCATION=/var/swap
# Unmask (enable) systemd-logind service, which is masked by default on DietPi
AUTO_UNMASK_LOGIND=0
##### Software Automation Options #####
# Fully automate the installation
# 1=Automated installation with no user inputs.
# It is HIGHLY recommended to also set CONFIG_BOOT_WAIT_FOR_NETWORK=2, to force infinite wait for network connection during boot, preventing no connection errors due to timeout.
AUTO_SETUP_AUTOMATED=0
# Global Password to be applied for the system
# Requires AUTO_SETUP_AUTOMATED=1
# Affects user "root" and "dietpi" login passwords, and, all software installed by dietpi-software, that requires a password
# eg: MySQL, Transmission, Deluge etc.
# WARN: Passwords with the any of the following characters are not supported: \"$
# WARN: Do NOT change this entry after 1st run setup of DietPi has been completed. It is always scraped by dietpi-software.
AUTO_SETUP_GLOBAL_PASSWORD=dietpi
# DietPi-Software to automatically install. | requires AUTO_SETUP_AUTOMATED=1
# For a list of software index's (ID's), run '/DietPi/dietpi/dietpi-software list'
# No limit on number entries, add as many as you need and uncomment the line.
# DietPi will automatically install all pre-reqs (eg: ALSA/XSERVER for desktops etc)
# - Examples:
#AUTO_SETUP_INSTALL_SOFTWARE_ID=23 #will install Desktop LXDE
#AUTO_SETUP_INSTALL_SOFTWARE_ID=74 #will install LAMP webserver stack
#AUTO_SETUP_INSTALL_SOFTWARE_ID=44 #will install Bittorrent transmission
# DietPi-Software Choice System
# SSH Server Selection:
# 0=none
# -1=dropbear
# -2=opensshserver
AUTO_SETUP_SSH_SERVER_INDEX=-1
# File Server Selection:
# 0=none/manual
# -1=proftp
# -2=samba
AUTO_SETUP_FILE_SERVER_INDEX=0
# Logging Mode Selection:
# 0=none/manual
# -1=ramlog 1h clear
# -2=ramlog 1h save clear
# -3=logrotate + rsyslog
AUTO_SETUP_LOGGING_INDEX=-1
# RAMlog max tmpfs size (MB). 50MB should be fine for single use. 200MB+ for heavy webserver and access log use etc.
AUTO_SETUP_RAMLOG_MAXSIZE=50
# Webserver Preference Selection:
# NB: This will get ignored, if you have manually selected any WEBSERVER_Stack.
# 0=Apache2
# -1=Nginx
# -2=Lighttpd
AUTO_SETUP_WEB_SERVER_INDEX=-2
# DietPi-Autostart | Requires AUTO_SETUP_AUTOMATED=1
# After installation is completed, which program should the system boot to?
# 0=Console 7=Console+auto root login | 1=Kodi 2=Desktops (LXDE/MATE etc) 5=DietPi-Cloudshell 6=Uae4ARM (Fastboot) 8=Uae4ARM (standard boot) 9=dxx-rebirth
AUTO_SETUP_AUTOSTART_TARGET_INDEX=0
# Language/Regional settings | Requires AUTO_SETUP_AUTOMATED=1
# Timezone eg: Europe/London America/New_York | Full list (TZ*): https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
AUTO_SETUP_TIMEZONE=Europe/London
# Locale eg: en_GB.UTF-8 / en_US.UTF-8 etc. One entry ONLY.
AUTO_SETUP_LOCALE=en_GB.UTF-8
# Keyboard Layout eg: gb us de fr
AUTO_SETUP_KEYBOARD_LAYOUT=gb
# Custom Script (pre-networking and pre-DietPi install) | Runs before DietPi installation and networking
# Allows you to automatically execute a custom script before networking and DietPi installation is started
# Option 1 = Copy your script to /boot/Automation_Custom_PreScript.sh and it will be executed automatically.
# NB: Executed script log /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log
# Custom Script (post-networking and post-DietPi install) | Runs after DietPi installation is completed
# Allows you to automatically execute a custom script at the end of DietPi installation.
# Option 1 = Copy your script to /boot/Automation_Custom_Script.sh and it will be executed automatically.
# Option 2 = Host your script online, then use AUTO_SETUP_CUSTOM_SCRIPT_EXEC=http://myweb.com/myscript.sh , it will be downloaded and executed automatically. | 0=disabled
# NB: Executed script log /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
AUTO_SETUP_CUSTOM_SCRIPT_EXEC=0
#Disable HDMI (and GPU/VPU where supported) output for supported devices:
# RPi | Odroid C1 | Odroid C2
AUTO_SETUP_HEADLESS=0
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Config settings
#------------------------------------------------------------------------------------------------------
#Cpu Governor | ondemand | powersave | performance | conservative
CONFIG_CPU_GOVERNOR=ondemand
CONFIG_CPU_USAGE_THROTTLE_UP=50
#CPU Frequency Limits
# NB: Intel CPU's use a percentage value (%) from 0-100 (eg: 55)
# NB: All other devices must use a specific MHz value (eg: 1600)
# Limit the MAX CPU frequency for all cores | Disabled=disabled
CONFIG_CPU_MAX_FREQ=Disabled
# Limit the MIN CPU frequency for all cores | Disabled=disabled
CONFIG_CPU_MIN_FREQ=Disabled
# Disable Intel-based turbo/boost stepping. This flag should not be required, setting <100% MAX frequency should disable Turbo on Intel CPU's.
CONFIG_CPU_DISABLE_TURBO=0
#Min value 10000 microseconds (10ms)
CONFIG_CPU_ONDEMAND_SAMPLE_RATE=25000
#sampling rate * down factor / 1000 = Milliseconds (40 = 1000ms when sampling rate is 25000)
CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=80
#Proxy settings | System-wide proxy settings. Use dietpi-config > networking options to apply.
# NB: Do not modify, you must use dietpi-config to configure/set options
CONFIG_PROXY_ENABLED=0
CONFIG_PROXY_ADDRESS=MyProxyServer.com
CONFIG_PROXY_PORT=8080
CONFIG_PROXY_USERNAME=
CONFIG_PROXY_PASSWORD=
#Delay boot until network is established: 0=disabled | 1=10 second wait max (default) | 2=infinite wait
CONFIG_BOOT_WAIT_FOR_NETWORK=1
#DietPi checks for updates (allows dietpi to check for updates on a daily basis and boot using a <1kb file download.)
CONFIG_CHECK_DIETPI_UPDATES=1
# Optional: Automatically update DietPi when updates are available. | requires CONFIG_CHECK_DIETPI_UPDATES=1
CONFIG_AUTO_DIETPI_UPDATES=0
#NTPD Update Mode: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift
CONFIG_NTP_MODE=2
#WiFi country code. 2 character value (eg GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
CONFIG_WIFI_COUNTRY_CODE=GB
#Serial Console: Set to 0 if you do not require serial console.
CONFIG_SERIAL_CONSOLE_ENABLE=1
#Soundcard
CONFIG_SOUNDCARD=none
#LCD Panel addon
# NB: Do not modify, you must use dietpi-config to configure/set options
CONFIG_LCDPANEL=none
#IPv6
CONFIG_ENABLE_IPV6=1
#Prefer IPv4 with APT and wget, NB: This has no effect if IPv6 is disabled anyway!
CONFIG_PREFER_IPV4=1
#APT mirrors which are applied to /etc/apt/sources.list | Values here will also be applied during 1st run setup
# Raspbian = https://www.raspbian.org/RaspbianMirrors
# Debian = https://www.debian.org/mirror/official#list
CONFIG_APT_RASPBIAN_MIRROR=http://raspbian.raspberrypi.org/raspbian
CONFIG_APT_DEBIAN_MIRROR=https://deb.debian.org/debian/
#NTPD mirror, applied to /etc/ntp.conf
# For a full list, please see http://www.pool.ntp.org
# Please remove the initial integer and full stop from the value (removing 0.). eg: debian.pool.ntp.org
CONFIG_NTP_MIRROR=debian.pool.ntp.org
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Software settings
#------------------------------------------------------------------------------------------------------
#Enter your EmonCMS.org write API key here. It will be applied automatically during EmonPi/Hub installation.
# eg: SOFTWARE_EMONHUB_APIKEY=b4dfmk2o203mmxx93a
SOFTWARE_EMONHUB_APIKEY=
#VNC Server Options
SOFTWARE_VNCSERVER_WIDTH=1280
SOFTWARE_VNCSERVER_HEIGHT=720
SOFTWARE_VNCSERVER_DEPTH=16
SOFTWARE_VNCSERVER_DISPLAY_INDEX=1
SOFTWARE_VNCSERVER_SHARE_DESKTOP=0
#Optional username for ownCloud/Nextcloud admin account, the default is 'admin'. Applied during installation.
SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=admin
#Optional data directory for ownCloud, default is '/mnt/dietpi_userdata/owncloud_data'. Applied during installation.
# This option is for advanced users. For full compatibility, please keep this options defaults, and, use dietpi-drive_manager to move the DietPi user data location.
SOFTWARE_OWNCLOUD_DATADIR=/mnt/dietpi_userdata/owncloud_data
#Optional data directory for Nextcloud, default is '/mnt/dietpi_userdata/nextcloud_data'. Applied during installation.
# This option is for advanced users. For full compatibility, please keep this options defaults, and, use dietpi-drive_manager to move the DietPi user data location.
SOFTWARE_NEXTCLOUD_DATADIR=/mnt/dietpi_userdata/nextcloud_data
#Wifi Hotspot
SOFTWARE_WIFI_HOTSPOT_SSID=DietPi-HotSpot
# minimum of 8 characters
SOFTWARE_WIFI_HOTSPOT_KEY=dietpihotspot
SOFTWARE_WIFI_HOTSPOT_CHANNEL=3
#Xorg options
# DPI 96(default) 120(+25%) 144(+50%) 168(+75%) 192(+100%)
SOFTWARE_XORG_DPI=96
#Chromium Options
SOFTWARE_CHROMIUM_RES_X=1280
SOFTWARE_CHROMIUM_RES_Y=720
SOFTWARE_CHROMIUM_AUTOSTART_URL=https://google.com
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Dev settings
#------------------------------------------------------------------------------------------------------
DEV_GITBRANCH=master
DEV_GITOWNER=Fourdee
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Settings, automatically added by dietpi-update
#------------------------------------------------------------------------------------------------------

43
dietpi/hw_comparison.md

@ -0,0 +1,43 @@
### ODROID-HC1
Key features
* Samsung Exynos5422 Cortex-A15 2Ghz and Cortex-A7 Octa core CPUs
* 2Gbyte LPDDR3 RAM PoP stacked
* SATA-3 port for 2.5inch HDD/SSD storage up to 15mm thickness
* Gigabit Ethernet port
* USB 2.0 Host
* UHS-1 capable micro-SD card slot for boot media
* Size : 147 x 85 x 29 mm approx.(including Aluminium cooling frame)
* Linux server OS images based on modern Kernel 4.14 LTS
### ROCK64 4K60P HDR Single Board Computer
ROCK64 is a credit card size 4K60P HDR Single Board Computer powered by
* Rockchip RK3328 Quad-Core ARM Cortex A53 64-Bit Processor and support up to
* 4GB 1600MHz LPDDR3 memory. It provides
* eMMC module socket,
* MicroSD Card slot,
* Pi-2 Bus,
* Pi-P5+ Bus, U
* SB 3.0 and many others peripheral devices interface for makers to integrate with sensors and devices. Various Operating System (OS) are made available by open source community such
* Android 7.1,
* Debian,
* BSD and many more to come.
The ROCK64 4GB board designated as LTS (long Term Supply) model, PINE64 committed to supply at least for 5 years until year 2022 and beyond.
### Raspberry Pi 3 Model B+
* Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz
* 1GB LPDDR2 SDRAM
* 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE
* Gigabit Ethernet over USB 2.0 (maximum throughput 300 Mbps)
* Extended 40-pin GPIO header
* Full-size HDMI
* 4 USB 2.0 ports
* CSI camera port for connecting a Raspberry Pi camera
* DSI display port for connecting a Raspberry Pi touchscreen display
* 4-pole stereo output and composite video port
* Micro SD port for loading your operating system and storing data
* 5V/2.5A DC power input
* Power-over-Ethernet (PoE) support (requires separate PoE HAT)

BIN
dietpi/pictures/DroidBlitz.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

BIN
dietpi/pictures/HDD_copy_example.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

BIN
dietpi/pictures/adapterHDD_HC1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
dietpi/pictures/bash_prompt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
dietpi/pictures/dietpi-software_exit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
dietpi/pictures/dietpi_1st_reboot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

52
home.admin/00infoBlitz.sh

@ -145,23 +145,28 @@ if [ ${runningRTL} -eq 1 ]; then
fi
# CHAIN NETWORK
public_addr_pre="Public "
public_addr="??"
torInfo=""
# Version
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
# TOR or IP
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
networkConnections=$(echo ${networkInfo} | jq -r '.connections')
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections"
if [ "${onionAddress}" != "null" ]; then
if [ "${runBehindTor}" = "on" ]; then
# TOR address
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}peers"
public_addr="${onionAddress}:${public_port}"
public=""
public_color="${color_green}"
torInfo="+ TOR"
else
# IP address
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections"
public_addr="${public_ip}:${public_port}"
@ -174,6 +179,33 @@ 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
#check if dyndns resolves to correct IP
ipOfDynDNS=$(getent hosts ${dynDomain} | awk '{ print $1 }')
if [ "${ipOfDynDNS}:${public_port}" != "${public_addr}" ]; then
public_color="${color_red}"
else
public_color="${color_yellow}"
fi
# replace IP display with dynDNS
public_addr_pre="DynDNS "
networkConnectionsInfo=""
public_addr="${dynDomain}"
fi
fi
# LIGHTNING NETWORK
@ -183,6 +215,10 @@ ln_channelInfo="\n"
ln_external="\n"
ln_alias="${hostname}"
ln_publicColor=""
ln_port=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':')
if [ ${#ln_port} -eq 0 ]; then
ln_port="9735"
fi
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
if [ "$wallet_unlocked" -gt 0 ] ; then
@ -195,7 +231,7 @@ else
if [ ${ln_tor} -eq 1 ]; then
ln_publicColor="${color_green}"
else
public_check=$(nc -z -w6 ${public_ip} 9735 2>/dev/null; echo $?)
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}"
@ -245,19 +281,19 @@ ${color_yellow} ,' / ${color_gray}Free Mem ${color_ram}${ram} ${color_g
${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 ${public_color}${public_addr} ${public}${networkConnectionsInfo}
${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_yellow}${ln_publicColor}${ln_external}${color_red}
" \
"RaspiBlitz v${codeVersion}" \
"-------------------------------------------" \
"load average:${load##up*, }" "${temp}" \
"${hdd}" "${sync_percentage}"
if [ ${#onionAddress} -eq 0 ]; then
# one extra space line at the end if nodeaddress is not TOR
echo ""
if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then
echo "${undervoltageReports} undervoltage reports found - maybe upgrade power supply"
fi

108
home.admin/00infoLCD.sh

@ -37,7 +37,7 @@ while :
l1="Waiting for Network ...\n"
l2="Not able to get local IP.\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
continue
fi
@ -47,22 +47,20 @@ while :
l1="Waiting for DHCP ...\n"
l2="Not able to get local IP.\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
continue
fi
## get basic info from SD
bootstrapInfoExists=$(ls ${infoFile} 2>/dev/null | grep -c '.info')
if [ ${bootstrapInfoExists} -eq 1 ]; then
source ${infoFile}
fi
# get final config if already avaulable
# get config info if already available
configExists=$(ls ${configFile} 2>/dev/null | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
source ${configFile}
setupStep=100
fi
# if setup not marked as done (=100) load boostrap info file
if [ "${setupStep}" != "100" ]; then
source ${infoFile}
fi
# if no information available from files - set default
@ -110,6 +108,42 @@ while :
continue
fi
# check if recovering/upgrade is running
if [ "${state}" = "recovering" ]; then
if [ ${#message} -eq 0 ]; then
message="Setup in Progress"
fi
l1="Upgrade/Recover/Provision\n"
l2="---> ${message}\n"
l3="Please keep running until reboot."
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
# if freshly recovered
if [ "${state}" = "recovered" ]; then
l1="FINAL RECOVER LOGIN NEEDED:\n"
l2="ssh admin@${localip}\n"
l3="Use password: raspiblitz\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state})" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
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
# when setup is in progress - password has been changed
if [ ${setupStep} -lt 100 ]; then
l1="Login to your RaspiBlitz with:\n"
@ -126,27 +160,32 @@ while :
# DISPLAY AFTER SETUP
###########################
# check if recovering/upgrade is running
if [ "${state}" = "recovering" ]; then
if [ ${#message} -eq 0 ]; then
message="Setup in Progress"
if [ "${state}" = "repair" ]; then
l1="Repair Mode\n"
l2="ssh admin@${localip}\n"
l3="Use password: PasswordA\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
l1="Upgrade/Recover/Provision\n"
l2="---> ${message}\n"
l3="Please keep running until reboot."
if [ "${state}" = "retorrent" ]; then
l1="Repair Mode- TORRENT\n"
l2="ssh admin@${localip}\n"
l3="Use password: PasswordA\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
# if freshly recovered
if [ "${state}" = "recovered" ]; then
l1="FINAL RECOVER LOGIN NEEDED:\n"
if [ "${state}" = "recopy" ]; then
l1="Repair Mode - COPY\n"
l2="ssh admin@${localip}\n"
l3="Use password: raspiblitz\n"
l3="Use password: PasswordA\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state})" --infobox "$l1$l2$l3" 5 ${boxwidth}
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
@ -156,15 +195,14 @@ while :
clienterror=`cat error.tmp`
rm error.tmp
if [ ${#clienterror} -gt 0 ]; then
boxwidth=40
l1="Waiting for ${network}d to get ready.\n"
l2="---> Starting Up\n"
l2="---> ${clienterror/error*:/}\n"
l3="Can take longer if device was off."
isVerifying=$(echo "${clienterror}" | grep -c 'Verifying blocks')
if [ ${isVerifying} -gt 0 ]; then
l2="---> Verifying Blocks\n"
uptimeSeconds="$(cat /proc/uptime | grep -o '^[0-9]\+')"
if [ ${uptimeSeconds} -gt 600 ]; then
l3="!!Please login for more details!!"
fi
boxwidth=40
dialog --backtitle "RaspiBlitz ${codeVersion} (${localip}) - Welcome Back" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 5
continue
@ -175,19 +213,23 @@ while :
if [ "${locked}" -gt 0 ]; then
# special case: LND wallet is locked ---> show unlock info
h=5
l1="!!! LND WALLET IS LOCKED !!!\n"
l2="Login: ssh admin@${localip}\n"
l3="Use your Password A\n"
l4=""
if [ "${rtlWebinterface}" = "on" ]; then
l2="Open: http://${localip}:3000\n"
l3="Use Password C to unlock\n"
l2="Browser: http://${localip}:3000\n"
l3="PasswordB=login / PasswordC=unlock\n"
l4="PasswordA: ssh admin@${localip}"
h=6
fi
if [ "${autoUnlock}" = "on" ]; then
l2="ssh admin@${localip}\n"
l3="Waiting for AUTO-UNLOCK"
fi
boxwidth=$((${#localip} + 24))
dialog --backtitle "RaspiBlitz ${codeVersion} (${localip}) - ${hostname}" --infobox "$l1$l2$l3" 5 ${boxwidth}
boxwidth=$((${#localip} + 26))
dialog --backtitle "RaspiBlitz ${codeVersion} (${localip}) - ${hostname}" --infobox "$l1$l2$l3$l4" ${h} ${boxwidth}
sleep 5
continue
fi

194
home.admin/00mainMenu.sh

@ -10,10 +10,25 @@ infoFile="/home/admin/raspiblitz.info"
# check if HDD is connected
hddExists=$(lsblk | grep -c sda1)
if [ ${hddExists} -eq 0 ]; then
# check if there is maybe a HDD but woth no partitions
noPartition=$(lsblk | grep -c sda)
if [ ${noPartition} -eq 1 ]; then
echo "***********************************************************"
echo "WARNING: HDD HAS NO PARTITIONS"
echo "***********************************************************"
echo "Press ENTER to create a Partition - or CTRL+C to abort"
read key
echo "Creating Partition ..."
sudo parted -s /dev/sda unit s mkpart primary `sudo parted /dev/sda unit s print free | grep 'Free Space' | tail -n 1`
echo "DONE."
sleep 3
else
echo "***********************************************************"
echo "WARNING: NO HDD FOUND -> Shutdown, connect HDD and restart."
echo "***********************************************************"
exit
fi
fi
# check data from _bootstrap.sh that was running on device setup
@ -43,16 +58,43 @@ if [ "${state}" = "recovered" ]; then
exit 1
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
# singal that torrent is in re-download
if [ "${state}" = "retorrent" ]; then
echo "Re-Index in progress ... start monitoring:"
/home/admin/50torrentHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00mainMenu.sh
exit
fi
# if pre-sync is running - stop it - before continue
if [ "${state}" = "presync" ]; then
# stopping the pre-sync
echo ""
# analyse if blockchain was detected broken by pre-sync
blockchainBroken=$(sudo tail /mnt/hdd/bitcoin/debug.log | grep -c "Please restart with -reindex or -reindex-chainstate to recover.")
if [ ${blockchainBroken} -eq 1 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Detected corrupted blockchain on pre-sync !"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Deleting blockchain data ..."
echo "(needs to get downloaded fresh during setup)"
sudo rm -f -r /mnt/hdd/bitcoin
else
echo "********************************************"
echo "Stopping pre-sync ... pls wait (up to 1min)"
echo "********************************************"
sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf stop
echo "bitcoind called to stop .."
sleep 50
fi
# unmount the temporary mount
echo "Unmount HDD .."
@ -69,15 +111,17 @@ fi
if [ "${state}" = "ready" ]; then
configExists=$(ls ${configFile} | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
echo "setup is done - loading config data"
echo "loading config data"
source ${configFile}
setupStep=100
else
echo "setup still in progress - setupStep(${setupStep})"
fi
fi
## default menu settings
# to fit the main menu without scrolling:
# HEIGHT=23
# CHOICE_HEIGHT=20
HEIGHT=13
WIDTH=64
CHOICE_HEIGHT=6
@ -99,18 +143,106 @@ waitUntilChainNetworkIsReady()
echo "can take longer if device was off or first time"
while :
do
# check for error on network
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
clienterror=`cat error.tmp`
rm error.tmp
# check for missing blockchain data
minSize=250000000000
if [ "${network}" = "litecoin" ]; then
minSize=20000000000
fi
blockchainsize=$(sudo du -shbc /mnt/hdd/${network} | head -n1 | awk '{print $1;}')
if [ ${#blockchainsize} -gt 0 ]; then
if [ ${blockchainsize} -lt ${minSize} ]; then
echo "blockchainsize(${blockchainsize})"
echo "Missing Blockchain Data (<${minSize}) ..."
clienterror="missing blockchain"
sleep 3
fi
fi
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 ] || [ "${clienterror}" = "missing blockchain" ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
sleep 3
dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired.
This can be due to power problems or a failing HDD.
Please check the FAQ on RaspiBlitz Github
'My blockchain data is corrupted - what can I do?'
https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md
The RaspiBlitz will now try to help you on with the repair.
To run a BACKUP of funds & channels first is recommended.
" 13 65
clear
# Basic Options
OPTIONS=(TORRENT "Redownload Prepared Torrent (DEFAULT)" \
COPY "Copy from another Computer (SKILLED)" \
REINDEX "Resync thru ${network}d (TAKES VERY VERY LONG)" \
BACKUP "Run Backup LND data first (optional)"
)
CHOICE=$(dialog --backtitle "RaspiBlitz - Repair Script" --clear --title "Repair Blockchain Data" --menu "Choose a repair/recovery option:" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
clear
if [ "${CHOICE}" = "TORRENT" ]; then
echo "Starting TORRENT ..."
sudo sed -i "s/^state=.*/state=retorrent/g" /home/admin/raspiblitz.info
/home/admin/50torrentHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00mainMenu.sh
exit
elif [ "${CHOICE}" = "COPY" ]; then
echo "Starting COPY ..."
sudo sed -i "s/^state=.*/state=recopy/g" /home/admin/raspiblitz.info
/home/admin/50copyHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00mainMenu.sh
exit
elif [ "${CHOICE}" = "REINDEX" ]; then
echo "Starting REINDEX ..."
sudo /home/admin/config.scripts/network.reindex.sh
exit
elif [ "${CHOICE}" = "BACKUP" ]; then
sudo /home/admin/config.scripts/lnd.rescue.sh backup
echo "PRESS ENTER to return to menu."
read key
/home/admin/00mainMenu.sh
exit
else
echo "CANCEL"
exit
fi
else
echo "${network} error: ${clienterror}"
fi
# normal info
boxwidth=40
l1="Waiting for ${network}d to get ready.\n"
l2="---> Starting Up\n"
l2="---> ${clienterror/error*:/}\n"
l3="Can take longer if device was off."
isVerifying=$(echo "${clienterror}" | grep -c 'Verifying blocks')
if [ ${isVerifying} -gt 0 ]; then
l2="---> Verifying Blocks\n"
uptimeSeconds="$(cat /proc/uptime | grep -o '^[0-9]\+')"
# after 2 min show complete long string (full detail)
if [ ${uptimeSeconds} -gt 120 ]; then
boxwidth=80
l2="${clienterror}\n"
l3="CTRL+C => terminal"
fi
boxwidth=40
dialog --backtitle "RaspiBlitz ${localip} - Welcome" --infobox "$l1$l2$l3" 5 ${boxwidth}
else
locked=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>&1 | grep -c unlock)
@ -143,7 +275,7 @@ if [ ${setupStep} -eq 0 ]; then
# old data setup
BACKTITLE="RaspiBlitz - Manual Update"
TITLE="⚡ Found old RaspiBlitz Data on HDD ⚡"
MENU="\n ATTENTION: OLD DATA COULD COINTAIN FUNDS\n"
MENU="\n ATTENTION: OLD DATA COULD CONTAIN FUNDS\n"
OPTIONS+=(MANUAL "read how to recover your old funds" \
DELETE "erase old data, keep blockchain, reboot" )
HEIGHT=11
@ -220,6 +352,9 @@ else
RECEIVE "Create Invoice/PaymentRequest" \
SERVICES "Activate/Deactivate Services" \
MOBILE "Connect Mobile Wallet" \
EXPORT "Macaroons and TLS.cert" \
NAME "Change Name/Alias of Node" \
PASSWORD "Change Passwords" \
CASHOUT "Remove Funds from on-chain Wallet")
# dont offer lnbalance/lnchannels on testnet
@ -366,6 +501,38 @@ case $CHOICE in
read key
./00mainMenu.sh
;;
EXPORT)
sudo /home/admin/config.scripts/lnd.export.sh
echo "Press ENTER to return to main menu."
read key
./00mainMenu.sh
;;
NAME)
sudo /home/admin/config.scripts/lnd.setname.sh
noreboot=$?
if [ "${noreboot}" = "0" ]; then
sudo -u bitcoin ${network}-cli stop
echo "Press ENTER to Reboot."
read key
sudo shutdown -r now
else
./00mainMenu.sh
fi
;;
PASSWORD)
sudo /home/admin/config.scripts/blitz.setpassword.sh
noreboot=$?
if [ "${noreboot}" = "0" ]; then
sudo -u bitcoin ${network}-cli stop
echo "Press ENTER to Reboot .."
read key
sudo shutdown -r now
else
echo "Press ENTER to return to main menu .."
read key
./00mainMenu.sh
fi
;;
OFF)
echo ""
echo "LCD turns white when shutdown complete."
@ -373,10 +540,10 @@ case $CHOICE in
echo "-----------------------------------------------"
echo "stop lnd - please wait .."
sudo systemctl stop lnd
echo "stop bitcoind (1) - please wait .."
sudo -u bitcoin bitcoin-cli stop
echo "stop ${network}d (1) - please wait .."
sudo -u bitcoin ${network}-cli stop
sleep 10
echo "stop bitcoind (2) - please wait .."
echo "stop ${network}d (2) - please wait .."
sudo systemctl stop ${network}d
echo "starting shutdown"
sudo shutdown now
@ -384,8 +551,9 @@ case $CHOICE in
;;
MANUAL)
echo "************************************************************************************"
echo "PLEASE open in browser for more information:"
echo "https://github.com/rootzoll/raspiblitz#recover-your-coins-from-a-failing-raspiblitz"
echo "PLEASE go to RaspiBlitz FAQ:"
echo "https://github.com/rootzoll/raspiblitz"
echo "And check: How can I recover my coins from a failing RaspiBlitz?"
echo "************************************************************************************"
exit 0
;;

92
home.admin/00settingsMenuServices.sh

@ -1,19 +1,22 @@
#!/bin/bash
# get raspiblitz config
echo "get raspiblitz config"
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
echo "services default values"
if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi
if [ ${#autoNatDiscovery} -eq 0 ]; then autoNatDiscovery="off"; fi
if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
if [ ${#chain} -eq 0 ]; then chain="main"; fi
# map chain to on/off
echo "map chain to on/off"
chainValue="off"
if [ "${chain}" = "test" ]; then chainValue="on"; fi
# map domain to on/off
echo "map domain to on/off"
domainValue="off"
dynDomainMenu='DynamicDNS'
if [ ${#dynDomain} -gt 0 ]; then
@ -21,32 +24,44 @@ if [ ${#dynDomain} -gt 0 ]; then
dynDomainMenu="${dynDomain}"
fi
echo "check autopilot by lnd.conf"
lndAutoPilotOn=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=1')
if [ ${lndAutoPilotOn} -eq 1 ]; then
autoPilot="on"
else
autoPilot="off"
fi
# show select dialog
CHOICES=$(dialog --checklist 'Activate/Deactivate Services:' 15 45 7 \
echo "run dialog ..."
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 15 45 7 \
1 'Channel Autopilot' ${autoPilot} \
2 'Testnet' ${chainValue} \
3 'Router AutoNAT' ${autoNatDiscovery} \
4 ${dynDomainMenu} ${domainValue} \
5 'Run behind TOR' ${runBehindTor} \
6 'RTL Webinterface' ${rtlWebinterface} \
7 'LND Auto-Unlock' ${autoUnlock} \
3 ${dynDomainMenu} ${domainValue} \
4 'Run behind TOR' ${runBehindTor} \
5 'RTL Webinterface' ${rtlWebinterface} \
6 'LND Auto-Unlock' ${autoUnlock} \
2>&1 >/dev/tty)
dialogcancel=$?
echo "done dialog"
clear
# check if user canceled dialog
echo "dialogcancel(${dialogcancel})"
if [ ${dialogcancel} -eq 1 ]; then
echo "user canceled"
exit 1
fi
needsReboot=0
anychange=0
# AUTOPILOT process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "1")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${autoPilot}" != "${choice}" ]; then
echo "Autopilot Setting changed .."
anychange=1
sudo /home/admin/config.scripts/lnd.autopilot.sh ${choice}
needsReboot=1
else
@ -61,6 +76,7 @@ if [ "${chain}" != "${choice}" ]; then
dialog --title 'FAIL' --msgbox 'Litecoin-Testnet not available.' 5 25
else
echo "Testnet Setting changed .."
anychange=1
sudo /home/admin/config.scripts/network.chain.sh ${choice}net
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${choice}net/wallet.db 2>/dev/null | grep -c 'wallet.db')
if [ ${walletExists} -eq 0 ]; then
@ -125,22 +141,12 @@ else
echo "Testnet Setting unchanged."
fi
# AUTONAT process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "3")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${autoNatDiscovery}" != "${choice}" ]; then
echo "AutoNAT Setting changed .."
sudo /home/admin/config.scripts/lnd.autonat.sh ${choice}
needsReboot=1
else
echo "AutoNAT Setting unchanged."
fi
# Dynamic Domain
choice="off"; check=$(echo "${CHOICES}" | grep -c "4")
choice="off"; check=$(echo "${CHOICES}" | grep -c "3")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${domainValue}" != "${choice}" ]; then
echo "Dynamic Domain changed .."
anychange=1
sudo /home/admin/config.scripts/internet.dyndomain.sh ${choice}
needsReboot=1
else
@ -148,10 +154,11 @@ else
fi
# TOR process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "5")
choice="off"; check=$(echo "${CHOICES}" | grep -c "4")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${runBehindTor}" != "${choice}" ]; then
echo "TOR Setting changed .."
anychange=1
sudo /home/admin/config.scripts/internet.tor.sh ${choice}
needsReboot=1
else
@ -159,17 +166,27 @@ else
fi
# RTL process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "6")
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}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
l1="RTL web servcie should be installed - AFTER NEXT REBOOT:"
l2="Try to open the following URL in your local webrowser"
l3="and unlock your wallet from there with PASSWORD C."
if [ ${errorOnInstall} -eq 0 ]; then
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
l1="RTL web service will be ready AFTER NEXT REBOOT:"
l2="Try to open the following URL in your local web browser"
l3="and login with your PASSWORD B."
l4="---> http://${localip}:3000"
dialog --title 'OK' --msgbox "${l1}\n${l2}\n${l3}\n${l4}" 9 45
dialog --title 'OK' --msgbox "${l1}\n${l2}\n${l3}\n${l4}" 11 65
else
l1="!!! FAIL on RTL install !!!"
l2="Try manual install on terminal after rebootwith:"
l3="sudo /home/admin/config.scripts/bonus.rtl.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 10 65
fi
fi
needsReboot=1
else
@ -177,20 +194,37 @@ else
fi
# LND Auto-Unlock
choice="off"; check=$(echo "${CHOICES}" | grep -c "7")
choice="off"; check=$(echo "${CHOICES}" | grep -c "6")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${autoUnlock}" != "${choice}" ]; then
echo "LND Autounlock Setting changed .."
anychange=1
sudo /home/admin/config.scripts/lnd.autounlock.sh ${choice}
l1="AUTO-UNLOCK IS NOW OFF"
if [ "${choice}" = "on" ]; then
l1="AUTO-UNLOCK IS NOW ACTIVE"
fi
l2="-------------------------"
l3="mobile/external wallets may need reconnect"
l4="possible change in macaroon / TLS cert"
dialog --title 'OK' --msgbox "${l1}\n${l2}\n${l3}\n${l4}" 11 60
needsReboot=1
else
echo "LND Autounlock Setting unchanged."
fi
if [ ${anychange} -eq 0 ]; then
dialog --pause "Hint: Use Spacebar to check/uncheck services." 8 58 5
exit 0
fi
if [ ${needsReboot} -eq 1 ]; then
sleep 2
dialog --pause "OK. System will reboot to activate changes." 8 58 8
clear
echo "rebooting .. (please wait)"
sleep 3
# stop bitcoind
sudo -u bitcoin ${network}-cli stop
sleep 4
sudo shutdown -r now
fi

75
home.admin/10setupBlitz.sh

@ -101,8 +101,11 @@ fi #end - when lighting is running
bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running)
if [ ${bitcoinRunning} -eq 0 ]; then
# double check
echo "${network} is not running - double checking - wait 120secs"
sleep 120
seconds=120
if [ ${setupStep} -lt 60 ]; then
seconds=10
fi
dialog --pause " Double checking for ${network}d - please wait .." 8 58 ${seconds}
bitcoinRunning=$(${network}-cli getblockchaininfo | grep "initialblockdownload" -c)
else
echo "${network} is running"
@ -120,8 +123,22 @@ fi #end - when bitcoin is running
mountOK=$( sudo cat /etc/fstab | grep -c '/mnt/hdd' )
if [ ${mountOK} -eq 1 ]; then
# FAILSAFE: check if raspiblitz.conf is available
configExists=$(ls /mnt/hdd/raspiblitz.conf | grep -c '.conf')
if [ ${configExists} -eq 0 ]; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "FAIL: /mnt/hdd/raspiblitz.conf should exists at this point, but not found!"
echo "Please report to: https://github.com/rootzoll/raspiblitz/issues/293"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Press ENTER to EXIT."
read key
exit 1
fi
# are there any signs of blockchain data and activity
blockchainDataExists=$(ls /mnt/hdd/${network}/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
# setup running with admin user, but has no permission to read /mnt/hdd/bitcoin/blocks/, sudo needed
blockchainDataExists=$(sudo ls /mnt/hdd/${network}/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
configExists=$(sudo ls /mnt/hdd/${network}/${network}.conf | grep -c '.conf')
if [ ${blockchainDataExists} -eq 1 ]; then
@ -133,19 +150,35 @@ if [ ${mountOK} -eq 1 ]; then
echo "Sometimes a reboot helps --> sudo shutdown -r now"
exit 1
else
echo "Got mounted blockchain, but no config and runnign service yet --> finish HDD"
echo "Got mounted blockchain, but no config and running service yet --> finish HDD"
./60finishHDD.sh
exit 1
fi
fi
# check if there is a download to continue
downloadProgressExists=$(sudo ls /home/admin/.Download.out 2>/dev/null | grep ".Download.out" -c)
# check if there is torrent data to continue
torrentProgressExists=$(sudo ls /mnt/hdd/ 2>/dev/null | grep "torrent" -c)
if [ ${torrentProgressExists} -eq 1 ]; then
# check if there is a running screen session to return to
noScreenSession=$(screen -ls | grep -c "No Sockets found")
if [ ${noScreenSession} -eq 0 ]; then
echo "found torrent data .. resuming"
./50torrentHDD.sh
exit 1
fi
fi
# check if there is ftp data to continue
downloadProgressExists=$(sudo ls /mnt/hdd/ 2>/dev/null | grep "download" -c)
if [ ${downloadProgressExists} -eq 1 ]; then
echo "found download in progress .."
# check if there is a running screen session to return to
noScreenSession=$(screen -ls | grep -c "No Sockets found")
if [ ${noScreenSession} -eq 0 ]; then
echo "found download in data .. resuming"
./50downloadHDD.sh
exit 1
fi
fi
# HDD is empty - get Blockchain
@ -153,11 +186,11 @@ if [ ${mountOK} -eq 1 ]; then
if [ ${network} = "bitcoin" ]; then
echo "Bitcoin Options"
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 \
T "TORRENT --> TESTNET + MAINNET thru Torrent (DEFAULT)" \
D "DOWNLOAD --> TESTNET + MAINNET per FTP (FALLBACK)" \
C "COPY --> TESTNET + MAINNET from another HDD (TRICKY+FAST)" \
S "SYNC --> JUST TESTNET thru Bitoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty)
--menu "You need a copy of the Bitcoin Blockchain - you have 5 options:" 13 75 5 \
T "TORRENT --> MAINNET + TESTNET thru Torrent (DEFAULT)" \
C "COPY --> BLOCKCHAINDATA from another node with SCP" \
N "CLONE --> BLOCKCHAINDATA from 2nd HDD (extra cable)"\
S "SYNC --> MAINNET thru Bitcoin Network (ULTRA SLOW)" 2>&1 >/dev/tty)
# Litecoin
elif [ ${network} = "litecoin" ]; then
@ -165,8 +198,6 @@ if [ ${mountOK} -eq 1 ]; then
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \
--menu "You need a copy of the Litecoin Blockchain - you have 3 options:" 13 75 4 \
T "TORRENT --> MAINNET thru Torrent (DEFAULT)" \
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)
# error
@ -181,16 +212,16 @@ if [ ${mountOK} -eq 1 ]; then
clear
case $menuitem in
T)
./50torrentHDD.sh
/home/admin/50torrentHDD.sh
;;
C)
./50copyHDD.sh
/home/admin/50copyHDD.sh
;;
S)
./50syncHDD.sh
N)
/home/admin/50cloneHDD.sh
;;
D)
./50downloadHDD.sh
S)
/home/admin/50syncHDD.sh
;;
esac
exit 1
@ -214,13 +245,13 @@ fi
# the HDD is already ext4 formated and called blockchain
formatExt4OK=$(lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL | grep BLOCKCHAIN | grep -c ext4)
if [ ${formatExt4OK} -eq 1 ]; then
echo "HDD was already inited or prepared"
echo "HDD was already initialized/prepared"
echo "Now needs to be mounted"
./40addHDD.sh
exit 1
fi
# the HDD had no init yet
echo "HDD needs init"
echo "init HDD ..."
./30initHDD.sh
exit 1

75
home.admin/20recoverDialog.sh

@ -1,15 +1,11 @@
#!/bin/bash
_temp="./download/dialog.$$"
## get basic info
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
passwordValid=0
result=""
while [ ${passwordValid} -eq 0 ]
do
# show password info dialog
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
# show password info dialog
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
You need to set a new Password A:
A) Master User Password
@ -21,45 +17,26 @@ no spaces and only special characters - or .
Write them down & store them in a safe place.
" 14 52
# ask user for new password A
dialog --backtitle "RaspiBlitz - Setup"\
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
# get user input
result=$( cat $_temp )
shred $_temp
passwordValid=1
# sucess info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
clearedResult=$(echo "${result}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#result} ] || [ ${#clearedResult} -eq 0 ]; then
clear
echo "FAIL - Password contained not allowed chars (see next screen)"
echo "Press ENTER to continue .."
read key
passwordValid=0
else
# change user passwords and then change hostname
echo "pi:$result" | sudo chpasswd
echo "root:$result" | sudo chpasswd
echo "bitcoin:$result" | sudo chpasswd
echo "admin:$result" | sudo chpasswd
sleep 1
# activate lnd & bitcoin service
echo "Enabling Services"
sudo systemctl daemon-reload
sudo systemctl enable lnd.service
sudo systemctl enable ${network}d.service
if [ "${rtlWebinterface}" = "on" ]; then
# activate lnd & bitcoin service
echo "Enabling Services"
sudo systemctl daemon-reload
sudo systemctl enable lnd.service
sudo systemctl enable ${network}d.service
if [ "${rtlWebinterface}" = "on" ]; then
sudo systemctl enable RTL
fi
fi
# remove flag that freshly recovered
sudo rm /home/admin/raspiblitz.recover.info
# remove flag that freshly recovered
sudo rm /home/admin/raspiblitz.recover.info
# when auto-unlock is activated then Password C is needed to be restored on SD card
if [ "${autoUnlock}" = "on" ]; then
# when auto-unlock is activated then Password C is needed to be restored on SD card
if [ "${autoUnlock}" = "on" ]; then
# reset auto-unlock feature
dialog --backtitle "RaspiBlitz - Setup" --msgbox "You had the Auto-Unlock feature enabled.
@ -72,16 +49,8 @@ to deactivate the Auto-Unlock feature.
sudo /home/admin/config.scripts/lnd.autounlock.sh on
dialog --backtitle "RaspiBlitz" --msgbox "FINAL REBOOT IS NEEDED." 6 52
else
dialog --backtitle "RaspiBlitz" --msgbox "New SSH password A is '$result'\nFINAL REBOOT IS NEEDED." 6 52
fi
sudo shutdown -r now
fi
done
else
dialog --backtitle "RaspiBlitz" --msgbox "OK - SSH password A set.\nFINAL REBOOT IS NEEDED." 6 52
fi
sudo shutdown -r now

83
home.admin/20setupDialog.sh

@ -4,6 +4,10 @@ _temp="./download/dialog.$$"
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
###################
# ENTER NAME
###################
# welcome and ask for name of RaspiBlitz
result=""
while [ ${#result} -eq 0 ]
@ -13,6 +17,8 @@ while [ ${#result} -eq 0 ]
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2" 11 52 2>$_temp
result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' )
shred $_temp
echo "processing ..."
sleep 3
done
# set lightning alias
@ -29,13 +35,12 @@ else
sed -i "s/^hostname=.*/hostname=${result}/g" /home/admin/raspiblitz.info
fi
###################
# ENTER PASSWORDS
###################
passwordValid=0
result=""
while [ ${passwordValid} -eq 0 ]
do
# show password info dialog
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
# show password info dialog
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
Referenced as password A, B, C and D.
A) Master User Password
@ -48,63 +53,15 @@ no spaces and only special characters - or .
Write them down & store them in a safe place.
" 15 52
# ask user for new password A
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})"\
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
# get user input
result=$( cat $_temp )
shred $_temp
passwordValid=1
clearedResult=$(echo "${result}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#result} ] || [ ${#clearedResult} -eq 0 ]; then
clear
echo "FAIL - Password contained not allowed chars (see next screen)"
echo "Press ENTER to continue .."
read key
passwordValid=0
else
# change user passwords and then change hostname
echo "pi:$result" | sudo chpasswd
echo "root:$result" | sudo chpasswd
echo "bitcoin:$result" | sudo chpasswd
echo "admin:$result" | sudo chpasswd
sleep 1
# sucess info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - password changed to '$result'\nfor all users pi, admin, root & bitcoin" 6 52
# repeat until user input is nit length 0
result=""
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})"\
--inputbox "Enter your RPC Password B:" 9 52 2>$_temp
result=$( cat $_temp )
shred $_temp
clearedResult=$(echo "${result}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#result} ] || [ ${#clearedResult} -eq 0 ]; then
clear
echo "FAIL - Password contained not allowed chars (see next screen)"
echo "Press ENTER to continue to start again"
read key
passwordValid=0
else
# set Blockchain RPC Password (for admin cli & template for user bitcoin)
sed -i "s/^rpcpassword=.*/rpcpassword=${result}/g" /home/admin/assets/${network}.conf
sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${result}/g" /home/admin/assets/lnd.${network}.conf
# success info dialog
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52
clear
fi
fi
done
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
# sucess info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
# call set password b script
sudo /home/admin/config.scripts/blitz.setpassword.sh b
# success info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - RPC password changed \n\nNow starting the Setup of your RaspiBlitz." 7 52
clear

37
home.admin/30initHDD.sh

@ -1,9 +1,14 @@
#!/bin/bash
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
echo ""
echo "*** Checking if HDD is connected ***"
sleep 5
device="sda1"
existsHDD=$(lsblk | grep -c sda1)
if [ ${existsHDD} -eq 1 ]; then
echo "OK - HDD found at sda1"
@ -28,6 +33,38 @@ if [ ${existsHDD} -eq 1 ]; then
fi
# quick basic size check
echo ""
echo "*** HDD Size Check ***"
# bitcoin > 450 GB
minSize=450000000000
# litecoin > 31 GB
if [ "${network}" = "litecoin" ]; then
minSize=31000000000
fi
isSize=$(lsblk -o NAME,SIZE -b | grep "${device}" | awk '$1=$1' | cut -d " " -f 2)
if [ ${isSize} -lt ${minSize} ]; then
if [ ${isSize} -gt 1 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "WARNING: HDD might be too small"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "You HDD was detected with the size of ${isSize} bytes"
echo "For ${network} at least ${minSize} bytes is recommended"
echo "If you want to change to a bigger HDD:"
echo "* Unplug power of RaspiBlitz"
echo "* Make a fresh SD card again"
echo "* Start again with bigger HDD"
echo "If you want to try with HDD connected, press ENTER to continue."
read key
else
echo "WARN: Was not able to get size of HDD ... skipping"
sleep 3
fi
else
echo "OK: HDD seems big enough"
fi
echo ""
mountOK=$(df | grep -c /mnt/hdd)
if [ ${mountOK} -eq 1 ]; then
echo "FAIL - HDD is mounted"

60
home.admin/40addHDD.sh

@ -2,7 +2,7 @@
echo ""
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /home/admin/raspiblitz.info
echo "*** Adding HDD to the System ***"
echo "started from state(${state})"
@ -25,7 +25,8 @@ if [ ${existsHDD} -gt 0 ]; then
uuid=$1
fstabOK=$(cat /etc/fstab | grep -c ${uuid})
if [ ${fstabOK} -eq 0 ]; then
fstabAdd="UUID=${uuid} /mnt/hdd ext4 noexec,defaults 0 0"
# see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572
fstabAdd="UUID=${uuid} /mnt/hdd ext4 noexec,defaults 0 2"
echo "Adding line to /etc/fstab ..."
echo ${fstabAdd}
# adding the new line after line 3 to the /etc/fstab
@ -38,13 +39,66 @@ if [ ${existsHDD} -gt 0 ]; then
echo "OK - HDD is listed in /etc/fstab"
echo ""
echo "*** Mount HDD ***"
sudo mkdir /mnt/hdd
sudo mkdir /mnt/hdd 2>/dev/null
sudo mount -a
mountOK=$(df | grep -c /mnt/hdd)
if [ ${mountOK} -eq 1 ]; then
echo "OK - HDD is mounted"
echo ""
# setting fsk check intervall to 1
# see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572
sudo tune2fs -c 1 /dev/sda1
# init the RASPIBLITZ Config
configFile="/mnt/hdd/raspiblitz.conf"
configExists=$(sudo ls ${configFile} | grep -c 'raspiblitz.conf')
if [ ${configExists} -eq 0 ]; then
# create file and use init values from raspiblitz.info
source /home/admin/_version.info
sudo touch $configFile
sudo chmod 777 ${configFile}
echo "# RASPIBLITZ CONFIG FILE" > $configFile
echo "raspiBlitzVersion='${codeVersion}'" >> $configFile
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
echo "hostname=${hostname}" >> $configFile
# try to determine publicIP and if not possible use localIP as placeholder
# https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101
freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php)
# sanity check on IP data
# see https://github.com/rootzoll/raspiblitz/issues/371#issuecomment-472416349
echo "-> sanity check of IP data: ${freshPublicIP}"
if [[ $freshPublicIP =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then
echo "OK IPv6"
elif [[ $freshPublicIP =~ ^([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then
echo "OK IPv4"
else
echo "FAIL - not an IPv4 or IPv6 address"
freshPublicIP=""
fi
if [ ${#freshPublicIP} -eq 0 ]; then
localIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
echo "WARNING: No publicIP information at all yet - working with placeholder : ${localIP}"
freshPublicIP="${localIP}"
fi
echo "publicIP=${freshPublicIP}" >> $configFile
fi
# move SSH pub keys to HDD so that they survive an update
echo "moving SSH pub keys to HDD"
sudo cp -r /etc/ssh /mnt/hdd/ssh
sudo rm -rf /etc/ssh
sudo ln -s /mnt/hdd/ssh /etc/ssh
echo "OK"
echo ""
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=40/g" /home/admin/raspiblitz.info

210
home.admin/50cloneHDD.sh

@ -0,0 +1,210 @@
#!/bin/bash
## get basic info
source /home/admin/raspiblitz.info
echo ""
echo "*** Check 1st HDD ***"
sleep 4
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
if [ ${hddA} -eq 0 ]; then
echo "FAIL - 1st HDD not found as sda1"
echo "Try 'sudo shutdown -r now'"
exit 1
fi
ready=0
while [ ${ready} -eq 0 ]
do
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
if [ ${hddA} -eq 1 ]; then
echo "OK - HDD as sda1 found"
ready=1
fi
if [ ${hddA} -eq 0 ]; then
echo "FAIL - 1st HDD not found as sda1 or sda"
echo "Try 'sudo shutdown -r now'"
exit 1
fi
hddB=$(lsblk | grep -c sda)
if [ ${hddB} -eq 1 ]; then
echo "OK - HDD as sda found"
ready=1
fi
done
echo ""
echo "*** Clone Blockchain form a second HDD ***"
echo ""
echo "WARNING: The RaspiBlitz cannot run 2 HDDs without extra Power!"
echo ""
echo "You can use a Y cable for the second HDD to inject extra power."
echo "Like this one: https://www.amazon.de/dp/B00ZJBIHVY"
echo "If you see on LCD a error on connecting the 2nd HDD do a restart."
echo ""
echo "You can use the HDD of another RaspiBlitz for this."
echo "The 2nd HDD needs to be formatted Ext4/exFAT and the folder '${network}' is in root of HDD."
echo "The the folder '${network}' needs to be in root of the 1st or 2nd partition on the HDD."
echo ""
echo "**********************************"
echo "--> Please connect now the 2nd HDD"
echo "**********************************"
echo ""
echo "If 2nd HDD is connected but setup does not continue,"
echo "then cancel (CTRL+c) and reboot."
ready=0
while [ ${ready} -eq 0 ]
do
hddC=$(lsblk | grep -c sdb1)
if [ ${hddC} -eq 1 ]; then
echo "OK - 2nd HDD found as sdb1"
ready=1
fi
hddD=$(lsblk | grep -c sdb)
if [ ${hddD} -eq 1 ]; then
echo "OK - 2nd HDD found as sdb"
ready=1
fi
done
echo ""
echo "*** Mounting 2nd HDD ***"
sudo mkdir /mnt/genesis
echo "try ext4 on sdb1 .."
sudo mount -t ext4 /dev/sdb1 /mnt/genesis
sleep 2
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try exfat on sdb1 .."
sudo mount -t exfat /dev/sdb1 /mnt/genesis
sleep 2
fi
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try ext4 on sdb .."
sudo mount -t ext4 /dev/sdb /mnt/genesis
sleep 2
fi
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try exfat on sdb.."
sudo mount -t exfat /dev/sdb /mnt/genesis
sleep 2
fi
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "FAIL - not able to mount the 2nd HDD"
echo "only ext4 and exfat possible"
sleep 4
./10setupBlitz.sh
exit 1
else
echo "OK - 2nd HDD mounted at /mnt/genesis"
fi
echo ""
echo "*** Copy Blockchain ***"
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/chainstate /mnt/hdd/bitcoin
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/indexes /mnt/hdd/bitcoin
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/testnet3 /mnt/hdd/bitcoin
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/blocks /mnt/hdd/bitcoin
# echo "cleaning up - ok if files do not exists"
# sudo rm /mnt/hdd/${network}/${network}.conf
# sudo rm /mnt/hdd/${network}/${network}.pid
# sudo rm /mnt/hdd/${network}/banlist.dat
# sudo rm /mnt/hdd/${network}/debug.log
# sudo rm /mnt/hdd/${network}/fee_estimates.dat
# sudo rm /mnt/hdd/${network}/mempool.dat
# sudo rm /mnt/hdd/${network}/peers.dat
# sudo rm /mnt/hdd/${network}/testnet3/banlist.dat
# sudo rm /mnt/hdd/${network}/testnet3/debug.log
# sudo rm /mnt/hdd/${network}/testnet3/fee_estimates.dat
# sudo rm /mnt/hdd/${network}/testnet3/mempool.dat
# sudo rm /mnt/hdd/${network}/testnet3/peers.dat
sudo umount -l /mnt/genesis
echo "OK - Copy done :)"
echo ""
# echo "---> You can now disconnect the 2nd HDD"
# If the Odorid HC1 reboots with a HDD attached to the USB it prioritises it over the SATA
echo "---> Disconnect the 2nd HDD and press a Enter"
read key
# set SetupState
# sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# sleep 5
#./60finishHDD.sh
# 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)"
if [ ${count} -lt 2300 ]; then
echo "FAIL: less then 2300 .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 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
fi
else
# when no data transferred - just delete bitcoin base dir again
sudo rm -rf /mnt/hdd/bitcoin
fi
if [ ${setupStep} -lt 100 ]; then
# setup script will decide the next logical step
/home/admin/10setupBlitz.sh
fi

249
home.admin/50copyHDD.sh

@ -1,100 +1,183 @@
#!/bin/bash
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /home/admin/raspiblitz.info
echo ""
echo "*** Check 1st HDD ***"
sleep 4
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
if [ ${hddA} -eq 0 ]; then
echo "FAIL - 1st HDD not found as sda1"
echo "Try 'sudo shutdown -r now'"
exit 1
# get local ip
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
# Basic Options
OPTIONS=(UNIX "MacOS or Linux" \
WINDOWS "Windows"
)
CHOICE=$(dialog --clear --title "Which System is running on the other computer?" --menu "" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
clear
case $CHOICE in
UNIX) echo "Linus";;
WINDOWS) echo "Bill";;
*) exit 1;;
esac
# additional prep if this is used to replace corrupted blockchain
if [ "${setupStep}" = "100" ]; then
# make sure services are not running
echo "stopping servcies ..."
sudo systemctl stop lnd
sudo systemctl stop bitcoind
sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf
fi
echo "OK - HDD as sda1 found"
echo ""
echo "*** Copy Blockchain form a second HDD ***"
echo ""
echo "WARNING: The RaspiBlitz cannot run 2 HDDs without extra Power!"
if [ -d "/mnt/hdd/bitcoin" ]; then
dialog --title "Fresh or Repair" --yesno "Do you want to delete the old/local blockchain data now?" 8 60
response=$?
echo "response(${response})"
if [ "${response}" = "1" ]; then
echo "OK - keep old blockchain - just try to repair by copying over it"
sleep 3
else
echo "OK - delete old blockchain"
# delete all IN bitcoin directory but not itself if it exists
# so that possibel link to /home/bitcoin/.bitcoin nicht beschädigt wird
# also keep debug logs for repair script
sudo mv /mnt/hdd/bitcoin/debug.log /home/admin/debug.log 2>/dev/null
sudo rm -rfv /mnt/hdd/bitcoin/* 2>/dev/null
sudo mv /home/admin/debug.log /mnt/hdd/bitcoin/debug.log 2>/dev/null
sleep 3
fi
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
echo
clear
echo "************************************************************************************"
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another computer"
echo "************************************************************************************"
echo ""
echo "You can use a Y cable for the second HDD to inject extra power."
echo "Like this one: https://www.amazon.de/dp/B00ZJBIHVY"
echo "If you see on LCD a error on connecting the 2nd HDD do a restart."
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 "You can use the HDD of another RaspiBlitz for this."
echo "The 2nd HDD needs to be formated Ext4/exFAT and the folder '${network}' is in root of HDD."
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 "**********************************"
echo "--> Please connect now the 2nd HDD"
echo "**********************************"
echo "Open a terminal on the source computer and change into the directory that contains the"
echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'indexes'".
echo "Make sure the bitcoin client on that computer is stopped."
echo ""
echo "If 2nd HDD is connected but setup does not continue,"
echo "then cancel (CTRL+c) and reboot."
ready=0
while [ ${ready} -eq 0 ]
do
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
if [ ${hddA} -eq 0 ]; then
echo "FAIL - connection to 1st HDD lost"
echo "It seems there was a POWEROUTAGE while connecting the 2nd HDD."
echo "Try to avoid this next time by adding extra Power or connect more securely."
echo "You need now to reboot with 'sudo shutdown -r now' and then try again."
exit 1
fi
hddB=$(lsblk | grep -c sdb1)
if [ ${hddB} -eq 1 ]; then
echo "OK - 2nd HDD found"
ready=1
fi
done
echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:"
if [ "${CHOICE}" = "WINDOWS" ]; then
echo "sudo scp -r ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
else
echo "sudo rsync -avhW --progress ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
fi
echo ""
echo "*** Mounting 2nd HDD ***"
sudo mkdir /mnt/genesis
echo "try ext4 .."
sudo mount -t ext4 /dev/sdb1 /mnt/genesis
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."
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."
sleep 2
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try exfat .."
sudo mount -t exfat /dev/sdb1 /mnt/genesis
sleep 2
read key
# 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
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "FAIL - not able to mount the 2nd HDD"
echo "only ext4 and exfat possible"
sleep 4
./10setupBlitz.sh
exit 1
if [ ${count} -lt 500 ]; then
echo "FAIL: less then 500 .ldb files (${count}) in /mnt/hdd/bitcoin/indexes/txindex (transfere seems invalid)"
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 "FAIL -> DATA seems incomplete."
else
echo "OK -> DATA LOOKS GOOD :D"
sudo rm /mnt/hdd/bitcoin/debug.log
fi
else
echo "OK - 2nd HDD mounted at /mnt/genesis"
echo "CANCEL -> NO DATA was copied."
quickCheckOK=0
fi
echo "*********************************************"
echo ""
echo "*** Copy Blockchain ***"
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin /mnt/hdd/
echo "cleaning up - ok if files do not exists"
sudo rm /mnt/hdd/${network}/${network}.conf
sudo rm /mnt/hdd/${network}/${network}.pid
sudo rm /mnt/hdd/${network}/banlist.dat
sudo rm /mnt/hdd/${network}/debug.log
sudo rm /mnt/hdd/${network}/fee_estimates.dat
sudo rm /mnt/hdd/${network}/mempool.dat
sudo rm /mnt/hdd/${network}/peers.dat
sudo rm /mnt/hdd/${network}/testnet3/banlist.dat
sudo rm /mnt/hdd/${network}/testnet3/debug.log
sudo rm /mnt/hdd/${network}/testnet3/fee_estimates.dat
sudo rm /mnt/hdd/${network}/testnet3/mempool.dat
sudo rm /mnt/hdd/${network}/testnet3/peers.dat
sudo umount -l /mnt/genesis
echo "OK - Copy done :)"
echo ""
echo "---> You can now disconnect the 2nd HDD"
# if started after intial setup - quit here
if [ "${setupStep}" = "100" ]; then
sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf
rpcpass=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep 'bitcoind.rpcpass' | cut -d "=" -f2)
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin/bitcoin.conf
sudo sed -i "s/^rpcpassword=.*/rpcpassword=${rpcpass}/g" /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null
sudo systemctl enable bitcoind
echo "DONE - rebooting: sudo shutdown -r now"
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."
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
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
sleep 2
fi
sleep 5
./60finishHDD.sh
# setup script will decide the next logical step
/home/admin/10setupBlitz.sh

14
home.admin/50downloadHDD.sh

@ -1,6 +1,9 @@
#!/bin/bash
echo ""
## get basic info
source /home/admin/raspiblitz.info
# *** BITCOIN (just mainnet) ***
bitcoinList="" # url to list with other sources
#bitcoinUrl="ftp://anonymous:anonymous@91.83.237.185:21/raspiblitz-bitcoin-2018-07-16"
@ -15,9 +18,6 @@ litecoinSize=22220000 # 22221160-tolerance
# NOTE TO GET THE SIZE RIGHT: for new download add 9999999999 as size. Run download.
# When finished the warning comes up and behind WARNING: copy that number
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
# settings based on network
list=$bitcoinList
url=$bitcoinUrl
@ -111,7 +111,7 @@ if [ ${isRunning} -eq 1 ]; then
echo "killing screen session PID(${sessionPID})"
# kill all child processes of screen sceesion
pkill -P ${sessionPID}
echo "proccesses klilled"
echo "proccesses killed"
sleep 3
# tell the screen session to quit and wait a bit
screen -S ${name} -X quit 1>/dev/null
@ -141,7 +141,7 @@ if [ ${finalSize} -lt ${targetSize} ]; then
dialog --title " WARNING (${finalSize}) " --yesno "The download failed or is not complete. Maybe try again (later). Do you want keep already downloaded data for next try?" 8 57
response=$?
case $response in
1) sudo rm -rf ${targetDir} ;;
1) sudo rm -rf /mnt/hdd/download ;;
esac
./00mainMenu.sh
exit 1;
@ -153,7 +153,11 @@ else
sudo mv ${targetDir}${targetPath} /mnt/hdd/${network}
echo "OK"
if [ ${setupStep} -lt 100 ]; then
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# continue setup
./60finishHDD.sh
fi
fi

25
home.admin/50syncHDD.sh

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

174
home.admin/50torrentHDD.old.sh

@ -1,174 +0,0 @@
#!/bin/bash
echo ""
# --> TODO: Check https://getbitcoinblockchain.com/
# *** BITCOIN Torrent ***
bitcoinTorrent="raspiblitz-bitcoin-2018-10-06"
bitcoinTorrentsize=259000000
# *** LITECOIN Torrent ***
litecoinTorrent="raspiblitz-litecoin-2018-07-29"
litecoinTorrentsize=10240000
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
## experimental redirect if bitcoin
if [ "$network" = "bitcoin" ]; then
./50torrentHDD.bitcoin.sh
exit 1
fi
# make sure rtorrent is available
sudo apt-get install rtorrent -y
echo ""
# settings based on network
torrent=$bitcoinTorrent
size=$bitcoinTorrentsize
if [ "$network" = "litecoin" ]; then
torrent=$litecoinTorrent
size=$litecoinTorrentsize
fi
# screen background monitoring settings
name="Torrent"
targetDir="/mnt/hdd/torrent"
targetSize=$size
sessionDir="/home/admin/.rtorrent.session/"
command="sudo rtorrent -n -d ${targetDir} -s ${sessionDir} /home/admin/assets/${torrent}.torrent"
# 2 screen sessions - differnt rtorrent session dir?
#sudo rtorrent -n -d /mnt/hdd/torrent -s /home/admin/.rtorrent.session/ https://getbitcoinblockchain.com/blockchain.torrent
#sudo rtorrent -n -d /mnt/hdd/torrent -s /home/admin/.rtorrent.session/ https://getbitcoinblockchain.com/update.torrent
# starting screen session if needed
echo "checking if ${name} has a running screen session"
screen -wipe 1>/dev/null
isRunning=$( screen -S ${name} -ls | grep "${name}" -c )
echo "isRunning(${isRunning})"
if [ ${isRunning} -eq 0 ]; then
echo "Starting screen session"
sudo mkdir ${targetDir} 2>/dev/null
sudo mkdir ${sessionDir} 2>/dev/null
screenCommand="screen -S ${name} -L screen.log -dm ${command}"
echo "${screenCommand}"
bash -c "${screenCommand}"
else
echo "Continue screen session"
fi
sleep 3
# monitor screen session
screenDump="... started ..."
actualSize=0
torrentComplete=0
while :
do
# check if completed by inspecting rtorrent session files
torrentComplete=$(cat /home/admin/.rtorrent.session/*.torrent.rtorrent | grep ':completei1' -c)
if [ ${torrentComplete} -eq 1 ]; then
echo "OK - torrent finished"
break
fi
# calculate progress and write it to file for LCD to read
freshSize=$( du -s ${targetDir} | head -n1 | awk '{print $1;}' )
if [ ${#actualSize} -eq 0 ]; then
freshSize=0
fi
progress=$(echo "scale=2; $freshSize*100/$targetSize" | bc)
echo $progress > ".${name}.progress"
actualSize=$freshSize
# display info screen
clear
echo "****************************************************"
echo "Monitoring Screen Session: ${name}"
echo "Progress: ${progress}% (${actualSize} of ${targetSize})"
echo "If needed press key x to stop ${name}"
echo "NOTICE: This can take multiple hours or days !!"
echo "Its OK to close terminal now and SSH back in later."
echo "****************************************************"
screen -S ${name} -X hardcopy .${name}.out
newScreenDump=$(cat .${name}.out | grep . | tail -8)
if [ ${#newScreenDump} -gt 0 ]; then
screenDump=$newScreenDump
fi
echo "$screenDump"
# 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 "Aborting ${name}"
break
fi
done
# clean up
rm -f .${name}.out
rm -f .${name}.progress
# quit session if still running
isRunning=$( screen -S ${name} -ls | grep "${name}" -c )
if [ ${isRunning} -eq 1 ]; then
# get the PID of screen session
sessionPID=$(screen -ls | grep "${name}" | cut -d "." -f1 | xargs)
echo "killing screen session PID(${sessionPID})"
# kill all child processes of screen sceesion
sudo pkill -P ${sessionPID}
echo "proccesses killed"
sleep 3
# tell the screen session to quit and wait a bit
screen -S ${name} -X quit 1>/dev/null
sleep 3
echo "cleaning screen"
screen -wipe 1>/dev/null
sleep 3
fi
# the path torrent will download to
targetPath="${targetDir}/${torrent}"
echo "path to downloaded data is ${targetPath}"
# calculate progress and write it to file for LCD to read
finalSize=$( du -s ${targetDir} 2>/dev/null | head -n1 | awk '{print $1;}' )
if [ ${#finalSize} -eq 0 ]; then
finalSize=0
fi
echo "final size is ${finalSize} of targeted size ${targetSize}"
# check result
if [ ${finalSize} -lt ${targetSize} ]; then
# Download failed
sleep 3
echo -ne '\007'
dialog --title " WARNING " --yesno "The download failed or is not complete. Maybe try again (later). Do you want keep already downloaded data for next try?" 8 57
response=$?
case $response in
1) sudo rm -rf ${targetDir} ;;
esac
./00mainMenu.sh
exit 1;
else
# Download worked / just move, copy on USB2 >4h
echo "*** Moving Files ***"
echo "START"
date +%s
sudo mv ${targetPath} /mnt/hdd/${network}
echo "OK"
date +%s
# continue setup
./60finishHDD.sh
fi

48
home.admin/50torrentHDD.sh

@ -5,7 +5,15 @@ echo ""
# why there are two torrent files
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /home/admin/raspiblitz.info
# if setup was done - remove old data
if [ "${setupStep}" = "100" ]; then
echo "stopping services ..."
sudo systemctl stop lnd
sudo systemctl stop ${network}d
fi
# make sure rtorrent is available
sudo apt-get install rtorrent -y
@ -19,7 +27,7 @@ echo "*** Torrent Files ***"
# WITHOUT THE '.torrent' ENDING
bitcoinBase="raspiblitz-bitcoin1-2018-10-13-base"
bitcoinUpdate="raspiblitz-bitcoin1-2018-11-18-update"
bitcoinUpdate="raspiblitz-bitcoin1-2019-01-16-update"
litecoinBase="raspiblitz-litecoin1-2018-11-18-base"
litecoinUpdate="raspiblitz-litecoin1-2018-11-18-update"
@ -232,7 +240,7 @@ targetPath2="${targetDir}/${updateTorrentFile}"
# check that path exists
contentPath1=$(sudo ls ${targetPath1} 2>/dev/null)
contentPath2=$(sudo ls ${targetPath1} 2>/dev/null)
contentPath2=$(sudo ls ${targetPath2} 2>/dev/null)
if [ ${#contentPath1} -eq 0 ]; then
torrentError=3
fi
@ -245,7 +253,7 @@ if [ ${torrentError} -gt 0 ]; then
# User Cancel --> Torrent incomplete
sleep 3
echo -ne '\007'
dialog --title " WARNING (${torrentError})" --yesno "The Torrent download failed or is not complete - maybe try FTP download next time. Do you want keep already downloaded torrent data?" 8 57
dialog --title " WARNING (${torrentError})" --yesno "The Torrent download failed or is not complete - maybe try COPY option. Do you want keep already downloaded torrent data?" 8 57
response=$?
case $response in
1) sudo rm -rf ${targetDir}; sudo rm -rf ${sessionDir} ;;
@ -255,12 +263,22 @@ if [ ${torrentError} -gt 0 ]; then
fi
# Download worked / just move, copy on USB2 >4h
# 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
sudo rm /mnt/hdd/${network}/debug.log
fi
# Download worked / just move, copy on USB2 would be >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}/
@ -268,5 +286,17 @@ sudo rm -r ${targetDir}
echo "OK"
date +%s
# continue setup
./60finishHDD.sh
if [ "${setupStep}" = "100" ]; then
sudo cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf
rpcpass=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "${network}d.rpcpass" | cut -d "=" -f2)
sudo sed -i "s/^rpcpassword=.*/rpcpassword=${rpcpass}/g" /mnt/hdd/${network}/${network}.conf 2>/dev/null
sudo chown -R bitcoin:bitcoin /mnt/hdd/${network}/
sudo systemctl enable ${network}d
echo "DONE - rebooting: sudo shutdown -r now"
sudo shutdown -r now
else
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# continue setup
./60finishHDD.sh
fi

2
home.admin/60finishHDD.sh

@ -2,7 +2,7 @@
echo ""
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /home/admin/raspiblitz.info
echo "*** Checking HDD ***"
mountOK=$(df | grep -c /mnt/hdd)

52
home.admin/70initLND.sh

@ -2,14 +2,15 @@
echo ""
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# verify that bitcoin is running
echo "*** Checking ${network} ***"
bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running)
if [ ${bitcoinRunning} -eq 0 ]; then
#doublecheck
bitcoinRunning=$(${network}-cli getblockchaininfo | grep -c verificationprogress)
bitcoinRunning=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | grep -c verificationprogress)
fi
if [ ${bitcoinRunning} -eq 0 ]; then
# HDD is not available yet
@ -27,7 +28,7 @@ echo "*** Wait until ${network}d is ready ..."
while [ ${chainIsReady} -eq 0 ]
do
loopCount=$(($loopCount +1))
result=$(${network}-cli getblockchaininfo 2>error.out)
result=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>error.out)
error=`cat error.out`
rm error.out
if [ ${#error} -gt 0 ]; then
@ -75,7 +76,7 @@ echo ""
###### Start LND
echo "*** Starting LND ***"
lndRunning=$(systemctl status lnd.service 2>/dev/null | grep -c running)
lndRunning=$(sudo systemctl status lnd.service 2>/dev/null | grep -c running)
if [ ${lndRunning} -eq 0 ]; then
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.service
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.service
@ -83,15 +84,15 @@ if [ ${lndRunning} -eq 0 ]; then
sudo chmod +x /etc/systemd/system/lnd.service
sudo systemctl enable lnd
sudo systemctl start lnd
echo "Starting LND ... give 120 seconds to init."
sleep 120
echo ""
dialog --pause " Starting LND - please wait .." 8 58 120
fi
###### Check LND is running
lndRunning=0
while [ ${lndRunning} -eq 0 ]
do
lndRunning=$(systemctl status lnd.service | grep -c running)
lndRunning=$(sudo systemctl status lnd.service | grep -c running)
if [ ${lndRunning} -eq 0 ]; then
date +%s
echo "LND not ready yet ... waiting another 60 seconds."
@ -157,8 +158,7 @@ Press OK and follow the 'Helping Instructions'.
sudo sed -i "s/^setupStep=.*/setupStep=65/g" /home/admin/raspiblitz.info
fi
echo "--> lets wait 60 seconds for LND to get ready"
sleep 60
dialog --pause " Waiting for LND - please wait .." 8 58 60
###### Copy LND macaroons to admin
echo ""
@ -206,40 +206,6 @@ else
echo "OK - Wallet is already unlocked"
fi
#### Show Lighthning Sync
#echo ""
#echo "*** Check LND Sync ***"
#item=0
#lndSyncing=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
#if [ ${lndSyncing} -eq 0 ]; then
# echo "OK - wait for LND to be synced"
# while :
# do
#
# # show sync status
# ./80scanLND.sh
# sleep 15
#
# # break loop when synced
# lndSyncing=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
# if [ ${lndSyncing} -eq 1 ]; then
# break
# fi
#
# # break loop when wallet is locked
# locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c unlock)
# if [ ${locked} -eq 1 ]; then
# break
# fi
#
# sleep 15
#
# done
# clear
#else
# echo "OK - LND is in sync"
#fi
# set SetupState (scan is done - so its 80%)
sudo sed -i "s/^setupStep=.*/setupStep=80/g" /home/admin/raspiblitz.info

3
home.admin/80scanLND.sh

@ -1,3 +1,6 @@
#!/bin/bash
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
### USER PI AUTOSTART (LCD Display)

13
home.admin/90finishSetup.sh

@ -66,26 +66,19 @@ sudo ufw allow 8080 comment 'lightning REST API'
echo "allow: trasmission"
sudo ufw allow 51413 comment 'transmission'
echo "allow: local web admin"
sudo ufw allow from 192.168.0.0/24 to any port 80 comment 'allow local LAN web'
sudo ufw allow from 192.168.0.0/16 to any port 80 comment 'allow local LAN web'
echo "open firewall for auto nat discover (see issue #129)"
sudo ufw allow proto udp from 192.168.0.0/24 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
sudo ufw allow proto udp from 192.168.0.0/16 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
echo "enable lazy firewall"
sudo ufw --force enable
echo ""
# set raspi config as environment for lnd service
sudo systemctl stop lnd
sudo systemctl disable lnd
sudo sed -i "s/^EnvironmentFile=.*/EnvironmentFile=\/mnt\/hdd\/raspiblitz.conf/g" /etc/systemd/system/lnd.service
sudo systemctl enable lnd
# update system
echo ""
echo "*** Update System ***"
sudo apt-mark hold raspberrypi-bootloader
sudo apt-get update
sudo apt-get upgrade -f -y --allow-change-held-packages
echo "OK - System is now up to date"
# mark setup is done
sudo sed -i "s/^setupStep=.*/setupStep=90/g" /home/admin/raspiblitz.info
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info

23
home.admin/95finalSetup.sh

@ -19,35 +19,22 @@ dialog --backtitle "RaspiBlitz - Setup" --title " RaspiBlitz Setup is done :) "
Press OK for a final reboot.
" 10 42
# init the RASPIBLITZ Config
echo "# RASPIBLITZ CONFIG FILE" > $configFile
echo "raspiBlitzVersion='${codeVersion}'" >> $configFile
sudo chmod 777 ${configFile}
# transfer data from SD info file
echo "hostname=${hostname}" >> $configFile
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
# let migration/init script do the rest
/home/admin/_bootstrap.migration.sh
# copy logfile to analyse setup
cp $logFile /home/admin/raspiblitz.setup.log
# set the hostname inputed on initDialog
if [ ${#hostname} -gt 0 ]; then
echo "Setting new network hostname '$hostname'"
sudo raspi-config nonint do_hostname ${hostname}
else
echo "WARN: hostname not set"
fi
# set the name of the node
echo "Setting the Name/Alias/Hostname .."
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
# mark setup is done (100%)
# mark setup is done
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
clear
echo "Setup done. Rebooting now."
sudo -u bitcoin ${network}-cli stop
sleep 3
sudo shutdown -r now

1
home.admin/97addMobileWallet.sh

@ -1,6 +1,7 @@
#!/bin/bash
# get raspiblitz config
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# check if dynamic domain is set

6
home.admin/97addMobileWalletShango.sh

@ -1,6 +1,7 @@
#!/bin/bash
# load raspiblitz config data (with backup from old config)
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# make sure qrcode-encoder in installed
@ -41,7 +42,8 @@ read key
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 && cat ./.lnd/tls.cert >>qr.txt && qrencode -t ANSI256 < qr.txt
#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
shred qr.txt

69
home.admin/97addMobileWalletZap.sh

@ -1,23 +1,56 @@
#!/bin/bash
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# make sure qrcode-encoder in installed
# 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
goVersion="1.11"
echo "### Check Framework: GO ###"
goInstalled=$(go version 2>/dev/null | grep -c 'go')
if [ ${goInstalled} -eq 0 ];then
echo "---> Installing GO"
wget https://storage.googleapis.com/golang/go${goVersion}.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go${goVersion}.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)"
sleep 4
exit 1
fi
clear
correctGoVersion=$(go version | grep -c "go${goVersion}")
if [ ${correctGoVersion} -eq 0 ]; then
echo "WARNING: You work with a untested version of GO - should be ${goVersion} .. trying to continue"
go version
sleep 6
echo ""
fi
# make sure qrcode-encoder in installed
echo "*** Setup ***"
echo ""
echo "Installing zapconnect. Please wait..."
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/usr/local/gocode
export PATH=$PATH:$GOPATH/bin
echo "Installing zapconnect."
echo ""
echo "Getting github.com/LN-Zap/zapconnect (please wait) ..."
cd $GOPATH/src/github.com/LN-Zap/zapconnect
go get -d github.com/LN-Zap/zapconnect
echo "Getting github.com/LN-Zap/lndconnect (please wait - can take several minutes) ..."
go get -d github.com/LN-Zap/lndconnect
cd $GOPATH/src/github.com/LN-Zap/lndconnect
echo ""
echo "Building github.com/LN-Zap/zapconnect ..."
echo "Building github.com/LN-Zap/lndconnect ..."
make
cd
sleep 3
@ -29,10 +62,10 @@ echo "******************************"
echo ""
echo "GETTING THE APP"
echo "At the moment this app is in closed beta testing and the source code has not been published yet."
echo "Go to http://www.zap-ios.jackmallers.com sign up with your email (confirmation can take time)"
echo "iOS: Read https://developer.apple.com/testflight/testers/"
echo "1. Install the app 'TestFlight' from Apple Appstore. Open it and agree to all terms of services."
echo "2. Open on your iOS device https://github.com/LN-Zap/zap-iOS and follow 'Download the Alpha'"
echo ""
echo "*** STEP 1 ***"
echo "*** PAIRING 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
@ -44,14 +77,14 @@ echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it
read key
clear
echo "*** STEP 2 : Click on Scan (make whole QR code fill camera) ***"
echo "*** PAIRING STEP 2 : Click on Scan (make whole QR code fill camera) ***"
if [ ${#dynDomain} -eq 0 ]; then
# If you drop the -i parameter, zapconnect will use the external IP.
zapconnect -i
# If you drop the -i parameter, lndconnect will use the external IP.
lndconnect -i
else
# when dynamic domain is set
zapconnect --host=${dynDomain}
lndconnect --host=${dynDomain}
fi
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished."
@ -60,5 +93,5 @@ read key
clear
echo "If its not working - check issues on GitHub:"
echo "https://github.com/LN-Zap/zap-iOS/issues"
echo "https://github.com/LN-Zap/zapconnect/issues"
echo "https://github.com/LN-Zap/lndconnect/issues"
echo ""

4
home.admin/AAunlockLND.sh

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

6
home.admin/BBcashoutWallet.sh

@ -5,8 +5,10 @@ _error="./.error.out"
echo "please wait ..."
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
fi
@ -46,7 +48,7 @@ l1="Enter on-chain address to send confirmed funds to:"
l2="You will send: ${maxAmount} sat"
l3="Maximal fee: 20000 sat (wil be subtracted)"
dialog --title "Where to send funds?" \
--inputbox "$l1\n$l2\n$l3" 8 75 2>$_temp
--inputbox "$l1\n$l2\n$l3" 9 75 2>$_temp
if test $? -eq 0
then
echo "ok pressed"

4
home.admin/BBcloseAllChannels.sh

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

4
home.admin/BBconnectPeer.sh

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

4
home.admin/BBcreateInvoice.sh

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

4
home.admin/BBfundWallet.sh

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

4
home.admin/BBopenChannel.sh

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

17
home.admin/BBpayInvoice.sh

@ -3,8 +3,10 @@ _temp="./download/dialog.$$"
_error="./.error.out"
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
@ -12,6 +14,7 @@ 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)
@ -79,9 +82,11 @@ command="lncli --chain=${network} --network=${chain}net sendpayment --force --pa
# info output
clear
echo "******************************"
echo "************************************************************"
echo "Pay Invoice / Payment Request"
echo "******************************"
echo "This script is as an example how to use the lncli interface."
echo "Its not optimized for performance or error handling."
echo "************************************************************"
echo ""
echo "COMMAND LINE: "
echo $command
@ -95,9 +100,15 @@ error=`cat ${_error}`
#echo "result(${result})"
#echo "error(${error})"
resultIsError=$(echo "${result}" | grep -c "payment_error")
if [ ${resultIsError} -gt 0 ]; then
error="${result}"
fi
if [ ${#error} -gt 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "FAIL"
echo "try with a wallet app or the RTL WebGUI (see services)"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "${error}"
else

100
home.admin/XXcleanHDD.sh

@ -1,29 +1,75 @@
#!/bin/bash
echo ""
echo "!!!! This will DELETE your data & POSSIBLE FUNDS from the HDD !!!!"
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
read key
sudo dphys-swapfile swapoff
sudo systemctl stop bitcoind.service 2>/dev/null
sudo systemctl stop litecoind.service 2>/dev/null
sudo systemctl stop lnd.service 2>/dev/null
sudo rm -f -r /mnt/hdd/lnd
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
extraParameter="$1"
if [ "${extraParameter}" = "-all" ]; then
echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
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
# delete plain all on HDD
echo "cleaning HDD ... (please wait)"
sudo rm -rfv /mnt/hdd/*
else
echo "!!!! This will DELETE your personal data & POSSIBLE FUNDS from the HDD !!!!"
echo "--> It will keep Blockchain data - so you dont have to download/copy again."
echo "--> If you want to delete also blockchain data, please run with '-all' parameter."
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 "*************************"
echo "reboot -> sudo shutdown -r now"
echo "power off -> sudo shutdown now"

15
home.admin/XXdebugLogs.sh

@ -6,7 +6,8 @@
source /home/admin/_version.info
## get basic info (its OK if not set yet)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# for old nodes
if [ ${#network} -eq 0 ]; then
@ -39,7 +40,10 @@ echo "*** CHAINNETWORK SYSTEMD STATUS ***"
sudo systemctl status ${network}d -n2 --no-pager
echo ""
echo "*** LAST 20 CHAINNETWORK LOGS ***"
echo "*** LAST 5 ERROR LOGS ***"
sudo journalctl -u ${network}d -b --no-pager -n5
echo ""
echo "*** LAST 20 INFO LOGS ***"
pathAdd=""
if [ "${chain}" = "test" ]; then
pathAdd="/testnet3"
@ -51,8 +55,11 @@ echo "*** LND SYSTEMD STATUS ***"
sudo systemctl status lnd -n2 --no-pager
echo ""
echo "*** LAST 20 LND LOGS ***"
sudo journalctl -u lnd -b --no-pager -n20
echo "*** LAST 5 LND ERROR LOGS ***"
sudo journalctl -u lnd -b --no-pager -n5
echo ""
echo "*** LAST 20 LND INFO LOGS ***"
sudo tail -n 20 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log
echo ""
if [ "${rtlWebinterface}" = "on" ]; then

16
home.admin/XXprepareRelease.sh

@ -0,0 +1,16 @@
#!/bin/bash
# Just run this script once after a fresh sd card build
# to prepare the image for release as a downloadable sd card image
# SSH Pubkeys (make uniquie for every sd card image install)
echo "deleting SSH Pub keys ..."
echo "they will get recreated on fresh bootup, by _bootstrap.sh service"
sudo rm /etc/ssh/ssh_host_*
echo "OK"
echo " "
echo "Will shutdown now."
echo "Wait until Raspberry LEDs show no activity anymore."
echo "Then remove SD card and make an release image from it."
sudo shutdown now

72
home.admin/XXsyncScripts.sh

@ -0,0 +1,72 @@
#!/bin/bash
# This is for developing on your RaspiBlitz.
# THIS IS NOT THE REGULAR UPDATE MECHANISM
# and can lead to dirty state of your scripts.
# IF YOU WANT TO UPDATE YOUR RASPIBLITZ:
# https://github.com/rootzoll/raspiblitz/blob/master/FAQ.md#how-to-update-my-raspiblitz-after-version-098
cd /home/admin/raspiblitz
# change branch if set as parameter
clean=0
wantedBranch="$1"
if [ "${wantedBranch}" = "-clean" ]; then
clean=1
wantedBranch="$2"
fi
if [ "$2" = "-clean" ]; then
clean=1
fi
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
if [ ${#wantedBranch} -gt 0 ]; then
echo "your wanted branch is: ${wantedBranch}"
echo "your active branch is: ${activeBranch}"
if [ "${wantedBranch}" = "${activeBranch}" ]; then
echo "OK"
else
echo "try changing branch .."
git checkout ${wantedBranch}
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
fi
else
echo ""
echo "USAGE-INFO: ./XXsyncScripts.sh '[BRANCHNAME]'"
fi
origin=$(git remote -v | grep 'origin' | tail -n1)
echo ""
echo "*** SYNCING SHELL SCRIPTS WITH GITHUB ***"
echo "This is for developing on your RaspiBlitz."
echo "THIS IS NOT THE REGULAR UPDATE MECHANISM"
echo "and can lead to dirty state of your scripts."
echo "REPO ----> ${origin}"
echo "BRANCH --> ${activeBranch}"
echo "******************************************"
git pull
cd ..
if [ ${clean} -eq 1 ]; then
echo "Cleaning scripts & assets/config.scripts"
rm *.sh
rm -r assets
mkdir assets
rm -r config.scripts
mkdir config.scripts
else
echo "******************************************"
echo "NOT cleaning/deleting old files"
echo "use parameter '-clean' if you want that next time"
echo "******************************************"
fi
echo "COPYING from GIT-Directory to /home/admin/ .."
sudo -u admin cp -f /home/admin/raspiblitz/home.admin/*.* /home/admin
sudo -u admin chmod +x *.sh
sudo -u admin cp -f /home/admin/raspiblitz/home.admin/assets/*.* /home/admin/assets
sudo -u admin cp -f /home/admin/raspiblitz/home.admin/config.scripts/*.* /home/admin/config.scripts
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
echo "******************************************"
echo "OK - shell scripts and assests are synced"
echo "Reboot recommended"
echo ""

43
home.admin/XXupdateScripts.sh

@ -1,43 +0,0 @@
#!/bin/bash
cd /home/admin/raspiblitz
# change branch if set as parameter
wantedBranch="$1"
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
if [ ${#wantedBranch} -gt 0 ]; then
echo "your wanted branch is: ${wantedBranch}"
echo "your active branch is: ${activeBranch}"
if [ "${wantedBranch}" = "${activeBranch}" ]; then
echo "OK"
else
echo "try changing branch .."
git checkout ${wantedBranch}
activeBranch=$(git branch | grep \* | cut -d ' ' -f2)
fi
else
echo ""
echo "USAGE-INFO: ./XXupdateScripts.sh '[BRANCHNAME]'"
fi
origin=$(git remote -v | grep 'origin' | tail -n1)
echo ""
echo "*** UPDATING SHELL SCRIPTS FROM GITHUB ***"
echo "justincase, not the final upadte mechanism"
echo "REPO ----> ${origin}"
echo "BRANCH --> ${activeBranch}"
echo "******************************************"
git pull
cd ..
rm *.sh
rm -r assets
sudo -u admin cp /home/admin/raspiblitz/home.admin/*.* /home/admin
sudo -u admin chmod +x *.sh
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
echo "******************************************"
echo "OK - shell scripts and assests are up to date"
echo "Reboot recommended"
echo ""

57
home.admin/_background.sh

@ -16,6 +16,8 @@ configFile="/mnt/hdd/raspiblitz.conf"
configExists=$(ls ${configFile} | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
source ${configFile}
else
source ${infoFile}
fi
echo "_background.sh STARTED"
@ -58,6 +60,25 @@ do
fi
####################################################
# CHECK FOR UNDERVOLTAGE REPORTS
# every 1 hour scan for undervoltage reports
####################################################
recheckUndervoltage=$(($counter % 3600))
if [ ${recheckUndervoltage} -eq 1 ]; then
echo "*** RECHECK UNDERVOLTAGE ***"
countReports=$(sudo cat /var/log/syslog | grep -c "Under-voltage detected!")
echo "${countReports} undervoltage reports found in syslog"
if [ ${#undervoltageReports} -eq 0 ]; then
# write new value to info file
undervoltageReports="${countReports}"
echo "undervoltageReports=${undervoltageReports}" >> ${infoFile}
else
# update value in info file
sed -i "s/^undervoltageReports=.*/undervoltageReports=${countReports}/g" ${infoFile}
fi
fi
####################################################
# RECHECK PUBLIC IP
# when public IP changes, restart LND with new IP
@ -78,8 +99,24 @@ do
echo "freshPublicIP(${freshPublicIP})"
echo "publicIP(${publicIP})"
# sanity check on IP data
# see https://github.com/rootzoll/raspiblitz/issues/371#issuecomment-472416349
echo "-> sanity check of IP data: ${freshPublicIP}"
if [[ $freshPublicIP =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then
echo "OK IPv6"
elif [[ $freshPublicIP =~ ^([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then
echo "OK IPv4"
else
echo "FAIL - not an IPv4 or IPv6 address"
freshPublicIP=""
fi
if [ ${#freshPublicIP} -eq 0 ]; then
echo "freshPublicIP is ZERO - ignoring"
# check if changed
if [ "${freshPublicIP}" != "${publicIP}" ]; then
elif [ "${freshPublicIP}" != "${publicIP}" ]; then
# 1) update config file
echo "update config value"
@ -125,19 +162,9 @@ do
echo "STARTING AUTO-UNLOCK ..."
# building REST command
passwordC=$(cat /root/lnd.autounlock.pwd)
sudo python /home/admin/config.scripts/lnd.unlock.py $passwordC
#walletPasswordBase64=$(cat /root/lnd.autounlock.pwd | tr -d '\n' | base64 -w0)
#MACAROON_HEADER="Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon)"
#POSTDATA="'{ \"wallet_password\":\"${walletPasswordBase64}\" }'"
#echo "MACAROON:${MACAROON_HEADER}"
#echo "POSTDATA:${POSTDATA}"
#command="sudo sh -c "curl -X POST -d ${POSTDATA} --cacert /home/bitcoin/.lnd/tls.cert --header \"$MACAROON_HEADER\" https://localhost:8080/v1/unlockwallet"
#echo "COMMAND:${command}"
#result=$(echo \"restlisten=\" >> /mnt/hdd/lnd/lnd.conf")
#echo "RESULT:${result}"
passwordC=$(sudo cat /root/lnd.autounlock.pwd)
command="sudo python /home/admin/config.scripts/lnd.unlock.py '${passwordC}'"
bash -c "${command}"
else
echo "lncli says not locked"
fi
@ -160,7 +187,7 @@ do
if [ ${updateDynDomain} -eq 1 ]; then
echo "*** UPDATE DYNAMIC DOMAIN ***"
# check if update URL for dyn Domain is set
if [ ${#dynUpdateUrl} -gt 0 ]; then
if [ ${#dynUpdateUrl} -gt 6 ]; then
# calling the update url
echo "calling: ${dynUpdateUrl}"
echo "to update domain: ${dynDomain}"

30
home.admin/_bootstrap.migration.sh

@ -78,6 +78,36 @@ echo "default values OK" >> ${logFile}
# this is the place if on a future version change
# a conversion of config data or app data is needed
# if old bitcoin.conf exists ...
configExists=$(sudo ls /mnt/hdd/bitcoin/bitcoin.conf | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
echo "Checking old bitcoin.conf ..." >> ${logFile}
# make sure to fix bitcoind RPC port if not done in old version
# https://github.com/rootzoll/raspiblitz/issues/217
settingExists=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep -c 'rpcport=')
if [ ${settingExists} -eq 0 ]; then
echo "fix issue #217 -> adding rpcport=8332" >> ${logFile}
echo "rpcport=8332" >> /mnt/hdd/bitcoin/bitcoin.conf
else
echo "check issue #217 -> ok rpcport exists" >> ${logFile}
fi
settingExists=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep -c 'rpcallowip=')
if [ ${settingExists} -eq 0 ]; then
echo "fix issue #217 -> adding rpcallowip=127.0.0.1" >> ${logFile}
echo "rpcallowip=127.0.0.1" >> /mnt/hdd/bitcoin/bitcoin.conf
else
echo "check issue #217 -> ok rpcallowip exists" >> ${logFile}
fi
settingExists=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep -c 'rpcbind=')
if [ ${settingExists} -eq 0 ]; then
echo "fix issue #217 -> adding rpcbind=127.0.0.1:8332" >> ${logFile}
echo "rpcbind=127.0.0.1:8332" >> /mnt/hdd/bitcoin/bitcoin.conf
else
echo "check issue #217 -> ok rpcbind exists" >> ${logFile}
fi
fi
echo "Version Code: ${codeVersion}" >> ${logFile}
echo "Version Data: ${raspiBlitzVersion}" >> ${logFile}

29
home.admin/_bootstrap.provision.sh

@ -46,6 +46,17 @@ sudo umount -l /mnt/hdd >> ${logFile} 2>&1
echo "Auto-Mounting HDD - calling script" >> ${logFile}
/home/admin/40addHDD.sh >> ${logFile} 2>&1
# link old SSH PubKeys
# so that client ssh_known_hosts is not complaining after update
if [ -d "/mnt/hdd/ssh" ]; then
echo "Old SSH PubKey exists on HDD > just linking them" >> ${logFile}
else
echo "No SSH PubKey exists on HDD > copy from SD card and linking them" >> ${logFile}
sudo cp -r /etc/ssh /mnt/hdd/ssh >> ${logFile} 2>&1
fi
sudo rm -rf /etc/ssh >> ${logFile} 2>&1
sudo ln -s /mnt/hdd/ssh /etc/ssh >> ${logFile} 2>&1
# link and copy HDD content into new OS
echo "Link HDD content for user bitcoin" >> ${logFile}
sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd >> ${logFile} 2>&1
@ -145,5 +156,23 @@ else
echo "Provisioning TOR - keep default" >> ${logFile}
fi
# CUSTOM PORT
echo "Provisioning LND Port" >> ${logFile}
lndPort=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':')
if [ ${#lndPort} -gt 0 ]; then
if [ "${lndPort}" != "9735" ]; then
echo "User is running custom LND port: ${lndPort}" >> ${logFile}
sudo /home/admin/config.scripts/lnd.setport.sh ${lndPort} >> ${logFile} 2>&1
else
echo "User is running standard LND port: ${lndPort}" >> ${logFile}
fi
else
echo "Was not able to get LND port from config." >> ${logFile}
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}

125
home.admin/_bootstrap.sh

@ -1,6 +1,6 @@
#!/bin/bash
# This script runs on every start calles by boostrap.service
# This script runs on every start called by boostrap.service
# It makes sure that the system is configured like the
# default values or as in the config.
# For more details see background_raspiblitzSettings.md
@ -19,6 +19,8 @@ source /home/admin/_version.info
# CONFIGFILE - configuration of RaspiBlitz
# used by fresh SD image to recover configuration
# and delivers basic config info for scripts
# make raspiblitz.conf if not there
sudo touch /mnt/hdd/raspiblitz.conf
configFile="/mnt/hdd/raspiblitz.conf"
# LOGFILE - store debug logs of bootstrap
@ -36,13 +38,60 @@ echo "Running RaspiBlitz Bootstrap ${codeVersion}" >> $logFile
date >> $logFile
echo "***********************************************" >> $logFile
# display 3 secs logo - try to kickstart LCD
# see https://github.com/rootzoll/raspiblitz/issues/195#issuecomment-469918692
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/raspiblitz/pictures/logoraspiblitz.png
sleep 5
sudo killall -3 fbi
# set default values for raspiblitz.info
network=""
chain=""
setupStep=0
# try to load old values if available (overwrites defaults)
source ${infoFile} 2>/dev/null
# resetting info file
echo "Resetting the InfoFile: ${infoFile}"
echo "state=starting" > $infoFile
echo "network=" >> $infoFile
echo "chain=" >> $infoFile
echo "message=" >> $infoFile
echo "network=${network}" >> $infoFile
echo "chain=${chain}" >> $infoFile
echo "setupStep=${setupStep}" >> $infoFile
if [ "${setupStep}" != "100" ]; then
echo "hostname=${hostname}" >> $infoFile
fi
sudo chmod 777 ${infoFile}
# Emergency cleaning logs when over 1GB (to prevent SD card filling up)
# see https://github.com/rootzoll/raspiblitz/issues/418#issuecomment-472180944
echo "*** Checking Log Size ***"
logsMegaByte=$(sudo du -c -m /var/log | grep "total" | awk '{print $1;}')
if [ ${logsMegaByte} -gt 1000 ]; then
echo "WARN !! Logs /var/log in are bigger then 1GB"
echo "ACTION --> DELETED ALL LOGS"
sudo rm -r /var/log/*
sleep 3
echo "WARN !! Logs in /var/log in were bigger then 1GB and got emergency delete to prevent fillup."
echo "If you see this in the logs please report to the GitHub issues, so LOG config needs to hbe optimized."
else
echo "OK - logs are at ${logsMegaByte} MB - within safety limit"
fi
echo ""
################################
# GENERATE UNIQUE SSH PUB KEYS
# on first boot up
################################
numberOfPubKeys=$(sudo ls /etc/ssh/ | grep -c 'ssh_host_')
if [ ${numberOfPubKeys} -eq 0 ]; then
echo "*** Generating new SSH PubKeys" >> $logFile
sudo dpkg-reconfigure openssh-server
echo "OK" >> $logFile
fi
################################
# AFTER BOOT SCRIPT
# when a process needs to
@ -185,7 +234,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
echo "OK - No config file found: ${configFile}" >> $logFile
fi
# check if HDD cointains existing LND data (old RaspiBlitz Version)
# check if HDD contains existing LND data (old RaspiBlitz Version)
echo "Check if HDD contains existing LND data .." >> $logFile
lndDataExists=$(ls /mnt/hdd/lnd/lnd.conf | grep -c '.conf')
if [ ${lndDataExists} -eq 1 ]; then
@ -218,13 +267,15 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
# check if pre-sync was already activated on last power-on
#presyncActive=$(systemctl status bitcoind | grep -c 'could not be found')
echo "starting pre-sync in background" >> $logFile
# make sure that debug file is clean, so just pre-sync gets analysed on stop
sudo rm /mnt/hdd/bitcoin/debug.log
# starting in background, because this scripts is part of systemd
# so to change systemd needs to happen after delay in seperate process
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin 2>> $logFile
sudo -u bitcoin /usr/local/bin/bitcoind -daemon -conf=/home/admin/assets/bitcoin.conf -pid=/mnt/hdd/bitcoin/bitcoind.pid 2>> $logFile
echo "OK Started bitcoind for presync" >> $logFile
sudo sed -i "s/^message=.*/message='running presync'/g" ${infoFile}
# after admin login, presync will be stoped and HDD unmounted
# after admin login, presync will be stopped and HDD unmounted
exit 0
else
@ -256,17 +307,58 @@ if [ ${configExists} -eq 1 ]; then
source ${configFile}
# update public IP on boot
# wait otherwise looking for publicIP fails
sleep 5
freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php)
# sanity check on IP data
# see https://github.com/rootzoll/raspiblitz/issues/371#issuecomment-472416349
echo "-> sanity check of IP data: ${freshPublicIP}"
if [[ $freshPublicIP =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then
echo "OK IPv6"
elif [[ $freshPublicIP =~ ^([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then
echo "OK IPv4"
else
echo "FAIL - not an IPv4 or IPv6 address"
freshPublicIP=""
fi
if [ ${#freshPublicIP} -eq 0 ]; then
# prevent having no publicIP set at all and LND getting stuck
# https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101
if [ ${#publicIP} -eq 0 ]; then
localIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
echo "WARNING: No publicIP information at all - working with placeholder: ${localIP}" >> $logFile
freshPublicIP="${localIP}"
fi
fi
if [ ${#freshPublicIP} -eq 0 ]; then
echo "WARNING: Was not able to determine external IP on startup." >> $logFile
else
publicIPValueExists=$( sudo cat ${configFile} | grep -c 'publicIP=' )
if [ ${publicIPValueExists} -gt 1 ]; then
# remove one
echo "more then one publiIp entry - removing one" >> $logFile
sed -i "s/^publicIP=.*//g" ${configFile}
publicIPValueExists=$( sudo cat ${configFile} | grep -c 'publicIP=' )
fi
if [ ${publicIPValueExists} -eq 0 ]; then
echo "create value (${freshPublicIP})" >> $logFile
echo "publicIP=${freshPublicIP}" >> $configFile
else
echo "update value (${freshPublicIP})" >> $logFile
sed -i "s/^publicIP=.*/publicIP=${freshPublicIP}/g" ${configFile}
fi
fi
fi
#################################
# FIX BLOCKCHAINDATA OWNER (just in case)
# https://github.com/rootzoll/raspiblitz/issues/239#issuecomment-450887567
#################################
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin 2>/dev/null
################################
# DETECT FRESHLY RECOVERED SD
################################
@ -282,7 +374,30 @@ fi
# SD INFOFILE BASICS
################################
# state info
sed -i "s/^state=.*/state=ready/g" ${infoFile}
sed -i "s/^message=.*/message='waiting login'/g" ${infoFile}
# determine network and chain from system
# check for BITCOIN
loaded=$(sudo systemctl status bitcoind | grep -c 'loaded')
if [ ${loaded} -gt 0 ]; then
sed -i "s/^network=.*/network=bitcoin/g" ${infoFile}
source /mnt/hdd/bitcoin/bitcoin.conf
if [ ${testnet} -gt 0 ]; then
sed -i "s/^chain=.*/chain=test/g" ${infoFile}
else
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
fi
fi
# check for LITECOIN
loaded=$(sudo systemctl status litecoind | grep -c 'loaded')
if [ ${loaded} -gt 0 ]; then
sed -i "s/^network=.*/network=litecoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
fi
echo "DONE BOOTSTRAP" >> $logFile
exit 0

3
home.admin/_commands.sh

@ -5,5 +5,6 @@
# command: raspiblitz
# calls the the raspiblitz mainmenu
function raspiblitz() {
/home/admin/00mainMenu.sh
cd /home/admin
./00mainMenu.sh
}

2
home.admin/_version.info

@ -1,2 +1,2 @@
# RaspiBlitz Version - always [main].[sub]
codeVersion="0.99"
codeVersion="1.1"

2
home.admin/assets/RTL.service

@ -12,6 +12,8 @@ User=root
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target

3
home.admin/assets/bitcoin.conf

@ -12,6 +12,9 @@ disablewallet=1
# Connection settings
rpcuser=raspibolt
rpcpassword=passwordB
rpcport=8332
rpcallowip=127.0.0.1
rpcbind=127.0.0.1:8332
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

2
home.admin/assets/bitcoind.service

@ -18,6 +18,8 @@ KillMode=process
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target

1
home.admin/assets/bootstrap.service

@ -12,6 +12,7 @@ Type=oneshot
RemainAfterExit=true
ExecStart=/home/admin/_bootstrap.sh
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target

2
home.admin/assets/lnd.bitcoin.conf

@ -1,7 +1,7 @@
# lnd configuration
[Application Options]
debuglevel=debug
debuglevel=info
maxpendingchannels=5
alias=raspiblitz
color=#68F442

2
home.admin/assets/lnd.litecoin.conf

@ -1,7 +1,7 @@
# lnd configuration
[Application Options]
debuglevel=debug
debuglevel=info
maxpendingchannels=5
alias=raspiblitz
color=#68F442

4
home.admin/assets/lnd.service

@ -9,7 +9,7 @@ After=bitcoind.service
#OnFailure=systemd-sendmail@%n
[Service]
EnvironmentFile=
EnvironmentFile=/mnt/hdd/raspiblitz.conf
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}
PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin
@ -20,6 +20,8 @@ KillMode=process
TimeoutSec=180
Restart=always
RestartSec=60
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target

1617
home.admin/assets/raspiblitz-bitcoin1-2019-01-16-update.torrent

File diff suppressed because one or more lines are too long

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>

255
home.admin/config.scripts/blitz.setpassword.sh

@ -0,0 +1,255 @@
#!/bin/bash
# command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to set a passwords A,B,C & D"
echo "blitz.setpassword.sh [?a|b|c|d] [?newpassword] "
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
fi
# tempfile
_temp="./dialog.$$"
# load raspiblitz config (if available)
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
network="bitcoin"
fi
if [ ${#chain} -eq 0 ]; then
chain="main"
fi
# 1. parameter [?a|b|c|d]
abcd=$1
# 2. parameter [?newpassword]
newPassword=$2
# run interactive if no further parameters
OPTIONS=()
if [ ${#abcd} -eq 0 ]; then
OPTIONS+=(A "Master User Password / SSH")
OPTIONS+=(B "RPC Password (blockchain/lnd)")
OPTIONS+=(C "LND Wallet Password")
OPTIONS+=(D "LND Seed Password")
CHOICE=$(dialog --clear \
--backtitle "RaspiBlitz" \
--title "Set Password" \
--menu "Which password to change?" \
11 50 7 \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
A)
abcd='a';
;;
B)
abcd='b';
;;
C)
abcd='c';
;;
D)
abcd='d';
;;
esac
fi
echo "Changing Password ${abcd} ..."
echo ""
############################
# PASSWORD A
if [ "${abcd}" = "a" ]; then
# if no password given by parameter - ask by dialog
if [ ${#newPassword} -eq 0 ]; then
# ask user for new password A (first time)
dialog --backtitle "RaspiBlitz - Setup"\
--insecure --passwordbox "Set new Master/Admin Password A:\n(min 8chars, 1word, chars+number, no specials)" 10 52 2>$_temp
# get user input
password1=$( cat $_temp )
shred $_temp
# ask user for new password A (second time)
dialog --backtitle "RaspiBlitz - Setup"\
--insecure --passwordbox "Re-Enter Password A:\n(This is new password to login per SSH)" 10 52 2>$_temp
# get user input
password2=$( cat $_temp )
shred $_temp
# check if passwords match
if [ "${password1}" != "${password2}" ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh a
exit 1
fi
# password zero
if [ ${#password1} -eq 0 ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh a
exit 1
fi
# check that password does not contain bad characters
clearedResult=$(echo "${password1}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh a
exit 1
fi
# password longer than 8
if [ ${#password1} -lt 8 ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh a
exit 1
fi
# use entred password now as parameter
newPassword="${password1}"
fi
# change user passwords and then change hostname
echo "pi:$newPassword" | sudo chpasswd
echo "root:$newPassword" | sudo chpasswd
echo "bitcoin:$newPassword" | sudo chpasswd
echo "admin:$newPassword" | sudo chpasswd
sleep 1
echo ""
echo "OK - password A changed for user pi, root, admin & bitcoin"
exit 0
############################
# PASSWORD B
elif [ "${abcd}" = "b" ]; then
# if no password given by parameter - ask by dialog
if [ ${#newPassword} -eq 0 ]; then
# ask user for new password A (first time)
dialog --backtitle "RaspiBlitz - Setup"\
--insecure --passwordbox "Please enter your RPC Password B:\n(min 8chars, 1word, chars+number, no specials)" 10 52 2>$_temp
# get user input
password1=$( cat $_temp )
shred $_temp
# ask user for new password A (second time)
dialog --backtitle "RaspiBlitz - Setup"\
--insecure --passwordbox "Re-Enter Password B:\n" 10 52 2>$_temp
# get user input
password2=$( cat $_temp )
shred $_temp
# check if passwords match
if [ "${password1}" != "${password2}" ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh b
exit 1
fi
# password zero
if [ ${#password1} -eq 0 ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh b
exit 1
fi
# check that password does not contain bad characters
clearedResult=$(echo "${password1}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh b
exit 1
fi
# password longer than 8
if [ ${#password1} -lt 8 ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh b
exit 1
fi
# use entred password now as parameter
newPassword="${password1}"
fi
# change in assets (just in case this is used on setup)
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /home/admin/assets/${network}.conf 2>/dev/null
sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${newPassword}/g" /home/admin/assets/lnd.${network}.conf 2>/dev/null
# change in real configs
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /mnt/hdd/${network}/${network}.conf 2>/dev/null
sed -i "s/^rpcpassword=.*/rpcpassword=${newPassword}/g" /home/admin/.${network}/${network}.conf 2>/dev/null
sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${newPassword}/g" /mnt/hdd/lnd/lnd.conf 2>/dev/null
sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${newPassword}/g" /home/admin/.lnd/lnd.conf 2>/dev/null
echo "OK -> RPC Password B changed"
echo "if services are running - reboot is needed to activate new settings"
exit 0
############################
# PASSWORD C
elif [ "${abcd}" = "c" ]; then
if [ ${#newPassword} -gt 0 ]; then
echo "New password C cannot be set thru paramter .. will start interactive password setting."
echo "PRESS ENTER to continue"
read key
fi
clear
echo ""
echo "****************************************************************************"
echo "Change LND Wallet Password --> lncli --chain=${network} --network=${chain}net changepassword"
echo "****************************************************************************"
echo "This is your Password C on the RaspiBlitz to unlock your LND wallet."
echo "If you had Auto-Unlock active - you need to re-activate after this."
echo "****************************************************************************"
echo "LND needs to be restarted to lock wallet first .. (please wait)"
sudo systemctl restart lnd
sleep 6
# let LND-CLI handle the password change
sudo -u bitcoin lncli --chain=${network} --network=${chain}net changepassword
# deactivate AUTO-UNLOCK if activated
echo ""
echo "# Make sure Auto-Unlocks off"
sudo /home/admin/config.scripts/lnd.autounlock.sh off
# final user output
echo ""
echo "OK"
exit 0
############################
# PASSWORD D
elif [ "${abcd}" = "d" ]; then
echo "#### NOTICE ####"
echo "Sorry - the password D cannot be changed. Its the password you set on creating your wallet to protect your seed (the list of words)."
exit 1
# everything else
else
echo "FAIL: there is no password '${abcd}' (reminder: use lower case)"
exit 1
fi

56
home.admin/config.scripts/bonus.rtl.sh

@ -9,6 +9,7 @@ fi
# check and load raspiblitz config
# to know which network is running
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
@ -28,30 +29,61 @@ sudo systemctl stop RTL 2>/dev/null
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** INSTALL RTL ***"
# setting value in raspi blitz config
sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf
isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
if [ ${isInstalled} -eq 0 ]; then
# disable RPC listen
# to prevent tls cer auth error
echo "*** Modify lnd.conf ***"
sudo sed -i "s/^rpclisten=0.0.0.0:10009/#rpclisten=0.0.0.0:10009/g" /mnt/hdd/lnd/lnd.conf
echo ""
# install latest nodejs
echo "*** Install NodeJS ***"
cd /home/admin
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs
echo ""
# close source code
# check if nodeJS was installed
nodeJSInstalled=$(node -v | grep -c "v11.")
if [ nodeJSInstalled -eq 0 ]; then
echo "FAIL - Was not able to install nodeJS 11"
echo "ABORT - RTL install"
exit 1
fi
# download source code and set to tag release
echo "*** Get the RTL Source Code ***"
git clone https://github.com/ShahanaFarooqui/RTL.git
cd RTL
git reset --hard v0.2.15
# check if node_modles exists now
if [ -d "/home/admin/RTL" ]; then
echo "OK - RTL code copy looks good"
else
echo "FAIL - code copy did not run correctly"
echo "ABORT - RTL install"
exit 1
fi
echo ""
# install
echo "*** Run: npm install ***"
npm install
cd ..
# check if node_modles exists now
if [ -d "/home/admin/RTL/node_modules" ]; then
echo "OK - RTL install looks good"
else
echo "FAIL - npm install did not run correctly"
echo "ABORT - RTL install"
exit 1
fi
echo ""
# prepare RTL.conf file
echo "*** RTL.conf ***"
cp ./RTL/sample-RTL.conf ./RTL/RTL.conf
sudo sed -i "s/^macroonPath=.*/macroonPath=\/mnt\/hdd\/lnd\/data\/chain\/${network}\/${chain}net/g" ./RTL/RTL.conf
sudo sed -i "s/^lndConfigPath=.*/lndConfigPath=\/mnt\/hdd\/lnd\/lnd.conf/g" ./RTL/RTL.conf
sudo sed -i "s/^nodeAuthType=.*/nodeAuthType=DEFAULT/g" ./RTL/RTL.conf
sudo sed -i "s/^rtlPass=.*/rtlPass=/g" ./RTL/RTL.conf
echo ""
# open firewall
@ -66,10 +98,14 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${chain}net|" /etc/systemd/system/RTL.service
sudo systemctl enable RTL
echo "OK - RTL is now ACTIVE"
else
echo "RTL already installed."
fi
# setting value in raspi blitz config
sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf
echo "needs reboot to activate new setting"
exit 0
fi

24
home.admin/config.scripts/internet.dyndomain.sh

@ -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
@ -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"

119
home.admin/config.scripts/internet.tor.sh

@ -8,12 +8,42 @@
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to switch TOR on or off"
echo "internet.tor.sh [on|off]"
echo "internet.tor.sh [on|off|prepare]"
exit 1
fi
# function: install keys & sources
prepareTorSources()
{
# Prepare for TOR service
echo "*** INSTALL TOR REPO ***"
echo ""
echo "*** Install dirmngr ***"
sudo apt install dirmngr -y
echo ""
echo "*** Adding KEYS deb.torproject.org ***"
curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | sudo gpg --import
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
echo ""
echo "*** Adding Tor Sources to sources.list ***"
echo "deb https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
echo ""
}
# if started with prepare
if [ "$1" = "prepare" ] || [ "$1" = "-prepare" ]; then
prepareTorSources
exit 0
fi
# check and load raspiblitz config
# to know which network is running
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
@ -26,6 +56,8 @@ if [ ${#runBehindTor} -eq 0 ]; then
fi
# location of TOR config
# make sure /etc/tor exists
sudo mkdir /etc/tor 2>/dev/null
torrc="/etc/tor/torrc"
# stop services
@ -55,6 +87,13 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo ""
fi
# check if TOR package is installed
packageInstalled=$(dpkg -s tor-arm | grep -c 'Status: install ok')
if [ ${packageInstalled} -eq 0 ]; then
# calling function from above
prepareTorSources
echo "*** Updating System ***"
sudo apt-get update
echo ""
@ -64,12 +103,12 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo ""
echo "*** Tor Config ***"
sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor
sudo mkdir /mnt/hdd/tor/sys
sudo mkdir /mnt/hdd/tor/web80
sudo mkdir /mnt/hdd/tor/lnd9735
sudo mkdir /mnt/hdd/tor/lndrpc9735
#sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor/sys 2>/dev/null
sudo mkdir /mnt/hdd/tor/web80 2>/dev/null
sudo mkdir /mnt/hdd/tor/lnd9735 2>/dev/null
sudo mkdir /mnt/hdd/tor/lndrpc9735 2>/dev/null
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
@ -88,6 +127,7 @@ User bitcoin
PortForwarding 1
ControlPort 9051
SocksPort 9050
ExitRelay 0
CookieAuthFile /mnt/hdd/tor/sys/control_auth_cookie
CookieAuthentication 1
@ -132,21 +172,6 @@ EOF
sudo systemctl enable tor@default
echo ""
#echo "*** Waiting for TOR to boostrap ***"
#torIsBootstrapped=0
#while [ ${torIsBootstrapped} -eq 0 ]
#do
# echo "--- Checking 1 ---"
# date +%s
# sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
# torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
# echo "torIsBootstrapped(${torIsBootstrapped})"
# echo "If this takes too long --> CTRL+c, reboot and check manually"
# sleep 5
#done
#echo "OK - Tor Bootstrap is ready"
#echo ""
echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
if [ ${networkIsTor} -eq 0 ]; then
@ -170,37 +195,19 @@ EOF
echo "Chain network already configured for TOR"
fi
#echo "*** ${network} re-init - Waiting for Onion Address ***"
# restarting bitcoind to start with tor and generare onion.address
#echo "restarting ${network}d ..."
#sudo systemctl restart ${network}d
#sleep 8
#onionAddress=""
#while [ ${#onionAddress} -eq 0 ]
#do
# echo "--- Checking 2 ---"
# date +%s
# testNetAdd=""
# if [ "${chain}" = "test" ];then
# testNetAdd="/testnet3"
# fi
# sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10
# onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
# echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
# sleep 5
#done
#onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9')
#echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}"
#echo ""
#echo "*** Setting your Onion Address ***"
#onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
#echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
#echo ""
else
echo "TOR package/service is installed and was prepared earlier .. just activating again"
echo "*** Enable TOR service ***"
sudo systemctl enable tor@default
echo ""
fi
# ACTIVATE LND OVER TOR
echo "*** Putting LND behind TOR ***"
echo "Make sutre LND is disabled"
echo "Make sure LND is disabled"
sudo systemctl disable lnd 2>/dev/null
echo "editing /etc/systemd/system/lnd.service"
@ -244,18 +251,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "OK"
echo ""
echo "*** Remove Tor ***"
sudo apt remove tor tor-arm -y
echo ""
echo "*** Remove NYX ***"
sudo pip uninstall nyx -y
echo ""
echo "*** Remove TOR Files/Config ***"
sudo rm -r -f /mnt/hdd/tor
echo ""
echo "needs reboot to activate new setting"
exit 0
fi

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

@ -27,6 +27,7 @@ echo "making sure services are not running"
sudo systemctl stop lnd 2>/dev/null
# add default value to raspi config if needed
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#autoNatDiscovery} -eq 0 ]; then
echo "autoNatDiscovery=off" >> /mnt/hdd/raspiblitz.conf

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

@ -28,6 +28,7 @@ if [ ${valueExists} -eq 0 ]; then
fi
# add default value to raspi config if needed
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#autoPilot} -eq 0 ]; then
echo "autoPilot=off" >> /mnt/hdd/raspiblitz.conf

8
home.admin/config.scripts/lnd.autounlock.sh

@ -1,5 +1,8 @@
#!/bin/bash
# requests missing in dietpi
sudo pip install requests
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to autounlock lnd after restart"
@ -102,6 +105,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo sh -c "echo \"${passwordC}\" > /root/lnd.autounlock.pwd"
echo "Auto-Unlock is now ON"
echo "NOTE: you may need to reconnect mobile/external wallets (macaroon/tls)"
fi
# switch off
@ -112,8 +116,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo sed -i "s/^autoUnlock=.*/autoUnlock=off/g" /mnt/hdd/raspiblitz.conf
# delete password C securly
echo "shredding password on RaspiBlitz"
sudo shred -u /root/lnd.autounlock.pwd
echo "shredding password on for RaspiBlitz Auto-Unlock"
sudo shred -u /root/lnd.autounlock.pwd 2>/dev/null
echo "Auto-Unlock is now OFF"
fi

165
home.admin/config.scripts/lnd.export.sh

@ -0,0 +1,165 @@
#!/bin/bash
# command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "tool to export macaroons & tls.cert"
echo "lnd.export.sh [hexstring|scp|http|reset]"
exit 1
fi
# 1. parameter -> the type of export
exportType=$1
# interactive choose type of export if not set
if [ "$1" = "" ] || [ $# -eq 0 ]; then
OPTIONS=()
OPTIONS+=(HEX "Hex-String (Copy+Paste)")
OPTIONS+=(SCP "SSH Download (Commands)")
OPTIONS+=(HTTP "Browserdownload (bit risky)")
OPTIONS+=(RESET "RENEW MACAROONS & TLS")
CHOICE=$(dialog --clear \
--backtitle "RaspiBlitz" \
--title "Export Macaroons & TLS.cert" \
--menu "How do you want to export?" \
11 50 7 \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
HEX)
exportType='hexstring';
;;
SCP)
exportType='scp';
;;
HTTP)
exportType='http';
;;
RESET)
exportType='reset';
;;
esac
fi
# load data from config
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
########################
# CANCEL
########################
if [ ${#exportType} -eq 0 ]; then
echo "CANCEL"
exit 0
########################
# HEXSTRING
########################
elif [ "${exportType}" = "hexstring" ]; then
clear
echo "###### HEXSTRING EXPORT ######"
echo ""
echo "admin.macaroon:"
sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon
echo ""
echo "invoice.macaroon:"
sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/invoice.macaroon
echo ""
echo "readonly.macaroon:"
sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/readonly.macaroon
echo ""
echo "tls.cert:"
sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/tls.cert
echo ""
###########################
# SHH / SCP File Download
###########################
elif [ "${exportType}" = "scp" ]; then
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
clear
echo "###### DOWNLOAD BY SCP ######"
echo "Copy, paste and execute these commands in your client terminal to download the files."
echo "The password needed during download is your Password A."
echo ""
echo "admin.macaroon:"
echo "scp bitcoin@${local_ip}:/home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon ./"
echo ""
echo "invoice.macaroon:"
echo "scp bitcoin@${local_ip}:/home/bitcoin/.lnd/data/chain/${network}/${chain}net/invoice.macaroon ./"
echo ""
echo "readonly.macaroon:"
echo "scp bitcoin@${local_ip}:/home/bitcoin/.lnd/data/chain/${network}/${chain}net/readonly.macaroon ./"
echo ""
echo "tls.cert:"
echo "scp bitcoin@${local_ip}:/home/bitcoin/.lnd/tls.cert ./"
echo ""
###########################
# HTTP File Download
###########################
elif [ "${exportType}" = "http" ]; then
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
randomPortNumber=$(shuf -i 20000-39999 -n 1)
sudo ufw allow from 192.168.0.0/16 to any port ${randomPortNumber} comment 'temp http server'
clear
echo "###### DOWNLOAD BY HTTP ######"
echo ""
echo "Open in your browser --> http://${local_ip}:${randomPortNumber}"
echo ""
echo "You need to be on the same local network - not reachable from outside."
echo "In browser click on files or use 'save as' from context menu to download."
echo ""
echo "Temp HTTP Server is running - use CTRL+C to stop when you are done"
echo ""
cd
randomFolderName=$(shuf -i 100000000-900000000 -n 1)
mkdir ${randomFolderName}
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon ./${randomFolderName}/admin.macaroon
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/readonly.macaroon ./${randomFolderName}/readonly.macaroon
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/invoice.macaroon ./${randomFolderName}/invoice.macaroon
sudo cp /home/bitcoin/.lnd/tls.cert ./${randomFolderName}/tls.cert
cd ${randomFolderName}
sudo chmod 444 *.*
python -m SimpleHTTPServer ${randomPortNumber} 2>/dev/null
sudo ufw delete allow from 192.168.0.0/16 to any port ${randomPortNumber} comment 'temp http server'
cd ..
sudo rm -r ${randomFolderName}
echo "OK - temp HTTP server is stopped."
###########################
# RESET Macaroons and TLS
###########################
elif [ "${exportType}" = "reset" ]; then
clear
echo "###### RESET MACAROONS AND TLS.cert ######"
echo ""
echo "All your macaroons and the tls.cert get deleted and recreated."
echo "Use this to invalidate former EXPORTS for example if you loose a device."
echo ""
cd
echo "- deleting old macaroons"
sudo rm /home/admin/.lnd/data/chain/${network}/${chain}net/*.macaroon
sudo rm /home/bitcoin/.lnd/data/chain/${network}/${chain}net/*.macaroon
sudo rm /home/bitcoin/.lnd/data/chain/${network}/${chain}net/macaroons.db
echo "- resetting TLS cert"
sudo /home/admin/config.scripts/lnd.newtlscert.sh
echo "- restarting LND ... wait 10 secs"
sudo systemctl start lnd
sleep 10
sudo -u bitcoin lncli unlock
echo "- creating new macaroons ... wait 10 secs"
sleep 10
echo "- copy new macaroons to admin user"
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/*.macaroon /home/admin/.lnd/data/chain/${network}/${chain}net/
sudo chown admin:admin -R /home/admin/.lnd/data/chain/${network}/${chain}net/*.macaroon
echo "OK DONE"
else
echo "FAIL: unknown '${exportType}' -run-> ./lnd.export.sh -h"
fi

7
home.admin/config.scripts/lnd.newtlscert.sh

@ -5,8 +5,10 @@
echo "making sure services are not running"
sudo systemctl stop lnd 2>/dev/null
echo "deleting TLSCert"
sudo rm /mnt/hdd/lnd/tls.* 2>/dev/null
echo "keep old tls data as backup"
sudo mv /mnt/hdd/lnd/tls.cert /mnt/hdd/lnd/tls.cert.old
sudo mv /mnt/hdd/lnd/tls.key /mnt/hdd/lnd/tls.key.old
echo "let lnd generate new TLSCert"
sudo -u bitcoin /usr/local/bin/lnd &>/dev/null &
echo "wait until generated"
@ -26,4 +28,5 @@ done
sudo killall /usr/local/bin/lnd
echo "copy new cert to admin user"
sudo cp /mnt/hdd/lnd/tls.cert /home/admin/.lnd
sudo chown admin:admin -R /home/admin/.lnd/*.cert
echo "OK TLS certs are fresh"

151
home.admin/config.scripts/lnd.rescue.sh

@ -0,0 +1,151 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small rescue script to to backup or restore"
echo "lnd.rescue.sh [backup|restore]"
exit 1
fi
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
mode="$1"
if [ ${mode} = "backup" ]; then
################################
# BACKUP
################################
echo "*** LND.RESCUE --> BACKUP"
# stop LND
echo "Stopping lnd..."
sudo systemctl stop lnd
sleep 5
echo "OK"
echo
# zip it
sudo tar -zcvf /home/admin/lnd-rescue.tar.gz /mnt/hdd/lnd
sudo chown admin:admin /home/admin/lnd-rescue.tar.gz
# name with md5 checksum
md5checksum=$(md5sum /home/admin/lnd-rescue.tar.gz | head -n1 | cut -d " " -f1)
mv /home/admin/lnd-rescue.tar.gz /home/admin/lnd-rescue-${md5checksum}.tar.gz
# offer SCP for download
echo
echo "****************************"
echo "* DOWNLOAD THE BACKUP FILE *"
echo "****************************"
echo
echo "RUN THE FOLLOWING COMMAND ON YOUR LAPTOP IN NEW TERMINAL:"
echo "scp -r admin@${localip}:/home/admin/lnd-rescue-*.tar.gz ./"
echo ""
echo "Use password A to authenticate file transfere."
echo
echo "BEWARE: Your Lightning node is now stopped. So its safe to backup the data and restore it"
echo "later on - for example on a fresh RaspiBlitz. But once this Lightning node gets started"
echo "again by 'sudo systemctl start lnd' or a reboot its not adviced to restore the backup file"
echo "anymore bacause it cointains outdated channel data and can lead to loss of channel funds."
elif [ ${mode} = "restore" ]; then
################################
# RESTORE
################################
echo "*** LND.RESCUE --> RESTORE"
echo ""
filename=""
while [ ${#filename} -eq 0 ]
do
countZips=$(sudo ls /home/admin/lnd-rescue-*.tar.gz 2>/dev/null | grep -c 'lnd-rescue')
if [ ${countZips} -lt 1 ]; then
echo "**************************"
echo "* UPLOAD THE BACKUP FILE *"
echo "**************************"
echo
echo "If you have a lnd-rescue backup file on your laptop you can now"
echo "upload it and restore the your old LND state."
echo
echo "To make upload open a new terminal on your laptop,"
echo "change into the directory where your lnd-rescue file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp -r ./lnd-rescue-*.tar.gz admin@${localip}:/home/admin/"
echo ""
echo "Use password A to authenticate file transfere."
echo
echo "PRESS ENTER when upload is done. Use CTRL-C to abort."
fi
if [ ${countZips} -gt 1 ]; then
echo "!! WARNING !!"
echo "There are multiple lnd-rescue files in directory /home/admin."
echo "Make sure there is only one file to work with and start again."
echo
exit 1
fi
if [ ${countZips} -eq 1 ]; then
clear
echo
echo "**************************"
echo "* RESTORING BACKUP FILE *"
echo "**************************"
echo
filename=$(sudo ls /home/admin/lnd-rescue-*.tar.gz)
echo "OK -> found file to restore: ${filename}"
md5checksum=$(md5sum ${filename} | head -n1 | cut -d " " -f1)
isCorrect=$(echo ${filename} | grep -c ${md5checksum})
if [ ${isCorrect} -eq 1 ]; then
echo "OK -> checksum looks good: ${md5checksum}"
else
echo "!!! FAIL -> Checksum not correct."
echo "Maybe transfere failed? Continue on your own risk!"
echo "Recommend to abort and upload again!"
fi
echo
echo "WARNING: This will delete the actual LND state/funds of this RaspiBlitz."
echo
echo "PRESS ENTER to start restore. Use CTRL-C to abort."
fi
read key
done
# stop LND
echo "Stopping lnd..."
sudo systemctl stop lnd
sleep 5
echo "OK"
echo
# clean DIR
echo "Cleaning LND data ..."
sudo rm -r /mnt/hdd/lnd/*
echo "OK"
echo
# unpack zip
echo "Restoring LND data from ${filename} ..."
sudo tar -xf ${filename} -C /
sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd
echo "OK"
echo
# start LND
echo "Starting lnd..."
sudo systemctl start lnd
echo "OK"
echo
echo "DONE - please check if LND starts up correctly with restored state and funds."
echo "Keep in mind that some channels got forced closed by channel partners in the meanwhile."
echo
else
echo "unknown parameter '${mode}' - exit"
fi

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

@ -0,0 +1,73 @@
#!/bin/bash
# command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to set a alias of LND (and hostname of raspi)"
echo "lnd.setname.sh [?newName]"
exit 1
fi
# 1. parameter [?newName]
newName=$1
# run interactive if 'turn on' && no further parameters
if [ ${#newName} -eq 0 ]; then
sudo rm ./.tmp
dialog --backtitle "Set LND Name/Alias" --inputbox "ENTER the new Name/Alias for LND node:
(free to choose, one word, use basic characters)
" 8 52 2>./.tmp
newName=$( cat ./.tmp )
if [ ${#newName} -eq 0 ]; then
echo "FAIL input cannot be empty"
exit 1
fi
fi
# config file
blitzConfig="/mnt/hdd/raspiblitz.conf"
# lnd conf file
lndConfig="/mnt/hdd/lnd/lnd.conf"
# check if raspibblitz config file exists
configExists=$(ls ${blitzConfig} | grep -c '.conf')
if [ ${configExists} -eq 0 ]; then
echo "FAIL - missing ${blitzConfig}"
exit 1
fi
# make sure entry line for 'hostname' exists
entryExists=$(cat ${blitzConfig} | grep -c 'hostname=')
if [ ${entryExists} -eq 0 ]; then
echo "hostname=" >> ${blitzConfig}
fi
# check if lnd config file exists
configExists=$(ls ${lndConfig} | grep -c '.conf')
if [ ${configExists} -eq 0 ]; then
echo "FAIL - missing ${lndConfig}"
exit 1
fi
# make sure entry line for 'alias' exists
entryExists=$(cat ${lndConfig} | grep -c 'alias=')
if [ ${entryExists} -eq 0 ]; then
echo "alias=" >> ${blitzConfig}
fi
# stop services
echo "making sure services are not running"
sudo systemctl stop lnd 2>/dev/null
# lnd.conf: change name
sudo sed -i "s/^alias=.*/alias=${newName}/g" ${lndConfig}
# raspiblitz.conf: change name
sudo sed -i "s/^hostname=.*/hostname=${newName}/g" ${blitzConfig}
# OS: change hostname
sudo raspi-config nonint do_hostname ${newName}
echo "needs reboot to run normal again"
exit 0

77
home.admin/config.scripts/lnd.setport.sh

@ -0,0 +1,77 @@
#!/bin/bash
# based on: https://github.com/rootzoll/raspiblitz/issues/100#issuecomment-465997126
if [ $# -eq 0 ]; then
echo "small config script set the port LND is running on"
echo "lnd.setport.sh [portnumber]"
exit 1
fi
portnumber=$1
# check port numer is a integer
if ! [ "$portnumber" -eq "$portnumber" ] 2> /dev/null
then
echo "FAIL - portnumber(${portnumber}) not a number"
exit 1
fi
# check port number is bigger then zero
if [ ${portnumber} -lt 1 ]; then
echo "FAIL - portnumber(${portnumber}) not above 0"
exit 1
fi
# check port number is smaller than max
if [ ${portnumber} -gt 65535 ]; then
echo "FAIL - portnumber(${portnumber}) not below 65535"
exit 1
fi
# check if TOR is on
source /mnt/hdd/raspiblitz.conf
if [ "${runBehindTor}" = "on" ]; then
echo "FAIL - portnumber cannot be changed if TOR is ON (not implemented)"
exit 1
fi
# check lnd.conf exits
lndConfExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c 'lnd.conf')
if [ ${lndConfExists} -eq 0 ]; then
echo "FAIL - /mnt/hdd/lnd/lnd.conf not found"
exit 1
fi
# check if "listen=" exists in lnd config
valueExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'listen=')
if [ ${valueExists} -lt 3 ]; then
echo "Adding listen config defaults to /mnt/hdd/lnd/lnd.conf"
sudo sed -i "9i listen=0.0.0.0:9735" /mnt/hdd/lnd/lnd.conf
fi
# stop services
echo "making sure LND is not running"
sudo systemctl stop lnd 2>/dev/null
# disable services
echo "making sure LND is disabled"
sudo systemctl disable lnd
# change port in lnd config
echo "change port in lnd config"
sudo sed -i "s/^listen=.*/listen=0.0.0.0:${portnumber}/g" /mnt/hdd/lnd/lnd.conf
# editing service file
echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:${portnumber}/g" /etc/systemd/system/lnd.service
# enable service again
echo "enable service again"
sudo systemctl enable lnd
# make sure port is open on firewall
sudo ufw allow ${portnumber} comment 'LND Port'
sudo ufw --force enable
echo "needs reboot to activate new setting -> sudo shutdown -r now"

11
home.admin/config.scripts/network.chain.sh

@ -15,9 +15,10 @@ fi
# check and load raspiblitz config
# to know which network is running
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
echo "FAIL - missing network info"
exit 1
fi
@ -80,6 +81,12 @@ else
sudo sed -i "s/^chain=.*/chain=main/g" /mnt/hdd/raspiblitz.conf
fi
# edit RTL.conf (if active)
if [ "${rtlWebinterface}" = "on" ]; then
echo "editing /home/admin/RTL/RTL.conf"
sudo sed -i "s/^macroonPath=.*/macroonPath=\/mnt\/hdd\/lnd\/data\/chain\/${network}\/$1/g" /home/admin/RTL/RTL.conf
fi
# now a reboot is needed to load all services fresh
# starting up process will display chain sync
# ask user todo reboot

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

@ -0,0 +1,102 @@
#!/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 /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
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
progress=0
while [ ${finished} -eq 0 ]
do
clear
echo "*************************"
echo "REINDEXING BLOCKCHAIN"
echo "*************************"
date
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
blockchaininfo=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo)
progress=$(echo "${blockchaininfo}" | jq -r '.verificationprogress')
#progress=$(echo "${progress}*100" | bc)
inprogress="$(echo "${blockchaininfo}" | jq -r '.initialblockdownload')"
if [ "${inprogress}" = "false" ]; then
finished=1
fi
echo ""
echo "RUNNING: ${inprogress}"
echo "PROGRESS: ${progress}"
echo ""
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 "*************************"
if [ ${finished} -eq 0 ]; then
echo "Re-Index CANCELED"
else
echo "Re-Index finished"
fi
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

BIN
pictures/RTL-dashboard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

BIN
pictures/befestigung.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

BIN
pictures/download-ftp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
pictures/download-torrent.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
pictures/export.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
pictures/hardwaresetup.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

BIN
pictures/lcdassm.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

BIN
pictures/logoraspiblitz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
pictures/mainmenu-services.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
pictures/mainmenu.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
pictures/mainmenu1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
pictures/mainmenu2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
pictures/mainmenu3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
pictures/mobile.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save