mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 22:58:43 +01:00
Merge branch 'master' into num_peers
* master: (84 commits) added buttit points change to bash fixed string compare fix missing end if #163 LCD IP info #134 adapt RTL.service chain & network mute error lock unlock info on LCD RTL uninstall option more height for dialog dump error meaasge added RTL to main menu install warning ip info on fail bug fix and more doc output install script for RTL #134 detecting bitcoin warmup time #65 for admin updated Czech shopping list shopping list australia with 3A power and linked to main README more info on edge cases in issue #152 ...
This commit is contained in:
commit
db1df36668
39 changed files with 10549 additions and 8958 deletions
75
README.md
75
README.md
|
@ -1,10 +1,10 @@
|
|||
[ [Hardware](#hardware-needed-amazon-shopping-list) ] -- [ [Setup](#boot-your-raspiblitz) ] -- [ [Documentation](#documentation) ] -- [ [Education](#educational-tutorials) ] -- [ [Development](#further-development-of-raspiblitz) ]
|
||||
[ [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.
|
||||
|
||||
`Latest Version with lnd 0.5 and bitcoin 0.17.0rc4 & litecoin 0.16.3 (both with dos bugfix).`
|
||||
`Latest Version with lnd 0.5 and bitcoin 0.17.0 & litecoin 0.16.3.`
|
||||
|
||||

|
||||
|
||||
|
@ -15,7 +15,6 @@ Fastest and cheapest way to get your own Lightning Node running - on a Raspberry
|
|||
* [ [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
|
||||
* [ [Education](#educational-tutorials) ] Tutorials with the RaspiBlitz to learn about Lightning
|
||||
* [ [Development](#further-development-of-raspiblitz) ] Lets work together on the RaspiBlitz
|
||||
|
||||
## Hardware Needed (Amazon Shopping List)
|
||||
|
@ -32,13 +31,21 @@ Fastest and cheapest way to get your own Lightning Node running - on a Raspberry
|
|||
**Total Price: 124,19 EUR** (thats under 150 USD)
|
||||
|
||||
Amazon shopping lists for different countries:
|
||||
[ [USA](shoppinglist_usa.md) ] [ [UK](shoppinglist_uk.md) ] [ [FR](shoppinglist_fr.md) ] [ [China](shoppinglist_cn.md) ]
|
||||
[ [USA](shoppinglist_usa.md) ] [ [UK](shoppinglist_uk.md) ] [ [France](shoppinglist_fr.md) ] [ [China](shoppinglist_cn.md) ] [ [Australia](shoppinglist_au.md) ] [ [Czech](shoppinglist_cz.md) ]
|
||||
|
||||
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).
|
||||
|
||||
The shopping list for China refers to Taobao/T-Mall.
|
||||
|
||||
### Optional Hardware
|
||||
### 3D Printed Case (optional)
|
||||
|
||||
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
|
||||
|
||||
https://thecryptocloak.com/product/lightningshell/
|
||||
|
||||

|
||||
|
||||
### More optional Hardware
|
||||
|
||||
*Some optional goodies to consider to add to your shopping list for your RaspiBlitz (Amazon DE/US):*
|
||||
|
||||
|
@ -50,8 +57,6 @@ The shopping list for China refers to Taobao/T-Mall.
|
|||
|
||||
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) ]
|
||||
|
||||
|
||||
|
||||
## Prepare your Hardware
|
||||
|
||||
*There are two ways to start:*
|
||||
|
@ -63,7 +68,7 @@ If you are at an event, ask for a ready-2-go set or if you have your own hardwar
|
|||
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.
|
||||
|
||||
1. Download SD-Card image:
|
||||
https://wiki.fulmo.org/downloads/raspiblitz-2018-09-22.img.gz (or [build your own](#build-the-sd-card-image))
|
||||
https://wiki.fulmo.org/downloads/raspiblitz-2018-10-20.img.gz (or [build your own](#build-the-sd-card-image))
|
||||
|
||||
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
|
||||
|
@ -151,7 +156,9 @@ The option "SYNC" should just be use as a fallback. So normally you have the fol
|
|||
|
||||
#### Download the Blockchain
|
||||
|
||||
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. To stop torrent and choose another option use CTRL+z and then start './10setupBlitz.sh' from the terminal.
|
||||
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.
|
||||
|
||||
For more details: [Background on Download Blockchain](background_downloadBlockchain.md)
|
||||
|
||||
#### Copy the Blockchain
|
||||
|
||||
|
@ -247,47 +254,12 @@ There is now the option to connect and control your LND node with the mobile app
|
|||
|
||||
#### RaspiBlitz as Backend for BTCPayServer (experimental)
|
||||
|
||||
BTCPay Server is a solution to be your own payment processor to accept Lightning Payments for your online store: https://github.com/btcpayserver/btcpayserver here is how to connect the RaspiBlitz as your payment node:
|
||||
BTCPay Server is a solution to be your own payment processor to accept Lightning Payments for your online store: https://github.com/btcpayserver/btcpayserver
|
||||
|
||||
##### BTCPayserver config
|
||||
|
||||
Make sure you have these setting in:
|
||||
|
||||
`<installdir>/NBXplorer/.nbxplorer/Main/settings.config`
|
||||
|
||||
```
|
||||
btc.rpc.url=http://[YOUR RASPIBLITZ IP/DOMAIN]:8332/
|
||||
btc.rpc.user=raspibolt
|
||||
btc.rpc.password=[PASSWORD B]
|
||||
```
|
||||
|
||||
Command to start NBExplorer:
|
||||
|
||||
`./run.sh --datadir /opt/NBXplorer/.nbxplorer --btcnodeendpoint <raspiblitz-ip> &`
|
||||
|
||||
Start btcpayserver as normal, it will connect to raspiblitz thru NBXplorer
|
||||
|
||||
##### Raspiblitz config
|
||||
|
||||
Make sure you have this in:
|
||||
|
||||
`/mnt/hdd/bitcoin/bitcoin.conf`
|
||||
|
||||
```
|
||||
rpcallowip=[BTCPAYSERVER IP]/255.255.255.0
|
||||
whitelist=[BTCPAYSERVER IP]
|
||||
rpcuser=raspibolt
|
||||
rpcpassword=[PASSWORD B]
|
||||
```
|
||||
You can find setup instructions 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/) :)
|
||||
|
||||
## Educational Tutorials
|
||||
|
||||
*Once the Setup Process is done, the learning and building should begin ... more detailed educational content should be added in this section in the future.*
|
||||
|
||||
A good way to start for now is to get some Testnet coins, connect to other peers and make your first transactions. You find tutorials for this at the original RaspiBolt guide: https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#get-some-testnet-bitcoin
|
||||
|
||||
## 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 everbody started quickly. But if you want to build that image yourself - here is a quick guide:
|
||||
|
@ -326,6 +298,17 @@ We know that this is not optimal yet. But until version 1.0 we will change too m
|
|||
|
||||
From the upcomming version 1.0 onwards the goal is to make it easier to keep up with the lastest RaspiBlitz updates.
|
||||
|
||||
## Mobile Development: Connect RaspiBlitz without a Router/Switch
|
||||
|
||||
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:
|
||||
|
||||
* 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]
|
||||
|
||||
## Further Development of RaspiBlitz
|
||||
|
||||
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.
|
||||
|
|
150
background_downloadBlockchain.md
Normal file
150
background_downloadBlockchain.md
Normal file
|
@ -0,0 +1,150 @@
|
|||
# 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 blk and rev files up to the number:
|
||||
- /blocks : 01385
|
||||
- /testnet3/blocks: 00152
|
||||
|
||||
#### Update Torrent File (Description)
|
||||
|
||||
All the rest of the files get packaged into a second torrent file. This file will be updated much more often. The seeding is expected to be not that good and download may be slower, but thats OK because its a much smaller file.
|
||||
|
||||
This way a good balance between good seeding and up-to-date blockchain can be reached.
|
||||
|
||||
#### Update Torrent File (Creation)
|
||||
|
||||
To create the Update Torrent file, follow the following step ...
|
||||
|
||||
Have a almost 100% synced bitcoind MAINNET with txindex=1 on a RaspiBlitz
|
||||
|
||||
Stop bitcoind with:
|
||||
```
|
||||
sudo systemctl stop bitcoind
|
||||
```
|
||||
|
||||
Delete base torrent blk-files with:
|
||||
```
|
||||
sudo rm /mnt/hdd/bitcoin/blocks/blk00*.dat
|
||||
sudo rm /mnt/hdd/bitcoin/blocks/blk0{1000..1390}.dat
|
||||
```
|
||||
|
||||
Delete base torrent rev-files with:
|
||||
```
|
||||
sudo rm /mnt/hdd/bitcoin/blocks/rev00*.dat
|
||||
sudo rm /mnt/hdd/bitcoin/blocks/rev0{1000..1390}.dat
|
||||
```
|
||||
|
||||
Now change to your computer where you package the torrent files and transfere the three directories into your torrent base directory (should be your current working directory):
|
||||
```
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/blocks ./blocks
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/chainstate ./chainstate
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/indexes ./indexes
|
||||
```
|
||||
|
||||
Also have a almost 100% synced bitcoind TESTNET with txindex=1 on a RaspiBlitz
|
||||
|
||||
Stop bitcoind with:
|
||||
```
|
||||
sudo systemctl stop bitcoind
|
||||
```
|
||||
|
||||
Delete base torrent blk-files with:
|
||||
```
|
||||
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/blk000*.dat
|
||||
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/blk00{100..152}.dat
|
||||
```
|
||||
|
||||
Delete base torrent rev-files with:
|
||||
```
|
||||
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/rev000*.dat
|
||||
sudo rm /mnt/hdd/bitcoin/testnet3/blocks/rev00{100..152}.dat
|
||||
```
|
||||
|
||||
Now change again to your computer where you package the torrent files and transfere the three directories into your torrent base directory (should be your current working directory):
|
||||
```
|
||||
mkdir testnet3
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/blocks ./testnet3/blocks
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/chainstate ./testnet3/chainstate
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/indexes ./testnet3/indexes
|
||||
```
|
||||
|
||||
(Re-)name the "torrent base directory" to the same name as the torrent UPDATE file itself later (without the .torrent ending). For the correct naming see the chapter "Torrent Files Naming Schema" below.
|
||||
|
||||
Now open your torrent client (e.g. qTorrent for OSX) and create a new torrent-file with the freshly renamed "torrent base directory" as source directory.
|
||||
|
||||
Add this list of trackers to your torrent and start seeding (keep a free/empty line between the three single trackers):
|
||||
```
|
||||
udp://tracker.justseed.it:1337
|
||||
|
||||
udp://tracker.coppersurfer.tk:6969/announce
|
||||
|
||||
udp://open.demonii.si:1337/announce
|
||||
|
||||
udp://denis.stalker.upeer.me:6969/announce
|
||||
```
|
||||
|
||||
Name the new torrent file
|
||||
|
||||
To create the torrent file can take some time. Finally add the generated torrent file to the /home.admin/assets/ of the github and change the name of the updateTorrent varibale file in the script 50torrentHDD.bitcoin.sh
|
||||
|
||||
#### Torrent Files Naming Schema
|
||||
|
||||
The base torrent file should always have the following naming scheme:
|
||||
|
||||
`raspiblitz-[CHAINNETWORK][BASEITERATIONNUMBER]-[YEAR]-[MONTH]-[DAY]-base.torrent`
|
||||
|
||||
So for example the second version of the base torrent for litecoin created on 2018-10-31 would have this name: raspiblitz-litecoin2-2018-10-31-base.torrent
|
||||
|
||||
The update torrentfile should always have the following naming schema:
|
||||
|
||||
`raspiblitz-[CHAINNETWORK][BASEITERATIONNUMBER]-[YEAR]-[MONTH]-[DAY]-update.torrent`
|
||||
|
||||
So for exmaple an update torrent created on 2018-12-24 for litecoin that is an update to the second base torrent version would have this name: raspiblitz-litecoin2-2018-12-24-update.torrent
|
43
background_raspiblitzSettings.md
Normal file
43
background_raspiblitzSettings.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# 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.
|
|
@ -9,16 +9,85 @@
|
|||
##########################################################################
|
||||
|
||||
echo ""
|
||||
echo "***************************************"
|
||||
echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.94*"
|
||||
echo "***************************************"
|
||||
echo "****************************************"
|
||||
echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.95 *"
|
||||
echo "****************************************"
|
||||
echo ""
|
||||
|
||||
echo ""
|
||||
echo "*** RASPI CONFIG ***"
|
||||
echo "*** CHECK BASE IMAGE ***"
|
||||
|
||||
# armv7=32Bit , armv8=64Bit
|
||||
echo "Check if Linux ARM based ..."
|
||||
isARM=$(uname -m | grep -c 'arm')
|
||||
if [ ${isARM} -eq 0 ]; then
|
||||
echo "!!! FAIL !!!"
|
||||
echo "Can just build on ARM Linux, not on:"
|
||||
uname -m
|
||||
exit 1
|
||||
fi
|
||||
echo "OK running on Linux ARM architecture."
|
||||
|
||||
# keep in mind thet DietPi for Raspberry is also a stripped down Raspbian
|
||||
echo "Detect Base Image ..."
|
||||
baseImage="?"
|
||||
isDietPi=$(uname -n | grep -c 'DietPi')
|
||||
isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian')
|
||||
if [ ${isRaspbian} -gt 0 ]; then
|
||||
baseImage="raspbian"
|
||||
fi
|
||||
if [ ${isDietPi} -gt 0 ]; then
|
||||
baseImage="dietpi"
|
||||
fi
|
||||
if [ "${baseImage}" = "?" ]; then
|
||||
cat /etc/os-release 2>/dev/null
|
||||
echo "!!! FAIL !!!"
|
||||
echo "Base Image cannot be detected or is not supported."
|
||||
exit 1
|
||||
else
|
||||
echo "OK running ${baseImage}"
|
||||
fi
|
||||
|
||||
# update debian
|
||||
echo ""
|
||||
echo "*** UPDATE DEBIAN ***"
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -f -y --allow-change-held-packages
|
||||
|
||||
# special prepare when DietPi
|
||||
if [ "${baseImage}" = "dietpi" ]; then
|
||||
echo ""
|
||||
echo "*** PREPARE DietPi ***"
|
||||
echo "renaming dietpi user ti pi"
|
||||
sudo usermod -l pi dietpi
|
||||
echo "install pip"
|
||||
sudo apt-get update
|
||||
sudo apt-get remove -y fail2ban
|
||||
sudo apt-get install -y build-essential
|
||||
sudp apt-get install -y python-pip
|
||||
fi
|
||||
|
||||
# special prepare when Raspbian
|
||||
if [ "${baseImage}" = "raspbian" ]; then
|
||||
echo ""
|
||||
echo "*** PREPARE Raspbian ***"
|
||||
# do memory split (16MB)
|
||||
sudo raspi-config nonint do_memory_split 16
|
||||
# set to wait until network is available on boot (0 seems to yes)
|
||||
sudo raspi-config nonint do_boot_wait 0
|
||||
# set WIFI country so boot does not block
|
||||
sudo raspi-config nonint do_wifi_country US
|
||||
# extra: remove some big packages not needed
|
||||
sudo apt-get remove -y --purge libreoffice*
|
||||
sudo apt-get clean
|
||||
sudo apt-get -y autoremove
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "*** CONFIG ***"
|
||||
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#raspi-config
|
||||
|
||||
# set new default passwort for pi and root user
|
||||
# set new default passwort for root user
|
||||
echo "root:raspiblitz" | sudo chpasswd
|
||||
echo "pi:raspiblitz" | sudo chpasswd
|
||||
|
||||
|
@ -29,31 +98,13 @@ sudo bash -c "echo '[Service]' >> /etc/systemd/system/getty@tty1.service.d/autol
|
|||
sudo bash -c "echo 'ExecStart=' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
||||
sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
||||
|
||||
# do memory split (16MB)
|
||||
sudo raspi-config nonint do_memory_split 16
|
||||
|
||||
# set to wait until network is available on boot (0 seems to yes)
|
||||
sudo raspi-config nonint do_boot_wait 0
|
||||
|
||||
# autodetect and set your timezone
|
||||
pip install -U tzupdate
|
||||
sleep 2
|
||||
sudo tzupdate
|
||||
|
||||
echo ""
|
||||
echo "*** SOFTWARE UPDATE ***"
|
||||
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#software-update
|
||||
|
||||
# installs like on RaspiBolt
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -f -y --allow-change-held-packages
|
||||
sudo apt-get install -y htop git curl bash-completion jq dphys-swapfile
|
||||
|
||||
# extra: remove some big packages not needed
|
||||
sudo apt-get remove -y --purge libreoffice*
|
||||
sudo apt-get clean
|
||||
sudo apt-get -y autoremove
|
||||
|
||||
echo ""
|
||||
echo "*** ADDING MAIN USER admin ***"
|
||||
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#adding-main-user-admin
|
||||
|
@ -82,13 +133,6 @@ echo "*** SWAP FILE ***"
|
|||
sudo dphys-swapfile swapoff
|
||||
sudo dphys-swapfile uninstall
|
||||
|
||||
echo ""
|
||||
echo "*** HARDENING ***"
|
||||
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#hardening-your-pi
|
||||
|
||||
# fail2ban (no config required)
|
||||
sudo apt-get install -y fail2ban
|
||||
|
||||
echo ""
|
||||
echo "*** INCREASE OPEN FILE LIMIT ***"
|
||||
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#increase-your-open-files-limit
|
||||
|
@ -325,14 +369,29 @@ sudo bash -c 'echo "SCRIPT=/home/admin/00infoLCD.sh" >> /home/pi/.bashrc'
|
|||
sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/pi/.bashrc'
|
||||
sudo bash -c 'echo "exec \$SCRIPT" >> /home/pi/.bashrc'
|
||||
|
||||
# create /home/pi/setup.sh - which will get executed after reboot by autologin pi user
|
||||
cat > /home/pi/setup.sh <<EOF
|
||||
# create /home/admin/setup.sh - which will get executed after reboot by autologin pi user
|
||||
cat > /home/admin/setup.sh <<EOF
|
||||
|
||||
# make LCD screen rotation correct
|
||||
sudo sed --in-place -i "57s/.*/dtoverlay=tft35a:rotate=270/" /boot/config.txt
|
||||
|
||||
EOF
|
||||
sudo chmod +x /home/pi/setup.sh
|
||||
sudo chmod +x /home/admin/setup.sh
|
||||
|
||||
echo ""
|
||||
echo "*** HARDENING ***"
|
||||
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#hardening-your-pi
|
||||
|
||||
# fail2ban (no config required)
|
||||
sudo apt-get install -y fail2ban
|
||||
|
||||
# *** BOOTSTRAP ***
|
||||
# see background README for details
|
||||
echo ""
|
||||
echo "*** RASPI BOOSTRAP SERVICE ***"
|
||||
sudo chmod +x /home/admin/_bootstrap.sh
|
||||
sudo cp ./assets/bootstrap.service /etc/systemd/system/bootstrap.service
|
||||
sudo systemctl enable bootstrap
|
||||
|
||||
# *** RASPIBLITZ IMAGE READY ***
|
||||
echo ""
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# load code software version
|
||||
source /home/admin/_version.info
|
||||
|
||||
# set colors
|
||||
color_red='\033[0;31m'
|
||||
|
@ -39,16 +42,8 @@ else
|
|||
color_ram=${color_green}
|
||||
fi
|
||||
|
||||
# get storage
|
||||
sd_free_ratio=$(printf "%d" "$(df -h | grep "/$" | awk '{ print $4/$2*100 }')") 2>/dev/null
|
||||
sd=$(printf "%s (%s%%)" "$(df -h | grep '/$' | awk '{ print $4 }')" "${sd_free_ratio}")
|
||||
if [ ${sd_free_ratio} -lt 10 ]; then
|
||||
color_sd="${color_red}"
|
||||
else
|
||||
color_sd=${color_green}
|
||||
fi
|
||||
|
||||
hdd_free_ratio=$(printf "%d" "$(df -h | grep '/mnt/hdd$' | awk '{ print $4/$2*100 }')") 2>/dev/null
|
||||
# get free HDD ratio
|
||||
hdd_free_ratio=$(printf "%d" "$(df -h | grep '/mnt/hdd$' | awk '{ print $4/$2*100 }')" 2>/dev/null)
|
||||
hdd=$(printf "%s (%s%%)" "$(df -h | grep '/mnt/hdd$' | awk '{ print $4 }')" "${hdd_free_ratio}")
|
||||
|
||||
if [ ${hdd_free_ratio} -lt 10 ]; then
|
||||
|
@ -70,12 +65,12 @@ network_tx=$(ifconfig ${network_interface} | grep 'TX packets' | awk '{ print $6
|
|||
btc_path=$(command -v ${network}-cli)
|
||||
if [ -n ${btc_path} ]; then
|
||||
btc_title=$network
|
||||
blockchaininfo="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo)"
|
||||
blockchaininfo="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo 2>/dev/null)"
|
||||
if [ ${#blockchaininfo} -gt 0 ]; then
|
||||
btc_title="${btc_title} (${chain}net)"
|
||||
|
||||
# get sync status
|
||||
block_chain="$(${network}-cli -datadir=${bitcoin_dir} getblockcount)"
|
||||
block_chain="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
|
||||
block_verified="$(echo "${blockchaininfo}" | jq -r '.blocks')"
|
||||
block_diff=$(expr ${block_chain} - ${block_verified})
|
||||
|
||||
|
@ -101,13 +96,13 @@ if [ -n ${btc_path} ]; then
|
|||
fi
|
||||
|
||||
# get last known block
|
||||
last_block="$(${network}-cli -datadir=${bitcoin_dir} getblockcount)"
|
||||
last_block="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
|
||||
if [ ! -z "${last_block}" ]; then
|
||||
btc_line2="${btc_line2} ${color_gray}(block ${last_block})"
|
||||
fi
|
||||
|
||||
# get mem pool transactions
|
||||
mempool="$(${network}-cli -datadir=${bitcoin_dir} getmempoolinfo | jq -r '.size')"
|
||||
mempool="$(${network}-cli -datadir=${bitcoin_dir} getmempoolinfo 2>/dev/null | jq -r '.size')"
|
||||
|
||||
else
|
||||
btc_line2="${color_red}NOT RUNNING\t\t"
|
||||
|
@ -115,22 +110,32 @@ if [ -n ${btc_path} ]; then
|
|||
fi
|
||||
|
||||
# get IP address & port
|
||||
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
|
||||
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo 2>/dev/null)
|
||||
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
public_ip=$(curl -s http://v4.ipv6-test.com/api/myip.php)
|
||||
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
|
||||
if [ "${public_port}" = "null" ]; then
|
||||
public_port="8333"
|
||||
fi
|
||||
|
||||
# check if RTL web interface is installed
|
||||
webinterfaceInfo=""
|
||||
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
if [ ${runningRTL} -eq 1 ]; then
|
||||
webinterfaceInfo="web admin --> ${color_green}http://${local_ip}:3000"
|
||||
fi
|
||||
|
||||
# CHAIN NETWORK
|
||||
public_addr="??"
|
||||
torInfo=""
|
||||
# Version
|
||||
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version | cut -d ' ' -f6)
|
||||
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
|
||||
# TOR or IP
|
||||
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
|
||||
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
|
||||
networkConnections=$(echo ${networkInfo} | jq -r '.connections')
|
||||
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections"
|
||||
if [ ${#onionAddress} -gt 0 ]; then
|
||||
if [ "${onionAddress}" != "null" ]; then
|
||||
# TOR address
|
||||
public_addr="${onionAddress}:${public_port}"
|
||||
public=""
|
||||
|
@ -139,7 +144,7 @@ if [ ${#onionAddress} -gt 0 ]; then
|
|||
else
|
||||
# IP address
|
||||
public_addr="${public_ip}:${public_port}"
|
||||
public_check=$(timeout 2s nc -z ${public_ip} ${public_port}; echo $?)
|
||||
public_check=$(timeout 2s nc -z ${public_ip} ${public_port} 2>/dev/null; echo $?)
|
||||
if [ $public_check = "0" ]; then
|
||||
public="Yes"
|
||||
public_color="${color_green}"
|
||||
|
@ -149,14 +154,11 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
#IP
|
||||
|
||||
|
||||
# LIGHTNING NETWORK
|
||||
|
||||
ln_baseInfo="-"
|
||||
ln_channelInfo="\n"
|
||||
ln_external=""
|
||||
ln_external="\n"
|
||||
|
||||
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
|
||||
if [ "$wallet_unlocked" -gt 0 ] ; then
|
||||
|
@ -172,8 +174,8 @@ else
|
|||
if [ ${#ln_getInfo} -eq 0 ]; then
|
||||
ln_baseInfo="${color_red} Not Started | Not Ready Yet"
|
||||
else
|
||||
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep "(height" | tail -n1 | awk '{print $10} {print $11} {print $12}' | tr -dc '0-9')
|
||||
total=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.blocks')
|
||||
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep "(height" | tail -n1 | awk '{print $10} {print $11} {print $12}' | tr -dc '0-9')
|
||||
total=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>/dev/null | jq -r '.blocks')
|
||||
ln_baseInfo="${color_red} waiting for chain sync"
|
||||
if [ ${#item} -gt 0 ]; then
|
||||
ln_channelInfo="scanning ${item}/${total}"
|
||||
|
@ -202,7 +204,7 @@ ${color_yellow} ,/ ${color_yellow}%s
|
|||
${color_yellow} ,'/ ${color_gray}%s, CPU %s°C
|
||||
${color_yellow} ,' / ${color_gray}Free Mem ${color_ram}${ram} ${color_gray} Free HDD ${color_hdd}%s
|
||||
${color_yellow} ,' /_____, ${color_gray}ssh admin@${color_green}${local_ip}${color_gray} ▼${network_rx} ▲${network_tx}
|
||||
${color_yellow} .'____ ,' ${color_gray}
|
||||
${color_yellow} .'____ ,' ${color_gray}${webinterfaceInfo}
|
||||
${color_yellow} / ,' ${color_gray}${network} ${color_green}${networkVersion} ${chain}net ${color_gray}Sync ${sync_color}${sync} (%s)
|
||||
${color_yellow} / ,' ${color_gray}Public ${public_color}${public_addr} ${public} ${networkConnectionsInfo}
|
||||
${color_yellow} /,' ${color_gray}
|
||||
|
@ -211,7 +213,7 @@ ${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
|
|||
${color_yellow}
|
||||
${color_yellow}${ln_external}
|
||||
" \
|
||||
"RaspiBlitz v0.93" \
|
||||
"RaspiBlitz v${codeVersion}" \
|
||||
"-------------------------------------------" \
|
||||
"load average:${load##up*, }" "${temp}" \
|
||||
"${hdd}" "${sync_percentage}"
|
||||
|
|
|
@ -1,46 +1,58 @@
|
|||
#!/bin/sh
|
||||
if [ "$USER" = "pi" ]; then
|
||||
#!/bin/bash
|
||||
|
||||
# check for after setup script
|
||||
afterSetupScriptExists=$(ls /home/pi/setup.sh 2>/dev/null | grep -c setup.sh)
|
||||
if [ ${afterSetupScriptExists} -eq 1 ]; then
|
||||
echo "*** SETUP SCRIPT DETECTED ***"
|
||||
sudo cat /home/pi/setup.sh
|
||||
sudo /home/pi/setup.sh
|
||||
sudo rm /home/pi/setup.sh
|
||||
echo "DONE wait 6 secs ... one more reboot needed ... "
|
||||
sudo shutdown -r now
|
||||
fi
|
||||
### USER PI AUTOSTART (LCD Display)
|
||||
# this script gets started by the autologin of the pi user and
|
||||
# and its output is gets displayed on the LCD or the RaspiBlitz
|
||||
|
||||
# load network
|
||||
network=`sudo cat /home/admin/.network 2>/dev/null`
|
||||
# check that user is pi
|
||||
if [ "$USER" != "pi" ]; then
|
||||
echo "plz run as user pi --> su pi"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### USER PI AUTOSTART (LCD Display)
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
# check if RTL web interface is installed
|
||||
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
|
||||
# check if bitcoin service is configured
|
||||
bitcoinInstalled=$(sudo -u bitcoin ls /mnt/hdd/${network}/ 2>/dev/null | grep -c ${network}.conf)
|
||||
if [ ${bitcoinInstalled} -eq 1 ]; then
|
||||
# wait enough secs to let bitcoind init
|
||||
dialog --pause " Waiting for ${network} to startup and init ..." 8 58 130
|
||||
fi
|
||||
# DISPLAY LOOP
|
||||
chain=""
|
||||
freshstart=1
|
||||
while :
|
||||
do
|
||||
|
||||
# show updating status in loop
|
||||
chain=""
|
||||
while :
|
||||
do
|
||||
# get the local network IP to be displayed on the lCD
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
dhcpMissing=
|
||||
|
||||
# refresh network
|
||||
if [ ${#localip} -eq 0 ]; then
|
||||
|
||||
# waiting for IP in general
|
||||
l1="Waiting for Network ...\n"
|
||||
l2="Not able to get local IP.\n"
|
||||
l3="Is LAN cable connected?\n"
|
||||
dialog --backtitle "RaspiBlitz" --infobox "$l1$l2$l3" 5 30
|
||||
sleep 3
|
||||
|
||||
elif [ "${localip:0:4}" = "169." ]; then
|
||||
|
||||
# waiting for IP in general
|
||||
l1="Waiting for DHCP ...\n"
|
||||
l2="Not able to get local IP.\n"
|
||||
l3="Is Router working?\n"
|
||||
dialog --backtitle "RaspiBlitz (${localip})" --infobox "$l1$l2$l3" 5 30
|
||||
sleep 3
|
||||
|
||||
else
|
||||
|
||||
# refresh network (if information is already available)
|
||||
network=`sudo cat /home/admin/.network 2>/dev/null`
|
||||
|
||||
# get the setup state
|
||||
setupStepExists=$(sudo -u admin ls -la /home/admin/.setup 2>/dev/null | grep -c .setup)
|
||||
if [ ${setupStepExists} -eq 1 ]; then
|
||||
setupStep=$(sudo -u admin cat /home/admin/.setup)
|
||||
else
|
||||
setupStep=0
|
||||
# get the actual step number of setup process
|
||||
setupStep=$(sudo -u admin cat /home/admin/.setup 2>/dev/null)
|
||||
if [ ${#setupStep} -eq 0 ]; then
|
||||
setupStep=0
|
||||
fi
|
||||
|
||||
# before initial setup
|
||||
if [ ${setupStep} -eq 0 ]; then
|
||||
|
||||
# setup process has not started yet
|
||||
|
@ -49,23 +61,31 @@ if [ "$USER" = "pi" ]; then
|
|||
l3="Use password: raspiblitz\n"
|
||||
boxwidth=$((${#localip} + 24))
|
||||
sleep 3
|
||||
dialog --backtitle "RaspiBlitz - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 5
|
||||
|
||||
# during basic setup
|
||||
elif [ ${setupStep} -lt 65 ]; then
|
||||
|
||||
# setup process has not started yet
|
||||
l1="Login to your RaspiBlitz with:\n"
|
||||
l2="ssh admin@${localip}\n"
|
||||
l3="Use your password A\n"
|
||||
boxwidth=$((${#localip} + 24))
|
||||
# setup process has not started yet
|
||||
l1="Login to your RaspiBlitz with:\n"
|
||||
l2="ssh admin@${localip}\n"
|
||||
l3="Use your password A\n"
|
||||
boxwidth=$((${#localip} + 24))
|
||||
sleep 3
|
||||
dialog --backtitle "RaspiBlitz - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 5
|
||||
|
||||
# when blockchain and lightning are running
|
||||
elif [ ${setupStep} -lt 100 ]; then
|
||||
|
||||
# setup process init is done and not finished
|
||||
# when entering first time after boot - display a delay
|
||||
if [ ${freshstart} -eq 1 ]; then
|
||||
dialog --pause " Waiting for ${network} to startup and init ..." 8 58 130
|
||||
freshstart=0
|
||||
fi
|
||||
|
||||
# get state of system
|
||||
if [ ${#chain} -eq 0 ];then
|
||||
# get chain if not available before
|
||||
chain=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>/dev/null | jq -r '.chain')
|
||||
|
@ -79,8 +99,12 @@ if [ "$USER" = "pi" ]; then
|
|||
l1="!!! LND WALLET IS LOCKED !!!\n"
|
||||
l2="Login: ssh admin@${localip}\n"
|
||||
l3="Use your Password A\n"
|
||||
if [ ${runningRTL} -eq 1 ]; then
|
||||
l2="Open: http://${localip}:3000\n"
|
||||
l3="Use Password C to unlock\n"
|
||||
fi
|
||||
boxwidth=$((${#localip} + 24))
|
||||
dialog --backtitle "RaspiBlitz - Action Required" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Action Required" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 5
|
||||
|
||||
elif [ ${lndSynced} -eq 0 ]; then
|
||||
|
@ -97,40 +121,62 @@ if [ "$USER" = "pi" ]; then
|
|||
l3="Use your Password A\n"
|
||||
boxwidth=$((${#localip} + 24))
|
||||
sleep 3
|
||||
dialog --backtitle "RaspiBlitz - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 10
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# RaspiBlitz is full Setup
|
||||
# RASPIBLITZ iS FULL SETUP
|
||||
|
||||
chain=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
||||
if [ ${locked} -gt 0 ]; then
|
||||
|
||||
# special case: LND wallet is locked ---> show unlock info
|
||||
l1="!!! LND WALLET IS LOCKED !!!\n"
|
||||
l2="Login: ssh admin@${localip}\n"
|
||||
l3="Use your Password A\n"
|
||||
boxwidth=$((${#localip} + 24))
|
||||
dialog --backtitle "RaspiBlitz - Welcome" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
# check if bitcoin is ready
|
||||
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
|
||||
clienterror=`cat error.tmp`
|
||||
rm error.tmp
|
||||
if [ ${#clienterror} -gt 0 ]; then
|
||||
l1="Waiting for ${network}d to get ready.\n"
|
||||
l2="---> Starting Up\n"
|
||||
l3="Can take longer if devcie was off."
|
||||
isVerifying=$(echo "${clienterror}" | grep -c 'Verifying blocks')
|
||||
if [ ${isVerifying} -gt 0 ]; then
|
||||
l2="---> Verifying Blocks\n"
|
||||
fi
|
||||
boxwidth=40
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Welcome" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 5
|
||||
|
||||
else
|
||||
|
||||
# no special case - show status display
|
||||
/home/admin/00infoBlitz.sh
|
||||
sleep 5
|
||||
|
||||
# check if locked
|
||||
locked=$(sudo -u admin lncli --chain=${network} getinfo 2>&1 | grep -c unlock)
|
||||
if [ "${locked}" -gt 0 ]; then
|
||||
|
||||
# special case: LND wallet is locked ---> show unlock info
|
||||
l1="!!! LND WALLET IS LOCKED !!!\n"
|
||||
l2="Login: ssh admin@${localip}\n"
|
||||
l3="Use your Password A\n"
|
||||
if [ ${runningRTL} -eq 1 ]; then
|
||||
l2="Open: http://${localip}:3000\n"
|
||||
l3="Use Password C to unlock\n"
|
||||
fi
|
||||
boxwidth=$((${#localip} + 24))
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Welcome" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 5
|
||||
|
||||
else
|
||||
|
||||
# no special case - show status display
|
||||
/home/admin/00infoBlitz.sh
|
||||
sleep 5
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
else
|
||||
fi
|
||||
|
||||
echo "plz run as user pi --> su pi"
|
||||
done
|
||||
|
||||
fi
|
||||
|
|
|
@ -24,6 +24,37 @@ if [ ${isMainChain} -gt 0 ];then
|
|||
chain="main"
|
||||
fi
|
||||
|
||||
# check if RTL web interface is installed
|
||||
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
|
||||
# get the local network IP to be displayed on the lCD
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
|
||||
# function to use later
|
||||
waitUntilChainNetworkIsReady()
|
||||
{
|
||||
while :
|
||||
do
|
||||
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
|
||||
clienterror=`cat error.tmp`
|
||||
rm error.tmp
|
||||
if [ ${#clienterror} -gt 0 ]; then
|
||||
l1="Waiting for ${network}d to get ready.\n"
|
||||
l2="---> Starting Up\n"
|
||||
l3="Can take longer if devcie was off."
|
||||
isVerifying=$(echo "${clienterror}" | grep -c 'Verifying blocks')
|
||||
if [ ${isVerifying} -gt 0 ]; then
|
||||
l2="---> Verifying Blocks\n"
|
||||
fi
|
||||
boxwidth=40
|
||||
dialog --backtitle "RaspiBlitz ${localip} - Welcome" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
||||
sleep 5
|
||||
else
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
## get actual setup state
|
||||
setupState=0;
|
||||
if [ -f "/home/admin/.setup" ]; then
|
||||
|
@ -41,12 +72,8 @@ if [ ${setupState} -eq 0 ]; then
|
|||
|
||||
elif [ ${setupState} -lt 100 ]; then
|
||||
|
||||
# make sure to have a init pause aufter fresh boot
|
||||
uptimesecs=$(awk '{print $1}' /proc/uptime | awk '{print int($1)}')
|
||||
waittimesecs=$(expr 150 - $uptimesecs)
|
||||
if [ ${waittimesecs} -gt 0 ]; then
|
||||
dialog --pause " Waiting for ${network} to startup and init ..." 8 58 ${waittimesecs}
|
||||
fi
|
||||
# see function above
|
||||
waitUntilChainNetworkIsReady
|
||||
|
||||
# continue setup
|
||||
BACKTITLE="${name} / ${network} / ${chain}"
|
||||
|
@ -57,12 +84,8 @@ elif [ ${setupState} -lt 100 ]; then
|
|||
|
||||
else
|
||||
|
||||
# make sure to have a init pause aufter fresh boot
|
||||
uptimesecs=$(awk '{print $1}' /proc/uptime | awk '{print int($1)}')
|
||||
waittimesecs=$(expr 150 - $uptimesecs)
|
||||
if [ ${waittimesecs} -gt 0 ]; then
|
||||
dialog --pause " Waiting for ${network} to startup and init ..." 8 58 ${waittimesecs}
|
||||
fi
|
||||
# see function above
|
||||
waitUntilChainNetworkIsReady
|
||||
|
||||
# MAIN MENU AFTER SETUP
|
||||
|
||||
|
@ -77,6 +100,10 @@ else
|
|||
|
||||
else
|
||||
|
||||
if [ ${runningRTL} -eq 1 ]; then
|
||||
TITLE="Webinterface: http://${localip}:3000"
|
||||
fi
|
||||
|
||||
switchOption="to MAINNET"
|
||||
if [ "${chain}" = "main" ]; then
|
||||
switchOption="back to TESTNET"
|
||||
|
@ -90,6 +117,7 @@ else
|
|||
CHANNEL "Open a Channel with Peer" \
|
||||
SEND "Pay an Invoice/PaymentRequest" \
|
||||
RECEIVE "Create Invoice/PaymentRequest" \
|
||||
SERVICES "Activate/Deactivate Services" \
|
||||
lnbalance "Detailed Wallet Balances" \
|
||||
lnchannels "Lightning Channel List" \
|
||||
MOBILE "Connect Mobile Wallet")
|
||||
|
@ -109,8 +137,15 @@ else
|
|||
OPTIONS+=(NYX "Monitor TOR")
|
||||
fi
|
||||
|
||||
if [ ${runningRTL} -eq 0 ]; then
|
||||
OPTIONS+=(RTL "Install RTL Web Interface")
|
||||
else
|
||||
OPTIONS+=(RTL "REMOVE RTL Web Interface")
|
||||
fi
|
||||
|
||||
# final Options
|
||||
OPTIONS+=(X "Console / Terminal")
|
||||
OPTIONS+=(OFF "PowerOff RaspiBlitz")
|
||||
OPTIONS+=(X "Console / Terminal")
|
||||
|
||||
fi
|
||||
|
||||
|
@ -201,6 +236,10 @@ case $CHOICE in
|
|||
read key
|
||||
./00mainMenu.sh
|
||||
;;
|
||||
SERVICES)
|
||||
./00settingsMenuServices.sh
|
||||
./00mainMenu.sh
|
||||
;;
|
||||
CLOSEALL)
|
||||
./BBcloseAllChannels.sh
|
||||
echo "Press ENTER to return to main menu."
|
||||
|
@ -224,6 +263,19 @@ case $CHOICE in
|
|||
echo "Press ENTER to return to main menu."
|
||||
read key
|
||||
./00mainMenu.sh
|
||||
;;
|
||||
RTL)
|
||||
sudo ./98installRTL.sh
|
||||
echo "Press ENTER to return to main menu."
|
||||
read key
|
||||
./00mainMenu.sh
|
||||
;;
|
||||
OFF)
|
||||
echo "After Shutdown remove power from RaspiBlitz."
|
||||
echo "Press ENTER to start shutdown - then wait some seconds."
|
||||
read key
|
||||
sudo shutdown now
|
||||
exit 0
|
||||
;;
|
||||
X)
|
||||
lncli -h
|
||||
|
|
39
home.admin/00settingsMenuServices.sh
Normal file
39
home.admin/00settingsMenuServices.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
# get raspiblitz config
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# show select dialog
|
||||
CHOICES=$(dialog --checklist "Activate/Deactivate Services:" 15 40 5 \
|
||||
1 "Channel Autopilot" ${autoPilot} \
|
||||
2>&1 >/dev/tty)
|
||||
#CHOICES=$(dialog --checklist "Activate/Deactivate Services:" 15 40 5 \
|
||||
#1 "Channel Autopilot" ${autoPilot} \
|
||||
#2 "UPnP Router-Portforwarding" ${natUPnP} \
|
||||
#3 "Auto Unlock on Start" ${autoUnlock} \
|
||||
#4 "Seed Torrent Blockchain" ${torrentSeed} \
|
||||
#4 "RTL Webinterface" ${rtlWebinterface} \
|
||||
#2>&1 >/dev/tty)
|
||||
dialogcancel=$?
|
||||
clear
|
||||
|
||||
# check if user canceled dialog
|
||||
if [ ${dialogcancel} -eq 1 ]; then
|
||||
echo "user canceled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# AUTOPILOT process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "1")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
sudo sed -i "s/^autoPilot=.*/autoPilot=${choice}/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# confirm reboot to activate new settings with bootstrap.service
|
||||
dialog --backtitle "Rebooting" --yesno "To activate the settings a reboot is needed." 6 52
|
||||
if [ $? -eq 0 ];then
|
||||
echo "Starting Reboot .."
|
||||
sudo shutdown -r now
|
||||
else
|
||||
echo "No Reboot - changes stored, but maybe not active."
|
||||
sleep 3
|
||||
fi
|
|
@ -77,16 +77,4 @@ sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${result}/g" /home/admin/a
|
|||
|
||||
# success info dialog
|
||||
dialog --backtitle "RaspiBlitz - SetUP" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52
|
||||
clear
|
||||
|
||||
# init get publicip service
|
||||
getpublicipExists=$(sudo ls /usr/local/bin/getpublicip.sh 2>/dev/null | grep "getpublicip.sh" -c)
|
||||
if [ ${getpublicipExists} -eq 0 ]; then
|
||||
echo "*** Installing getPublic ip script and service *** "
|
||||
sudo cp ./assets/getpublicip.sh /usr/local/bin/getpublicip.sh
|
||||
sudo chmod +x /usr/local/bin/getpublicip.sh
|
||||
sudo cp ./assets/getpublicip.service /etc/systemd/system/getpublicip.service
|
||||
sudo systemctl enable getpublicip
|
||||
sudo systemctl start getpublicip
|
||||
echo ""
|
||||
fi
|
||||
clear
|
|
@ -1,17 +1,20 @@
|
|||
#!/bin/bash
|
||||
echo ""
|
||||
|
||||
# get blockchain from https://getbitcoinblockchain.com torrents.
|
||||
# those ore two torrents:
|
||||
# 1) "blockchain" = blocks up to last month
|
||||
# 2) "update" = daily block/index update
|
||||
# this scripts will download both these torrents
|
||||
# see background_downloadBlockchain.md for info
|
||||
# why there are two torrent files
|
||||
|
||||
# torrent files that are available
|
||||
# in directory /home.admin/assets/
|
||||
# WITHOUT THE '.torrent' ENDING
|
||||
baseTorrentFile="raspiblitz-bitcoin1-2018-10-13-base"
|
||||
updateTorrentFile="raspiblitz-bitcoin1-2018-10-13-update"
|
||||
|
||||
# make sure rtorrent is available
|
||||
sudo apt-get install rtorrent -y
|
||||
echo ""
|
||||
|
||||
targetDir="/mnt/hdd/getbitcoinblockchain"
|
||||
targetDir="/mnt/hdd/torrent"
|
||||
sessionDir="/home/admin/.rtorrent.session"
|
||||
sudo mkdir ${sessionDir} 2>/dev/null
|
||||
|
||||
|
@ -19,7 +22,7 @@ sudo mkdir ${sessionDir} 2>/dev/null
|
|||
# CHECK TORRENT 1 "BLOCKCHAIN"
|
||||
##############################
|
||||
|
||||
echo "*** checking torrent 1: blockchain"
|
||||
echo "*** checking torrent 1: base blockchain"
|
||||
torrentComplete1=$(cat ${sessionDir}/blockchain/*.torrent.rtorrent | grep ':completei1' -c)
|
||||
echo "torrentComplete1(${torrentComplete1})"
|
||||
if [ ${torrentComplete1} -eq 0 ]; then
|
||||
|
@ -31,21 +34,21 @@ if [ ${torrentComplete1} -eq 0 ]; then
|
|||
|
||||
# start torrent download in screen session
|
||||
echo "starting torrent: blockchain"
|
||||
command1="sudo rtorrent -n -d ${targetDir} -s ${sessionDir}/blockchain/ https://getbitcoinblockchain.com/blockchain.torrent"
|
||||
command1="sudo rtorrent -n -d ${targetDir} -s ${sessionDir}/blockchain/ /home/admin/assets/${baseTorrentFile}.torrent"
|
||||
sudo mkdir ${targetDir} 2>/dev/null
|
||||
sudo mkdir ${sessionDir}/blockchain/ 2>/dev/null
|
||||
screenCommand="screen -S blockchain -L screen.log -dm ${command1}"
|
||||
echo "${screenCommand}"
|
||||
bash -c "${screenCommand}"
|
||||
|
||||
fi
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
##############################
|
||||
# CHECK TORRENT 2 "UPDATE"
|
||||
##############################
|
||||
|
||||
echo "*** checking torrent 2: update"
|
||||
echo "*** checking torrent 2: update blockchain"
|
||||
torrentComplete2=$(cat ${sessionDir}/update/*.torrent.rtorrent | grep ':completei1' -c)
|
||||
echo "torrentComplete2(${torrentComplete2})"
|
||||
if [ ${torrentComplete2} -eq 0 ]; then
|
||||
|
@ -57,7 +60,7 @@ if [ ${torrentComplete2} -eq 0 ]; then
|
|||
|
||||
# start torrent download in screen session
|
||||
echo "starting torrent: update"
|
||||
command2="sudo rtorrent -n -d ${targetDir} -s ${sessionDir}/update/ https://getbitcoinblockchain.com/update.torrent"
|
||||
command2="sudo rtorrent -n -d ${targetDir} -s ${sessionDir}/update/ /home/admin/assets/${updateTorrentFile}.torrent"
|
||||
sudo mkdir ${targetDir} 2>/dev/null
|
||||
sudo mkdir ${sessionDir}/update/ 2>/dev/null
|
||||
screenCommand="screen -S update -L screen.log -dm ${command2}"
|
||||
|
@ -66,6 +69,7 @@ if [ ${torrentComplete2} -eq 0 ]; then
|
|||
|
||||
fi
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
##############################
|
||||
# MONITOR PROGRESS
|
||||
|
@ -84,10 +88,12 @@ while :
|
|||
# display info screen
|
||||
clear
|
||||
echo "****************************************************"
|
||||
echo "Monitoring Screen Session: getbitcoinblockchain.com"
|
||||
echo "If needed press key x to stop TORRENT download"
|
||||
echo "Monitoring Screen Session: Torrent base+update"
|
||||
echo "NOTICE: This can take multiple hours or days !!"
|
||||
echo "Its OK to close terminal now and SSH back in later."
|
||||
echo "If u see the torrents 100% downloaded and verified,"
|
||||
echo "press X to continue. Also press x to abort download"
|
||||
echo "before 100% if you want to switch to another option."
|
||||
echo "****************************************************"
|
||||
echo ""
|
||||
|
||||
|
@ -210,14 +216,16 @@ if [ ${torrentComplete} -eq 0 ]; then
|
|||
fi
|
||||
|
||||
# the path torrent will download to
|
||||
targetPath1="${targetDir}/blockchain"
|
||||
targetPath2="${targetDir}/update/blockchain"
|
||||
targetPath1="${targetDir}/${baseTorrentFile}"
|
||||
targetPath2="${targetDir}/${updateTorrentFile}"
|
||||
|
||||
# Download worked / just move, copy on USB2 >4h
|
||||
echo ""
|
||||
echo "*** Moving Files ***"
|
||||
echo "can take some minutes ..."
|
||||
date +%s
|
||||
sudo mkdir /mnt/hdd/bitcoin
|
||||
echo "can take some minutes ... öease wait"
|
||||
|
||||
sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
|
||||
sudo mv ${targetPath1}/* /mnt/hdd/bitcoin/
|
||||
sudo cp -r ${targetPath2}/* /mnt/hdd/bitcoin/
|
||||
sudo rm -r ${targetDir}
|
||||
|
|
|
@ -14,12 +14,11 @@ litecoinTorrentsize=10240000
|
|||
# load network
|
||||
network=`cat .network`
|
||||
|
||||
|
||||
## experimental redirect if bitcoin
|
||||
#if [ "$network" = "bitcoin" ]; then
|
||||
# ./50torrentHDD.sh
|
||||
# exit 1
|
||||
#fi
|
||||
if [ "$network" = "bitcoin" ]; then
|
||||
./50torrentHDD.bitcoin.sh
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure rtorrent is available
|
||||
sudo apt-get install rtorrent -y
|
||||
|
|
|
@ -43,7 +43,8 @@ while [ ${chainIsReady} -eq 0 ]
|
|||
if [ "${chain}" = "test" ]; then
|
||||
testnetAdd="testnet3/"
|
||||
fi
|
||||
sudo tail -n 5 /mnt/hdd/bitcoin/${testnetAdd}debug.log
|
||||
sudo tail -n 5 /mnt/hdd/${network}/${testnetAdd}debug.log
|
||||
echo "If you see an error -28 relax, just give it some time."
|
||||
echo "Waiting 1 minute and then trying again ..."
|
||||
sleep 60
|
||||
echo ""
|
||||
|
|
|
@ -64,6 +64,8 @@ echo "allow: trasmission"
|
|||
sudo ufw allow 51413 comment 'transmission'
|
||||
echo "allow: local web admin"
|
||||
sudo ufw allow from 192.168.0.0/24 to any port 80 comment 'allow local LAN web'
|
||||
echo "open firewall for auto nat discover (see issue #129)"
|
||||
sudo ufw allow proto udp from 192.168.0.0/24 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
||||
echo "enable lazy firewall"
|
||||
sudo ufw --force enable
|
||||
echo ""
|
||||
|
|
|
@ -197,8 +197,8 @@ echo ""
|
|||
echo "*** Putting LND behind TOR ***"
|
||||
echo "Disable LND again"
|
||||
sudo systemctl disable lnd
|
||||
echo "Writing Public Onion Address to /run/publicip (just in case for TotHiddenServiceV3)"
|
||||
echo "PUBLICIP=${onionLND}" | sudo tee /run/publicip
|
||||
echo "Writing Public Onion Address to /mnt/hdd/tor/v3Address (just in case for TotHiddenServiceV3)"
|
||||
echo "V3ADDRESS=${onionLND}" | sudo tee /mnt/hdd/tor/v3Address
|
||||
echo "Configure and Changing to lnd.tor.service"
|
||||
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.tor.service
|
||||
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.tor.service
|
||||
|
|
|
@ -24,10 +24,9 @@ echo "Connect Shango Mobile Wallet"
|
|||
echo "******************************"
|
||||
echo ""
|
||||
echo "GETTING THE APP"
|
||||
echo "At the moment this app is in closed beta testing and the source code has not been published yet."
|
||||
echo "Go to http://www.shangoapp.com/insider sign up with your email (confirmation can take time)"
|
||||
echo "iOS: Read https://developer.apple.com/testflight/testers/"
|
||||
echo "Android: https://play.google.com/apps/testing/com.shango (from device, after confirmation email)"
|
||||
echo "At the moment this app is in public beta testing:"
|
||||
echo "iOS: Read https://testflight.apple.com/join/WwCjFnS8 (open on device)"
|
||||
echo "Android: https://play.google.com/apps/testing/com.shango (open on device)"
|
||||
echo ""
|
||||
echo "*** STEP 1 ***"
|
||||
echo "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
|
||||
|
|
97
home.admin/98installRTL.sh
Normal file
97
home.admin/98installRTL.sh
Normal file
|
@ -0,0 +1,97 @@
|
|||
#!/bin/sh
|
||||
|
||||
# INSTALLING THE RTL Webinterface from
|
||||
# https://github.com/ShahanaFarooqui/RTL/blob/master/README.md
|
||||
|
||||
# get the local network IP to be displayed on the lCD
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
|
||||
# load network
|
||||
network=`sudo cat /home/admin/.network`
|
||||
|
||||
# get chain
|
||||
chain="test"
|
||||
isMainChain=$(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep "#testnet=1" -c)
|
||||
if [ ${isMainChain} -gt 0 ];then
|
||||
chain="main"
|
||||
fi
|
||||
|
||||
echo "*** Check if RTL is installed ***"
|
||||
isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
|
||||
echo "*** Dialog ***"
|
||||
dialog --title "Deinstall: Ride The Lightning Web Interface" --yesno "RTL is installed. You you want to remove?" 5 50
|
||||
response=$?
|
||||
case $response in
|
||||
1) exit 1 ;;
|
||||
esac
|
||||
clear
|
||||
|
||||
echo "*** REMOVING RTL ***"
|
||||
sudo systemctl stop RTL
|
||||
sudo systemctl disable RTL
|
||||
sudo rm /etc/systemd/system/RTL.service
|
||||
sudo rm -r /home/admin/RTL
|
||||
echo "OK done."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "*** Dialog ***"
|
||||
dialog --title "Install: Ride The Lightning Web Interface" --yesno "This is still experimental and very reckless:\nOnce your wallet is unlocked EVERYBODY in your\nLOCAL NETWORK can CONTROL YOUR NODE with RTL!\nDo you really want to install RTL?" 8 50
|
||||
response=$?
|
||||
case $response in
|
||||
1) exit 1 ;;
|
||||
esac
|
||||
clear
|
||||
|
||||
# disable RPC listen
|
||||
# to prevent tls cer auth error
|
||||
echo "*** Modify lnd.conf ***"
|
||||
sudo sed -i "s/^rpclisten=0.0.0.0:10009/#rpclisten=0.0.0.0:10009/g" /mnt/hdd/lnd/lnd.conf
|
||||
sudo systemctl restart lnd
|
||||
echo ""
|
||||
|
||||
# install latest nodejs
|
||||
echo "*** Install NodeJS ***"
|
||||
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
echo ""
|
||||
|
||||
# close source code
|
||||
echo "*** Get the RTL Source Code ***"
|
||||
git clone https://github.com/ShahanaFarooqui/RTL.git
|
||||
cd RTL
|
||||
npm install
|
||||
cd ..
|
||||
echo ""
|
||||
|
||||
# open firewall
|
||||
echo "*** Updating Firewall ***"
|
||||
sudo ufw allow 3000
|
||||
sudo ufw --force enable
|
||||
echo ""
|
||||
|
||||
# install service
|
||||
echo "*** Install RTL systemd for ${network} on ${chain} ***"
|
||||
sudo cp /home/admin/assets/RTL.service /etc/systemd/system/RTL.service
|
||||
sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${chain}net|" /etc/systemd/system/RTL.service
|
||||
sudo systemctl enable RTL
|
||||
sudo systemctl start RTL
|
||||
sleep 2
|
||||
echo ""
|
||||
|
||||
# install service
|
||||
echo "*** READY ***"
|
||||
echo "RTL web servcie should be installed and running now."
|
||||
echo ""
|
||||
echo "Try to open the following URL in your local webrowser"
|
||||
echo "and unlock your wallet from there with PASSWORD C."
|
||||
echo "---> http://${localip}:3000"
|
||||
echo ""
|
||||
echo "RTL web server will now start with every new boot."
|
||||
echo "Always unlock your wallet from there now."
|
||||
echo "Just use RTL from same local network, DONT forward"
|
||||
echo "port 3000 on your internet router to the RaspiBlitz."
|
||||
echo ""
|
||||
echo "Have fun 'Riding the Lightning' (RTL) :D"
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
_temp="./download/dialog.$$"
|
||||
_error="./.error.out"
|
||||
sudo chmod 7777 ${_error}
|
||||
|
||||
# load network and chain info
|
||||
network=`cat .network`
|
||||
|
|
|
@ -60,4 +60,5 @@ if [ "$chain" = "test" ]; then
|
|||
echo "get some testnet coins from https://testnet-faucet.mempool.co"
|
||||
fi
|
||||
echo "Whats next? --> Wait for confirmations. You can use lnbalance for main menu or info on LCD to check if funds have arrived."
|
||||
echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'"
|
||||
echo ""
|
||||
|
|
|
@ -71,7 +71,7 @@ fi
|
|||
# TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq
|
||||
|
||||
# build command
|
||||
command="lncli --chain=${network} sendpayment --pay_req=${invoice}"
|
||||
command="lncli --chain=${network} sendpayment --force --pay_req=${invoice}"
|
||||
|
||||
# info output
|
||||
clear
|
||||
|
|
140
home.admin/_bootstrap.sh
Normal file
140
home.admin/_bootstrap.sh
Normal file
|
@ -0,0 +1,140 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script runs on every start calles by boostrap.service
|
||||
# It makes sure that the system is configured like the
|
||||
# default values or as in the config.
|
||||
# For more details see background_raspiblitzSettings.md
|
||||
|
||||
# load codeVersion
|
||||
source /home/admin/_version.info
|
||||
|
||||
logfile="/home/admin/raspiblitz.log"
|
||||
echo "Writing logs to: ${logfile}"
|
||||
echo "" > $logfile
|
||||
echo "***********************************************" >> $logfile
|
||||
echo "Running RaspiBlitz Bootstrap ${codeVersion}" >> $logfile
|
||||
date >> $logfile
|
||||
echo "***********************************************" >> $logfile
|
||||
|
||||
|
||||
################################
|
||||
# AFTER BOOT SCRIPT
|
||||
# when a process needs to
|
||||
# execute stuff after a reboot
|
||||
# /home/admin/setup.sh
|
||||
################################
|
||||
|
||||
# check for after boot script
|
||||
afterSetupScriptExists=$(ls /home/admin/setup.sh 2>/dev/null | grep -c setup.sh)
|
||||
if [ ${afterSetupScriptExists} -eq 1 ]; then
|
||||
echo "*** SETUP SCRIPT DETECTED ***"
|
||||
# echo out script to journal logs
|
||||
sudo cat /home/admin/setup.sh
|
||||
# execute the after boot script
|
||||
sudo /home/admin/setup.sh
|
||||
# delete the after boot script
|
||||
sudo rm /home/admin/setup.sh
|
||||
# reboot again
|
||||
echo "DONE wait 6 secs ... one more reboot needed ... "
|
||||
sudo shutdown -r now
|
||||
sleep 100
|
||||
fi
|
||||
|
||||
|
||||
################################
|
||||
# PUBLIC IP
|
||||
# for LND on startup
|
||||
################################
|
||||
printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip;
|
||||
chmod 774 /run/publicip
|
||||
|
||||
|
||||
################################
|
||||
# HDD CHECK / INIT
|
||||
# for the very first setup
|
||||
################################
|
||||
|
||||
# check if the HDD is mounted
|
||||
hddAvailable=$(ls -la /mnt/hdd 2>/dev/null)
|
||||
if [ ${#hddAvailable} -eq 0 ]; then
|
||||
echo "HDD is NOT available" >> $logfile
|
||||
echo "TODO: Try to mount."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
################################
|
||||
# CONFIGFILE BASICS
|
||||
################################
|
||||
|
||||
# check if there is a config file
|
||||
configFile="/mnt/hdd/raspiblitz.conf"
|
||||
configExists=$(ls ${configFile} 2>/dev/null | grep -c '.conf')
|
||||
if [ ${configExists} -eq 0 ]; then
|
||||
|
||||
# create new config
|
||||
echo "creating config file: ${configFile}" >> $logfile
|
||||
echo "# RASPIBLITZ CONFIG FILE" > $configFile
|
||||
echo "raspiBlitzVersion='${version}'" >> $configFile
|
||||
sudo chmod 777 ${configFile}
|
||||
|
||||
else
|
||||
|
||||
# load & check config version
|
||||
source $configFile
|
||||
if [ "${raspiBlitzVersion}" != "${raspiBlitzVersion}" ]; then
|
||||
echo "detected version change ... starting migration script" >> $logfile
|
||||
/home/admin/_migrateVersion.sh
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
################################
|
||||
# DEFAULT VALUES
|
||||
################################
|
||||
|
||||
# AUTOPILOT
|
||||
# autoPilot=off|on
|
||||
if [ ${#autoPilot} -eq 0 ]; then
|
||||
echo "autoPilot=off" >> $configFile
|
||||
fi
|
||||
|
||||
# after all default values written to config - reload config
|
||||
source $configFile
|
||||
|
||||
|
||||
################################
|
||||
# AUTOPILOT
|
||||
################################
|
||||
|
||||
echo "" >> $logfile
|
||||
echo "** AUTOPILOT" >> $logfile
|
||||
|
||||
# check if LND is installed
|
||||
lndExists=$(ls /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep -c '.conf')
|
||||
if [ ${lndExists} -eq 1 ]; then
|
||||
|
||||
# check if autopilot is active in LND config
|
||||
lndAutopilot=$( grep -c "autopilot.active=1" /mnt/hdd/lnd/lnd.conf )
|
||||
echo "confAutopilot(${autoPilot})" >> $logfile
|
||||
echo "lndAutopilot(${lndAutopilot})" >> $logfile
|
||||
|
||||
# switch on
|
||||
if [ ${lndAutopilot} -eq 0 ] && [ "${autoPilot}" = "on" ]; then
|
||||
echo "switching the LND autopilot ON" >> $logfile
|
||||
sudo sed -i "s/^autopilot.active=.*/autopilot.active=1/g" /mnt/hdd/lnd/lnd.conf
|
||||
fi
|
||||
|
||||
# switch off
|
||||
if [ ${lndAutopilot} -eq 1 ] && [ "${autoPilot}" = "off" ]; then
|
||||
echo "switching the LND autopilot OFF" >> $logfile
|
||||
sudo sed -i "s/^autopilot.active=.*/autopilot.active=0/g" /mnt/hdd/lnd/lnd.conf
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "WARNING: /mnt/hdd/lnd/lnd.conf does not exists. Setup needs to run properly first!" >> $logfile
|
||||
|
||||
fi
|
||||
|
||||
echo "" >> $logfile
|
||||
echo "DONE BOOTSTRAP" >> $logfile
|
17
home.admin/_migration.sh
Normal file
17
home.admin/_migration.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
# load codeVersion
|
||||
source ./_version.info
|
||||
|
||||
# load raspiblitz config
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo ""
|
||||
echo "*****************************"
|
||||
echo "Version Migration RaspiBlitz"
|
||||
echo "*****************************"
|
||||
echo "Version Code: ${codeVersion}"
|
||||
echo "Version Data: ${raspiBlitzVersion}"
|
||||
|
||||
echo "TODO: Update Migration check ..."
|
||||
echo ""
|
2
home.admin/_version.info
Normal file
2
home.admin/_version.info
Normal file
|
@ -0,0 +1,2 @@
|
|||
# RaspiBlitz Version - always [main].[sub]
|
||||
codeVersion="0.95"
|
17
home.admin/assets/RTL.service
Normal file
17
home.admin/assets/RTL.service
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Raspibolt RTL: systemd unit for RTL
|
||||
# /etc/systemd/system/RTL.service
|
||||
|
||||
[Unit]
|
||||
Description=RTL daemon
|
||||
Wants=lnd.service
|
||||
After=lnd.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/node /home/admin/RTL/rtl --lndir /home/admin/.lnd/data/chain/bitcoin/mainnet
|
||||
User=root
|
||||
Restart=always
|
||||
TimeoutSec=120
|
||||
RestartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
[Unit]
|
||||
Description=Bitcoin daemon
|
||||
Wants=getpublicip.service
|
||||
After=getpublicip.service
|
||||
Wants=bootstrap.service
|
||||
After=bootstrap.service
|
||||
|
||||
# for use with sendmail alert (coming soon)
|
||||
#OnFailure=systemd-sendmail@%n
|
||||
|
|
16
home.admin/assets/bootstrap.service
Normal file
16
home.admin/assets/bootstrap.service
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Boostrap the RaspiBlitz
|
||||
# /etc/systemd/system/bootstrap.service
|
||||
|
||||
[Unit]
|
||||
Description=setting up RaspiBlitz and enforcing the config on every startup
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
Type=oneshot
|
||||
ExecStart=/home/admin/_bootstrap.sh
|
||||
StandardOutput=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,20 +0,0 @@
|
|||
# RaspiBolt LND Mainnet: systemd unit for getpublicip.sh script
|
||||
# /etc/systemd/system/getpublicip.service
|
||||
|
||||
[Unit]
|
||||
Description=getpublicip.sh: get public ip address from ipinfo.io
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/getpublicip.sh
|
||||
ExecStartPost=/bin/sleep 5
|
||||
Restart=always
|
||||
|
||||
RestartSec=600
|
||||
TimeoutSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo 'getpublicip.sh started, writing public IP address every 10 minutes into /run/publicip'
|
||||
while [ 0 ];
|
||||
do
|
||||
# check if TOR is running
|
||||
torExists=$(sudo ls /mnt/hdd/tor/lnd9735/hostname 2>/dev/null | grep hostname -c)
|
||||
if [ ${torExists} -eq 0 ]; then
|
||||
# get and set public IP
|
||||
printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip;
|
||||
else
|
||||
# set onion address
|
||||
printf "PUBLICIP=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)\n" > /run/publicip;
|
||||
fi
|
||||
sleep 600
|
||||
done;
|
|
@ -3,7 +3,7 @@
|
|||
# mainnet/testnet - to switch just comment/uncomment
|
||||
#testnet=1
|
||||
|
||||
# Bitcoind options
|
||||
# litcoind options
|
||||
server=1
|
||||
daemon=1
|
||||
txindex=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[Unit]
|
||||
Description=Bitcoin daemon
|
||||
Wants=getpublicip.service
|
||||
After=getpublicip.service
|
||||
Wants=bootstrap.service
|
||||
After=bootstrap.service
|
||||
|
||||
# for use with sendmail alert (coming soon)
|
||||
#OnFailure=systemd-sendmail@%n
|
||||
|
|
|
@ -5,6 +5,7 @@ debuglevel=debug
|
|||
maxpendingchannels=5
|
||||
alias=raspiblitz
|
||||
color=#68F442
|
||||
nat=false
|
||||
|
||||
# RPC open to all connections on Port 10009
|
||||
rpclisten=0.0.0.0:10009
|
||||
|
@ -22,10 +23,10 @@ bitcoin.mainnet=1
|
|||
bitcoind.rpcuser=raspibolt
|
||||
bitcoind.rpcpass=passwordB
|
||||
bitcoind.rpchost=127.0.0.1
|
||||
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
|
||||
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
|
||||
bitcoind.zmqpubrawblock=tcp://*:28332
|
||||
bitcoind.zmqpubrawtx=tcp://*:28333
|
||||
|
||||
[autopilot]
|
||||
autopilot.active=1
|
||||
autopilot.active=0
|
||||
autopilot.maxchannels=5
|
||||
autopilot.allocation=0.6
|
||||
|
|
|
@ -5,6 +5,7 @@ debuglevel=debug
|
|||
maxpendingchannels=5
|
||||
alias=raspiblitz
|
||||
color=#68F442
|
||||
nat=false
|
||||
|
||||
# RPC open to all connections on Port 10009
|
||||
rpclisten=0.0.0.0:10009
|
||||
|
@ -20,10 +21,10 @@ litecoin.node=litecoind
|
|||
litecoind.rpchost=127.0.0.1
|
||||
litecoind.rpcuser=raspibolt
|
||||
litecoind.rpcpass=passwordB
|
||||
litecoind.zmqpubrawblock=tcp://127.0.0.1:28332
|
||||
litecoind.zmqpubrawtx=tcp://127.0.0.1:28333
|
||||
litecoind.zmqpubrawblock=tcp://*:28332
|
||||
litecoind.zmqpubrawtx=tcp://*:28333
|
||||
|
||||
[autopilot]
|
||||
autopilot.active=1
|
||||
autopilot.active=0
|
||||
autopilot.maxchannels=5
|
||||
autopilot.allocation=0.6
|
||||
|
|
|
@ -9,9 +9,7 @@ After=bitcoind.service
|
|||
#OnFailure=systemd-sendmail@%n
|
||||
|
||||
[Service]
|
||||
# get var PUBIP from file
|
||||
EnvironmentFile=/run/publicip
|
||||
|
||||
ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP}
|
||||
PIDFile=/home/bitcoin/.lnd/lnd.pid
|
||||
User=bitcoin
|
||||
|
|
|
@ -10,13 +10,13 @@ After=bitcoind.service
|
|||
|
||||
[Service]
|
||||
# get var PUBIP from file
|
||||
EnvironmentFile=/run/publicip
|
||||
EnvironmentFile=/mnt/hdd/tor/v3Address
|
||||
|
||||
# TOR Hidden Service v2
|
||||
ExecStart=/usr/local/bin/lnd --tor.active --tor.v2 --listen=127.0.0.1:9735
|
||||
|
||||
# TOR Hidden Service v3
|
||||
# ExecStart=/usr/local/bin/lnd --tor.active --tor.v3 --externalip=${PUBLICIP} --listen=127.0.0.1:9735
|
||||
# ExecStart=/usr/local/bin/lnd --tor.active --tor.v3 --externalip=${V3ADDRESS} --listen=127.0.0.1:9735
|
||||
|
||||
PIDFile=/home/bitcoin/.lnd/lnd.pid
|
||||
User=bitcoin
|
||||
|
|
File diff suppressed because one or more lines are too long
8628
home.admin/assets/raspiblitz-bitcoin1-2018-10-13-base.torrent
Normal file
8628
home.admin/assets/raspiblitz-bitcoin1-2018-10-13-base.torrent
Normal file
File diff suppressed because one or more lines are too long
999
home.admin/assets/raspiblitz-bitcoin1-2018-10-13-update.torrent
Normal file
999
home.admin/assets/raspiblitz-bitcoin1-2018-10-13-update.torrent
Normal file
File diff suppressed because one or more lines are too long
BIN
pictures/lightningshell.png
Normal file
BIN
pictures/lightningshell.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 244 KiB |
8
shoppinglist_au.md
Normal file
8
shoppinglist_au.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
The RaspiBlitz software is build and tested for the following Hardware set that you can buy cheap on Amazon.com.au:
|
||||
|
||||
* RaspBerry Pi 3 ($38.75): https://www.amazon.com/RS-Components-Raspberry-Pi-Motherboard/dp/B07BFH96M3
|
||||
* Micro SD-Card 16GB ($6.23): https://www.amazon.com/SanDisk-Mobile-MicroSDHC-SDSDQM-B35A-Adapter/dp/B004ZIENBA
|
||||
* Power ($21.04): https://www.amazon.com.au/Ils-Supply-Adapter-Charger-Raspberry/dp/B07F2JLSCL/
|
||||
* 1TB Hard Drive($49.99): https://www.amazon.com/Toshiba-Advance-Portable-External-HDTC910XR3AA/dp/B079H7VYY6
|
||||
* Case ($7.50): https://www.amazon.com/Raspberry-Model-Protective-Heatsinks-Clear/dp/B01CDVSBPO
|
||||
* LCD-Display ($19.99): https://www.amazon.com/ELEGOO-Raspberry-Display-480x320-Interface/dp/B01N3JROH8
|
13
shoppinglist_cz.md
Normal file
13
shoppinglist_cz.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
## Hardware Needed (Alza.cz, Amazon.com and czc.cz Shopping List)
|
||||
|
||||
_The RaspiBlitz software is build and tested for the following Hardware set that you can buy cheap on Alza.cz, Amazon.com and czc.cz:_
|
||||
|
||||
- RaspBerry Pi 3 (1.129 Kč) https://www.alza.cz/raspberry-pi-3-model-b-d5284636.htm?o=1
|
||||
- Micro SD-Card 16GB (379 Kč) https://www.alza.cz/EN/kingston-micro-sdhc-16gb-class-10-uhs-i-industrial-temp-sd-adapter?dq=4156874&o=2
|
||||
- Power (399 Kč)https://www.alza.cz/EN/alzapower-q100-quick-charge-3-0-black-d5324257.htm?o=2
|
||||
- maybe you need an micro usb cable
|
||||
- 1TB Hard Drive (1.349 Kč) https://www.czc.cz/toshiba-canvio-basics-1tb-cerna/235949/produkt?gclid=EAIaIQobChMIgpLF5Mac3gIVCM53Ch3D9QWpEAQYAyABEgK-ZfD_BwE
|
||||
- Case (159 Kč) https://www.alza.cz/EN/raspberry-pi-black-d3837597.htm?o=1
|
||||
- LCD-Display (450.46 Kč) (delivered to Czech Republic) https://www.amazon.com/dp/B01N3JROH8/ref=cm_sw_r_cp_ep_dp_-gOuBb2Q6T0C5
|
||||
|
||||
**Total Price: 3.865,46 Kč**
|
Loading…
Add table
Reference in a new issue