@ -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). |
@ -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) |
|||
|
@ -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. |
@ -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 |
@ -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. |
@ -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) |
@ -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/ |
@ -0,0 +1 @@ |
|||
wget https://raw.githubusercontent.com/openoms/raspiblitz/raspiblitz-dev/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh raspiblitz-dev openoms |
@ -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 |
|||
#------------------------------------------------------------------------------------------------------ |
@ -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 |
|||
#------------------------------------------------------------------------------------------------------ |
@ -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) |
After Width: | Height: | Size: 3.8 MiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 13 KiB |
@ -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 |
@ -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 |
|||
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 |
|||
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 |
|||
|
|||
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 |
|||
|
@ -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 |
@ -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" |
|||
|
@ -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 |
@ -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 "" |
@ -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 "" |
@ -1,2 +1,2 @@ |
|||
# RaspiBlitz Version - always [main].[sub] |
|||
codeVersion="0.99" |
|||
codeVersion="1.1" |
@ -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> |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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" |
@ -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 |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 422 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 2.8 MiB |
After Width: | Height: | Size: 510 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 14 KiB |