mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-27 02:01:53 +01:00
Merge branch 'v1.5' into lnbits
This commit is contained in:
commit
ec191d7362
41
FAQ.md
41
FAQ.md
@ -1,5 +1,27 @@
|
||||
# FAQ - Frequently Asked Questions
|
||||
|
||||
## Whats new in Version 1.5 of RaspiBlitz?
|
||||
|
||||
Beside many small improvements and changes, these are most important changes:
|
||||
|
||||
- Update: LND version 0.9.2-beta
|
||||
- Update: bitcoin-core version 19.1-beta
|
||||
- Update: Loop 0.5.1
|
||||
- Update: RTL 0.7.0 (Loop In and Out integration)
|
||||
- Update: BTCPayServer v1.0.4.1
|
||||
- Shoppinglist: Replace Shimfan with passive RP4-Heatcase
|
||||
- Fix: (Control-D) Give root password for maintenance [details](https://github.com/rootzoll/raspiblitz/issues/1053)
|
||||
- Fix: Screen Rotate on update from v1.3
|
||||
- New: Specter Desktop (connect DIY Specter-Wallet or ColdCard) [details](https://github.com/cryptoadvance/specter-desktop/blob/master/README.md)
|
||||
- New: JoinMarket [details](https://github.com/JoinMarket-Org/joinmarket-clientserver)
|
||||
- New: Activate 'Keysend' on LND by Service Menu [details](https://github.com/rootzoll/raspiblitz/issues/1000)
|
||||
- New: SendMany App (wallet & chat over keysend)
|
||||
- New: Reset SSH cert if SSH login not working [details](FAQ.md#how-can-i-repair-my-ssh-login)
|
||||
- New: Make it easier to Copy The Blockchain over Network from running Blitz
|
||||
- New: Forwarding Fee Report on Main Menu
|
||||
- New: Easy Setup of Auto-Backup of SCB to Dropbox
|
||||
- Removed: Clone Blockchain from second HDD (use CopyStation script)
|
||||
|
||||
## Whats new in Version 1.4 of RaspiBlitz?
|
||||
|
||||
Beside many small improvements and changes, these are most important changes:
|
||||
@ -395,6 +417,8 @@ Some routers support a feature called UPnP where devices can automatically reque
|
||||
|
||||
On details how to set port forwarding manually on your router model see: https://portforward.com
|
||||
|
||||
Also the selftesting of the RaspiBlitz if the port is forwarded or not might not work if your router is not supporting [Hairpinning](https://en.wikipedia.org/wiki/Hairpinning).
|
||||
|
||||
## 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 - that's why it's just yellow, not green.
|
||||
@ -905,4 +929,19 @@ When the LCD display is telling you to do config check:
|
||||
|
||||
## How to fix my upside down LCD after update?
|
||||
|
||||
Some displays have a different orientation. To fix this activate/deactivate the LCD-ROTATION option in the MAINMENU > SERVICES and let it reboot. YOu might need to do this up to 3 times until your display got it right.
|
||||
Some displays have a different orientation. To fix this activate/deactivate the LCD-ROTATION option in the MAINMENU > SERVICES and let it reboot. YOu might need to do this up to 3 times until your display got it right.
|
||||
|
||||
## How can I repair my SSH login?
|
||||
|
||||
If you cannot login per SSH into your RaspiBlitz your SSH RaspiBlitz certs might be corrupted. To renew and reset those do the following (since version 1.5):
|
||||
|
||||
- shutdown the RaspiBlitz - if you dont have touchscreen activated, disconnect LAN cable, wait until HDD/SSD activity slows down (no constant blinking) and then cut the power
|
||||
- take out the sd card and connect it to your laptop - it should appear as a `boot` drive
|
||||
- in the root directory of that `boot` drive create a file called `ssh.reset`
|
||||
- that file can be empty or just copy another file on that drive and rename it ()
|
||||
- eject the drive from your laptop safely
|
||||
- put sd card back into the RaspiBlitz (also make sure LAN cable is connected again)
|
||||
- power up - the RaspiBlitz should boot up & reboot again
|
||||
- then try again to SSH login
|
||||
|
||||
If you see a "REMOTE HOST IDENTIFICATION HAS CHANGED!" warning on login thats what we wanted - the SSH cert of your RaspiBlitz changed - thats good. We just need to remove the old one from our laptop first - on OSX you can use `rm ~/.ssh/known_hosts` (deletes all cached server certs) or remove the line with your RaspiBlitz IP manually from the `~/.ssh/known_hosts` file with a text editor.
|
34
README.md
34
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
*Build your own Lightning Node on a RaspberryPi with a nice Display.*
|
||||
|
||||
`Version 1.4 with lnd 0.9.0-beta and bitcoin 0.19.0.1 or litecoin 0.17.1.`
|
||||
`Version 1.5 with lnd 0.9.2-beta and bitcoin 0.19.1 or litecoin 0.17.1.`
|
||||
|
||||

|
||||
|
||||
@ -27,6 +27,7 @@ There are further Services that can be switched on:
|
||||
* **BTCPayServer** (Cryptocurrency Payment Processor) [details](https://btcpayserver.org)
|
||||
* **BTC-RPC-Explorer** (Bitcoin Blockchain Explorer) [details](https://github.com/janoside/btc-rpc-explorer)
|
||||
* **LNbits** (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits)
|
||||
* **SpecterDesktop** (Multisig Trezor, Ledger, COLDCARDwallet & Specter-DIY) [details](https://twitter.com/CryptoAdvance/status/1233833767283941376?s=20)
|
||||
* **LNDmanage** (Advanced Channel Management CLI) [details](https://github.com/bitromortac/lndmanage)
|
||||
* **Loop** (Submarine Swaps Service) [details](https://github.com/lightninglabs/loop)
|
||||
|
||||
@ -88,19 +89,19 @@ Basic Parts for all minimal variants:
|
||||
|
||||
If you have already a used RaspberryPi 3 B+ you can reuse with the following parts:
|
||||
* RaspBerry Pi 3: [amazon](https://geni.us/raspiblitz-rpi3)
|
||||
* Heatsink-Case RP3: [amazon](https://geni.us/raspiblitz-heatsink)
|
||||
* Power >=3A: [amazon](https://geni.us/raspiblitz-3A-power)
|
||||
* Heatsink-Case: [amazon](https://geni.us/raspiblitz-heatsink)
|
||||
|
||||
Or if you order new go with the RaspberryPi 4 2GB and the following parts:
|
||||
* RaspBerry Pi 4 2GB [amazon](https://geni.us/raspiblitz-4-2gb)
|
||||
* RaspBerry Power Supply [amazon](https://geni.us/raspiblitz-ps)
|
||||
* RaspberryPi Heatsink Case: [amazon](https://geni.us/heatsink-raspi4)
|
||||
* RaspberryPi Heatsink Case: [amazon](https://geni.us/heatsink-raspi4)
|
||||
|
||||
#### Package: Maximal
|
||||
|
||||
*The maximal package is still in the works ... if you want to prepare for it, take the standard package as a base and choose the RaspberryPi4 with 4GB and a high quality 1TB SSD instead of 500GB.*
|
||||
|
||||
* 1000GB SSD: [amazon](https://geni.us/raspiblitz-1000gb-san)
|
||||
* 1TB SSD: [amazon](https://geni.us/raspiblitz-1000gb-san)
|
||||
* RaspBerry Pi 4 4GB: [amazon](https://geni.us/raspiblitz-4-4gb)
|
||||
* RaspBerry Power Supply [amazon](https://geni.us/raspiblitz-ps)
|
||||
* SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case)
|
||||
@ -114,29 +115,30 @@ Or if you order new go with the RaspberryPi 4 2GB and the following parts:
|
||||
|
||||
## Assemble your RaspiBlitz
|
||||
|
||||
If you are going with the Standard/Maximal-RaspberryPi4 Setup you need to:
|
||||
When you have all parts you need to:
|
||||
|
||||
- Assemble the Shim-Fan and connect it to the GPIO pins: [detail instructions](https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-fan-shim)
|
||||
- Fit the RaspberryPi to the PiBow case: [detail instructions](https://www.youtube.com/watch?v=utk3cjzCLog)
|
||||
- Put the SSD into the HDD USB & may get some rubber bands
|
||||
- Assemble the Heatsink-Case on the RaspberryPi (follow the intructions in package).
|
||||
- Put the SSD/Hdd into the Case and connect it per USB to the RaspberryPi
|
||||
- Add the display on top with the pins like in picture below.
|
||||
- PlugIn the network cable.
|
||||
|
||||
Add the display on top with the pins like in picture below. PlugIn the network cable. In the end your RaspiBlitz should look like this:
|
||||
In the end your RaspiBlitz should look like this:
|
||||
|
||||

|
||||
|
||||
*If you are going with the Minimal-RaspberryPi3 Setup just apply the Geekworm Heatsink-Case and connect everything- [detail instructions](https://www.youtube.com/watch?v=2QDlbAorJKw).*
|
||||
|
||||
## 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.4:**
|
||||
**Download SD-Card image - Version 1.5:**
|
||||
|
||||
Browser: [https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz](https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz)
|
||||
*IMPORTANT: This is just a Release Candidate - not the final release. Please just use if you feel reckless and like to help on testing. If you have serious funds on your node please wait for the final release before updating.*
|
||||
|
||||
Torrent: https://github.com/rootzoll/raspiblitz/raw/v1.4/home.admin/assets/raspiblitz-v1.4-2020-02-20.img.gz.torrent
|
||||
Browser: https://raspiblitz.com/raspiblitz-v1.5RC1-2020-03-31.img.gz
|
||||
|
||||
SHA-256: 55b1989a45e99ecc56b74febddfa98f52271799105cc80900b09cc67e73df078 or [SIGNATURE](https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz.sig)
|
||||
Torrent: TODO just for final release
|
||||
|
||||
SHA-256: 0463dbad63b25ec3f2565fe555fd97e64cbe1c981a16dab07f1c9074c4dae5c2 or [SIGNATURE](TODO just for final release)
|
||||
|
||||
**Write the SD-Card image to your SD Card**
|
||||
|
||||
@ -165,7 +167,7 @@ When everything boots up correctly, you should see the local IP address of your
|
||||
|
||||

|
||||
|
||||
Now open up a terminal ([OSX](https://www.youtube.com/watch?v=5XgBd6rjuDQ)/[Win10](https://www.youtube.com/watch?v=xIfzZXHaCzQ)) and connect through SSH with the command displayed by the RaspiBlitz:
|
||||
Now open up a terminal ([OSX](https://www.youtube.com/watch?v=5XgBd6rjuDQ)/[Win10](https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/)) and connect through SSH with the command displayed by the RaspiBlitz:
|
||||
|
||||
`ssh admin@[YOURIP]` → use password: `raspiblitz`
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
#!/bin/bash
|
||||
#########################################################################
|
||||
# Build your SD card image based on:
|
||||
# Raspbian Buster Desktop (2019-09-26)
|
||||
# Raspbian Buster Desktop (2020-02-13)
|
||||
# https://www.raspberrypi.org/downloads/raspbian/
|
||||
# SHA256: 2c4067d59acf891b7aa1683cb1918da78d76d2552c02749148d175fa7f766842
|
||||
# SHA256: a82ed4139dfad31c3167e60e943bcbe28c404d1858f4713efe5530c08a419f50
|
||||
##########################################################################
|
||||
# setup fresh SD card with image above - login per SSH and run this script:
|
||||
##########################################################################
|
||||
|
||||
echo ""
|
||||
echo "*****************************************"
|
||||
echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.4 *"
|
||||
echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.5 *"
|
||||
echo "*****************************************"
|
||||
echo ""
|
||||
|
||||
@ -100,6 +100,8 @@ if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ] ; then
|
||||
# https://github.com/rootzoll/raspiblitz/issues/684
|
||||
sudo sed -i "s/^ SendEnv LANG LC.*/# SendEnv LANG LC_*/g" /etc/ssh/ssh_config
|
||||
|
||||
# remove unneccesary files
|
||||
sudo rm -rf /home/pi/MagPi
|
||||
fi
|
||||
|
||||
# remove some (big) packages that are not needed
|
||||
@ -139,6 +141,8 @@ if [ "${baseImage}" = "raspbian" ]; then
|
||||
# see: https://github.com/rootzoll/raspiblitz/issues/782#issuecomment-564981630
|
||||
# use command to check last fsck check: sudo tune2fs -l /dev/mmcblk0p2
|
||||
sudo tune2fs -c 1 /dev/mmcblk0p2
|
||||
# see https://github.com/rootzoll/raspiblitz/issues/1053#issuecomment-600878695
|
||||
sudo sed -i 's/^/fsck.mode=force fsck.repair=yes /g' /boot/cmdline.txt
|
||||
fi
|
||||
|
||||
# special prepare when Ubuntu or Armbian
|
||||
@ -258,7 +262,7 @@ 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 install -y htop git curl bash-completion vim jq dphys-swapfile
|
||||
sudo apt-get install -y htop git curl bash-completion vim jq dphys-swapfile bsdmainutils
|
||||
|
||||
# installs bandwidth monitoring for future statistics
|
||||
sudo apt-get install -y vnstat
|
||||
@ -349,7 +353,7 @@ echo "*** PREPARING BITCOIN & Co ***"
|
||||
|
||||
# set version (change if update is available)
|
||||
# https://bitcoincore.org/en/download/
|
||||
bitcoinVersion="0.19.0.1"
|
||||
bitcoinVersion="0.19.1"
|
||||
|
||||
# needed to check code signing
|
||||
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
|
||||
@ -450,7 +454,7 @@ fi
|
||||
# "*** LND ***"
|
||||
## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd
|
||||
## see LND releases: https://github.com/lightningnetwork/lnd/releases
|
||||
lndVersion="0.9.0-beta"
|
||||
lndVersion="0.9.2-beta"
|
||||
|
||||
# olaoluwa
|
||||
PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc"
|
||||
@ -633,18 +637,6 @@ if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "armbian" ] || [ "${bas
|
||||
sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/pi/.bashrc'
|
||||
sudo bash -c 'echo "exec \$SCRIPT" >> /home/pi/.bashrc'
|
||||
fi
|
||||
if [ "${baseImage}" = "raspbian" ]; then
|
||||
# create /home/admin/setup.sh - which will get executed after reboot by autologin pi user
|
||||
cat > /tmp/setup.sh <<EOF
|
||||
|
||||
# make LCD screen rotation correct
|
||||
sudo sed --in-place -i "57s/.*/dtoverlay=tft35a:rotate=270/" /boot/config.txt
|
||||
|
||||
EOF
|
||||
sudo cp /tmp/setup.sh /home/admin/setup.sh
|
||||
sudo chown admin.admin /home/admin/setup.sh
|
||||
sudo chmod +x /home/admin/setup.sh
|
||||
fi
|
||||
|
||||
if [ "${baseImage}" = "dietpi" ]; then
|
||||
# bash autostart for dietpi
|
||||
@ -707,8 +699,9 @@ sudo -u admin git clone https://github.com/goodtft/LCD-show.git
|
||||
sudo -u admin chmod -R 755 LCD-show
|
||||
sudo -u admin chown -R admin:admin LCD-show
|
||||
cd LCD-show/
|
||||
# set comit hard to a8de38f (7 Nov 2019) for security
|
||||
sudo -u admin git reset --hard a8de38f41586e153a8e03adcf7708c8b5974ffc8
|
||||
# set comit hard to old version - that seemed to run better
|
||||
#
|
||||
sudo -u admin git reset --hard ce52014
|
||||
|
||||
# install xinput calibrator package
|
||||
echo "--> install xinput calibrator package"
|
||||
@ -751,7 +744,8 @@ echo ""
|
||||
# activate LCD and trigger reboot
|
||||
# dont do this on dietpi to allow for automatic build
|
||||
if [ "${baseImage}" != "dietpi" ]; then
|
||||
sudo chmod +x -R /home/admin/LCD-show
|
||||
cd /home/admin/LCD-show/
|
||||
sudo apt-mark hold raspberrypi-bootloader
|
||||
sudo ./LCD35-show
|
||||
fi
|
||||
fi
|
||||
|
@ -176,7 +176,7 @@ while :
|
||||
l3="Use password: raspiblitz\n"
|
||||
|
||||
if [ "${state}" = "recovering" ]; then
|
||||
l1="Recovering please wait - for debug:\n"
|
||||
l1="Recovering please wait ..\n"
|
||||
fi
|
||||
|
||||
boxwidth=$((${#localip} + 24))
|
||||
|
@ -57,6 +57,12 @@ fi
|
||||
if [ "${loop}" == "on" ]; then
|
||||
OPTIONS+=(LOOP "Loop In/Out Service")
|
||||
fi
|
||||
if [ "${specter}" == "on" ]; then
|
||||
OPTIONS+=(SPECTER "Cryptoadvance Specter")
|
||||
fi
|
||||
if [ "${joinmarket}" == "on" ]; then
|
||||
OPTIONS+=(JMARKET "JoinMarket")
|
||||
fi
|
||||
|
||||
# Basic Options
|
||||
OPTIONS+=(INFO "RaspiBlitz Status Screen")
|
||||
@ -76,6 +82,7 @@ OPTIONS+=(CASHOUT "Remove Funds from LND")
|
||||
if [ "${chain}" = "main" ]; then
|
||||
OPTIONS+=(lnbalance "Detailed Wallet Balances")
|
||||
OPTIONS+=(lnchannels "Lightning Channel List")
|
||||
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
|
||||
fi
|
||||
|
||||
OPTIONS+=(SERVICES "Activate/Deactivate Services")
|
||||
@ -147,6 +154,12 @@ case $CHOICE in
|
||||
LOOP)
|
||||
/home/admin/config.scripts/bonus.loop.sh menu
|
||||
;;
|
||||
SPECTER)
|
||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
|
||||
;;
|
||||
JMARKET)
|
||||
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
|
||||
;;
|
||||
lnbalance)
|
||||
clear
|
||||
echo "*** YOUR SATOSHI BALANCES ***"
|
||||
@ -161,6 +174,12 @@ case $CHOICE in
|
||||
echo "Press ENTER to return to main menu."
|
||||
read key
|
||||
;;
|
||||
lnfwdreport)
|
||||
./XXlnfwdreport.sh
|
||||
echo "Press ENTER to return to main menu."
|
||||
read key
|
||||
./00mainMenu.sh
|
||||
;;
|
||||
CONNECT)
|
||||
/home/admin/BBconnectPeer.sh
|
||||
;;
|
||||
@ -206,6 +225,9 @@ case $CHOICE in
|
||||
;;
|
||||
REPAIR)
|
||||
/home/admin/98repairMenu.sh
|
||||
if [ $? -eq 99 ]; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
PASSWORD)
|
||||
sudo /home/admin/config.scripts/blitz.setpassword.sh
|
||||
@ -224,21 +246,9 @@ case $CHOICE in
|
||||
/home/admin/99checkUpdate.sh
|
||||
;;
|
||||
OFF)
|
||||
clear
|
||||
echo ""
|
||||
echo "LCD turns white when shutdown complete."
|
||||
echo "Then wait 5 seconds and disconnect power."
|
||||
echo "-----------------------------------------------"
|
||||
echo "stop lnd - please wait .."
|
||||
sudo systemctl stop lnd
|
||||
echo "stop ${network}d (1) - please wait .."
|
||||
sudo -u bitcoin ${network}-cli stop
|
||||
sleep 10
|
||||
echo "stop ${network}d (2) - please wait .."
|
||||
sudo systemctl stop ${network}d
|
||||
sleep 3
|
||||
sync
|
||||
echo "starting shutdown ..."
|
||||
sudo shutdown now
|
||||
sudo /home/admin/XXshutdown.sh
|
||||
exit 0
|
||||
;;
|
||||
DELETE)
|
||||
|
@ -247,8 +247,7 @@ if [ ${setupStep} -eq 0 ]; then
|
||||
BACKTITLE="RaspiBlitz - Manual Update"
|
||||
TITLE="⚡ Found old RaspiBlitz Data on HDD ⚡"
|
||||
MENU="\n ATTENTION: OLD DATA COULD CONTAIN FUNDS\n"
|
||||
OPTIONS+=(MANUAL "read how to recover your old funds" \
|
||||
DELETE "erase old data, keep blockchain, reboot" )
|
||||
OPTIONS+=(MANUAL "read how to recover your old funds")
|
||||
HEIGHT=11
|
||||
|
||||
else
|
||||
@ -339,11 +338,9 @@ LND accepted the channel.backup file you uploaded.
|
||||
It will now take around a hour until you can see,
|
||||
if LND was able to recover funds from your channels.
|
||||
|
||||
IMPORTANT: If you then still missing satoshis from
|
||||
your on-chain balance try to recover your wallet
|
||||
with your seed words with the ZAP desktop app and
|
||||
then send funds back to your RaspiBlitz.
|
||||
" 14 56
|
||||
IMPORTANT: Please dont reboot the RaspiBlitz until
|
||||
the LND was able to rescan the Blockchain again.
|
||||
" 12 56
|
||||
fi
|
||||
|
||||
fi
|
||||
@ -386,28 +383,6 @@ case $CHOICE in
|
||||
/home/admin/10setupBlitz.sh
|
||||
exit 1;
|
||||
;;
|
||||
CONTINUE)
|
||||
/home/admin/10setupBlitz.sh
|
||||
exit 1;
|
||||
;;
|
||||
OFF)
|
||||
echo ""
|
||||
echo "LCD turns white when shutdown complete."
|
||||
echo "Then wait 5 seconds and disconnect power."
|
||||
echo "-----------------------------------------------"
|
||||
echo "stop lnd - please wait .."
|
||||
sudo systemctl stop lnd
|
||||
echo "stop ${network}d (1) - please wait .."
|
||||
sudo -u bitcoin ${network}-cli stop
|
||||
sleep 10
|
||||
echo "stop ${network}d (2) - please wait .."
|
||||
sudo systemctl stop ${network}d
|
||||
sleep 3
|
||||
sync
|
||||
echo "starting shutdown ..."
|
||||
sudo shutdown now
|
||||
exit 0
|
||||
;;
|
||||
MANUAL)
|
||||
echo "************************************************************************************"
|
||||
echo "PLEASE go to RaspiBlitz FAQ:"
|
||||
@ -415,27 +390,13 @@ case $CHOICE in
|
||||
echo "And check: How can I recover my coins from a failing RaspiBlitz?"
|
||||
echo "************************************************************************************"
|
||||
exit 0
|
||||
;;
|
||||
DELETE)
|
||||
sudo /home/admin/XXcleanHDD.sh
|
||||
sudo /home/admin/XXshutdown.sh reboot
|
||||
exit 0
|
||||
;;
|
||||
;;
|
||||
MIGRATION)
|
||||
sudo /home/admin/config.scripts/blitz.migration.sh "import-gui"
|
||||
exit 0
|
||||
;;
|
||||
X)
|
||||
lncli -h
|
||||
echo "OK you now on the command line."
|
||||
echo "You can return to the main menu with the command:"
|
||||
echo "raspiblitz"
|
||||
;;
|
||||
R)
|
||||
/home/admin/00raspiblitz.sh
|
||||
;;
|
||||
U) # unlock
|
||||
/home/admin/AAunlockLND.sh
|
||||
/home/admin/00raspiblitz.sh
|
||||
CONTINUE)
|
||||
/home/admin/10setupBlitz.sh
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
@ -12,6 +12,7 @@ if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
|
||||
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
|
||||
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
|
||||
if [ ${#BTCRPCexplorer} -eq 0 ]; then BTCRPCexplorer="off"; fi
|
||||
if [ ${#specter} -eq 0 ]; then specter="off"; fi
|
||||
if [ ${#chain} -eq 0 ]; then chain="main"; fi
|
||||
if [ ${#autoNatDiscovery} -eq 0 ]; then autoNatDiscovery="off"; fi
|
||||
if [ ${#networkUPnP} -eq 0 ]; then networkUPnP="off"; fi
|
||||
@ -20,7 +21,11 @@ if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi
|
||||
if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
|
||||
if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi
|
||||
if [ ${#lndmanage} -eq 0 ]; then lndmanage="off"; fi
|
||||
if [ ${#LNbits} -eq 0 ]; then LNbits="off"; fi
|
||||
if [ ${#joinmarket} -eq 0 ]; then joinmarket="off"; fi
|
||||
|
||||
echo "map dropboxbackup to on/off"
|
||||
DropboxBackup="off";
|
||||
if [ ${#dropboxBackupTarget} -gt 0 ]; then DropboxBackup="on"; fi
|
||||
|
||||
echo "map chain to on/off"
|
||||
chainValue="off"
|
||||
@ -54,18 +59,27 @@ else
|
||||
autoPilot="off"
|
||||
fi
|
||||
|
||||
echo "map keysend to on/off"
|
||||
keysend="on"
|
||||
source <(sudo /home/admin/config.scripts/lnd.keysend.sh status)
|
||||
if [ ${keysendOn} -eq 0 ]; then
|
||||
keysend="off"
|
||||
fi
|
||||
|
||||
# show select dialog
|
||||
echo "run dialog ..."
|
||||
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \
|
||||
1 'Channel Autopilot' ${autoPilot} \
|
||||
k 'Accept Keysend' ${keysend} \
|
||||
l 'Lightning Loop' ${loop} \
|
||||
2 'Testnet' ${chainValue} \
|
||||
3 ${dynDomainMenu} ${domainValue} \
|
||||
4 'Run behind TOR' ${runBehindTor} \
|
||||
5 'RTL Webinterface' ${rtlWebinterface} \
|
||||
b 'BTC-RPC-Explorer' ${BTCRPCexplorer} \
|
||||
s 'Cryptoadvance Specter' ${specter} \
|
||||
6 'LND Auto-Unlock' ${autoUnlock} \
|
||||
9 'Touchscreen' ${touchscreenMenu} \
|
||||
r 'LCD Rotate' ${lcdrotateMenu} \
|
||||
@ -73,16 +87,20 @@ e 'Electrum Rust Server' ${ElectRS} \
|
||||
p 'BTCPayServer' ${BTCPayServer} \
|
||||
m 'lndmanage' ${lndmanage} \
|
||||
i 'LNbits' ${LNbits} \
|
||||
d 'StaticChannelBackup on DropBox' ${DropboxBackup} \
|
||||
j 'JoinMarket' ${joinmarket} \
|
||||
2>&1 >/dev/tty)
|
||||
else
|
||||
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \
|
||||
1 'Channel Autopilot' ${autoPilot} \
|
||||
k 'Accept Keysend' ${keysend} \
|
||||
l 'Lightning Loop' ${loop} \
|
||||
2 'Testnet' ${chainValue} \
|
||||
3 ${dynDomainMenu} ${domainValue} \
|
||||
4 'Run behind TOR' ${runBehindTor} \
|
||||
5 'RTL Webinterface' ${rtlWebinterface} \
|
||||
b 'BTC-RPC-Explorer' ${BTCRPCexplorer} \
|
||||
s 'Cryptoadvance Specter' ${specter} \
|
||||
6 'LND Auto-Unlock' ${autoUnlock} \
|
||||
7 'BTC UPnP (AutoNAT)' ${networkUPnP} \
|
||||
8 'LND UPnP (AutoNAT)' ${autoNatDiscovery} \
|
||||
@ -92,6 +110,8 @@ e 'Electrum Rust Server' ${ElectRS} \
|
||||
p 'BTCPayServer' ${BTCPayServer} \
|
||||
m 'lndmanage' ${lndmanage} \
|
||||
i 'LNbits' ${LNbits} \
|
||||
d 'StaticChannelBackup on DropBox' ${DropboxBackup} \
|
||||
j 'JoinMarket' ${joinmarket} \
|
||||
2>&1 >/dev/tty)
|
||||
fi
|
||||
|
||||
@ -215,13 +235,13 @@ if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${loop}" != "${choice}" ]; then
|
||||
echo "Loop Setting changed .."
|
||||
anychange=1
|
||||
needsReboot=1 # always reboot so that RTL gets restarted to show/hide support loop
|
||||
/home/admin/config.scripts/bonus.loop.sh ${choice}
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
sudo systemctl start loopd
|
||||
/home/admin/config.scripts/bonus.loop.sh menu
|
||||
needsReboot=1
|
||||
else
|
||||
l1="FAILED to install Lightning LOOP"
|
||||
l2="Try manual install in the terminal with:"
|
||||
@ -370,6 +390,32 @@ else
|
||||
echo "BTC-RPC-Explorer Setting unchanged."
|
||||
fi
|
||||
|
||||
# cryptoadvance Specter process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${specter}" != "${choice}" ]; then
|
||||
echo "Cryptoadvance Specter Setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh ${choice}
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
#sudo sytemctl start cryptoadvance-specter
|
||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
|
||||
#whiptail --title " Installed Cryptoadvance Specter " --msgbox "\
|
||||
#You should be able to reach specter on port 25441. The Login is Password B.\n
|
||||
#" 14 50
|
||||
else
|
||||
l1="!!! FAIL on Cryptoadvance Specter install !!!"
|
||||
l2="Try manual install on terminal after reboot with:"
|
||||
l3="/home/admin/config.scripts/bonus.cryptoadvance-specter.sh on"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Cryptoadvance Specter Setting unchanged."
|
||||
fi
|
||||
|
||||
# LND Auto-Unlock
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "6")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
@ -459,21 +505,31 @@ choice="off"; check=$(echo "${CHOICES}" | grep -c "p")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${BTCPayServer}" != "${choice}" ]; then
|
||||
echo "BTCPayServer setting changed .."
|
||||
anychange=1
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh ${choice} tor
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
source /home/btcpay/.btcpayserver/Main/settings.config
|
||||
whiptail --title " Installed BTCPay Server " --msgbox "\
|
||||
# check if TOR is installed
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ "${choice}" = "on" ] && [ "${runBehindTor}" = "off" ]; then
|
||||
whiptail --title " BTCPayServer needs TOR " --msgbox "\
|
||||
At the moment the BTCPayServer on the RaspiBlitz needs TOR.\n
|
||||
Please activate TOR in SERVICES first.\n
|
||||
Then try activating BTCPayServer again in SERVICES.\n
|
||||
" 13 42
|
||||
else
|
||||
anychange=1
|
||||
/home/admin/config.scripts/bonus.btcpayserver.sh ${choice} tor
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
source /home/btcpay/.btcpayserver/Main/settings.config
|
||||
whiptail --title " Installed BTCPay Server " --msgbox "\
|
||||
BTCPay server was installed.\n
|
||||
Use the new 'BTCPay' entry in Main Menu for more info.\n
|
||||
" 10 35
|
||||
else
|
||||
l1="BTCPayServer installation is cancelled"
|
||||
l2="Try again from the menu or install from the terminal with:"
|
||||
l3="/home/admin/config.scripts/bonus.btcpayserver.sh on"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
else
|
||||
l1="BTCPayServer installation is cancelled"
|
||||
l2="Try again from the menu or install from the terminal with:"
|
||||
l3="/home/admin/config.scripts/bonus.btcpayserver.sh on"
|
||||
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@ -510,6 +566,64 @@ else
|
||||
echo "lndmanage setting unchanged."
|
||||
fi
|
||||
|
||||
# DropBox process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "d")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${DropboxBackup}" != "${choice}" ]; then
|
||||
echo "DropBox Setting changed .."
|
||||
anychange=1
|
||||
sudo -u admin /home/admin/config.scripts/dropbox.upload.sh ${choice}
|
||||
if [ "${choice}" = "on" ]; then
|
||||
# doing initial upload so that user can see result
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
sudo /home/admin/config.scripts/dropbox.upload.sh upload ${dropboxBackupTarget} /home/admin/.lnd/data/chain/${network}/${chain}net/channel.backup
|
||||
fi
|
||||
else
|
||||
echo "lndmanage setting unchanged."
|
||||
fi
|
||||
|
||||
# Keysend process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "k")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${keysend}" != "${choice}" ]; then
|
||||
echo "keysend setting changed .."
|
||||
anychange=1
|
||||
needsReboot=1
|
||||
sudo -u admin /home/admin/config.scripts/lnd.keysend.sh ${choice}
|
||||
dialog --msgbox "Accept Keysend is now ${choice} after Reboot." 5 46
|
||||
else
|
||||
echo "keysend setting unchanged."
|
||||
fi
|
||||
|
||||
# JoinMarket process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "j")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${joinmarket}" != "${choice}" ]; then
|
||||
echo "JoinMarket setting changed .."
|
||||
# check if TOR is installed
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ "${choice}" = "on" ] && [ "${runBehindTor}" = "off" ]; then
|
||||
whiptail --title " Use Tor with JoinMarket" --msgbox "\
|
||||
It is highly recommended to use Tor with JoinMarket.\n
|
||||
Please activate TOR in SERVICES first.\n
|
||||
Then try activating JoinMarket again in SERVICES.\n
|
||||
" 13 42
|
||||
else
|
||||
anychange=1
|
||||
sudo /home/admin/config.scripts/bonus.joinmarket.sh ${choice}
|
||||
errorOnInstall=$?
|
||||
if [ "${choice}" = "on" ]; then
|
||||
if [ ${errorOnInstall} -eq 0 ]; then
|
||||
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
|
||||
else
|
||||
whiptail --title 'FAIL' --msgbox "JoinMarket installation is cancelled\nTry again from the menu or install from the terminal with:\nsudo /home/admin/config.scripts/bonus.joinmarket.sh on" 9 65
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "JoinMarket not changed."
|
||||
fi
|
||||
|
||||
if [ ${anychange} -eq 0 ]; then
|
||||
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
|
||||
exit 0
|
||||
|
@ -204,7 +204,6 @@ if [ ${isMounted} -eq 1 ]; then
|
||||
--menu "You need a copy of the Bitcoin Blockchain - choose method:" 13 75 5 \
|
||||
T "TORRENT --> Download thru Torrent (TRUSTED DEFAULT ±1day)" \
|
||||
C "COPY --> Copy from laptop/node (OVER LAN ±6hours)" \
|
||||
N "CLONE --> Clone from 2nd HDD (EXTRA POWER NEEDED ±6hours)"\
|
||||
S "SYNC --> Selfvalidate all Blocks (VERY SLOW ±2month)" 2>&1 >/dev/tty)
|
||||
|
||||
# Bitcoin on stronger RaspberryPi4 (new DEFAULT)
|
||||
@ -239,10 +238,7 @@ if [ ${isMounted} -eq 1 ]; then
|
||||
;;
|
||||
C)
|
||||
/home/admin/50copyHDD.sh
|
||||
;;
|
||||
N)
|
||||
/home/admin/50cloneHDD.sh
|
||||
;;
|
||||
;;
|
||||
S)
|
||||
/home/admin/50syncHDD.sh
|
||||
/home/admin/10setupBlitz.sh
|
||||
|
@ -1,181 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# CLODE HDD
|
||||
# Script to use the HDD of another RaspiBlitz (Ext4) or from another desktop computer (ExFAT)
|
||||
# and copy blocckhain data over to RaspiBlitz HDD/SSD
|
||||
|
||||
## 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 "or add a USB Hub with extra power between Raspi and 2nd HDD."
|
||||
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
|
||||
found=$(lsblk | grep part | grep -c sdb)
|
||||
if [ ${found} -gt 0 ]; then
|
||||
echo "OK - 2nd HDD found as part of sdb"
|
||||
ready=1
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "*** Mounting 2nd HDD ***"
|
||||
sudo mkdir /mnt/genesis 2>/dev/null
|
||||
echo "try ext4 on sdb1 .."
|
||||
sudo mount -t ext4 /dev/sdb1 /mnt/genesis
|
||||
sleep 4
|
||||
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 4
|
||||
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 4
|
||||
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 4
|
||||
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"
|
||||
echo "PRESS ENTER to return to menu"
|
||||
read key
|
||||
./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/blocks /mnt/genesis/bitcoin/chainstate /mnt/hdd/bitcoin
|
||||
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 find /mnt/hdd/bitcoin/ -iname *.dat -type f | wc -l)
|
||||
if [ ${count} -gt 0 ]; then
|
||||
echo "Found data in /mnt/hdd/bitcoin/blocks"
|
||||
anyDataAtAll=1
|
||||
fi
|
||||
if [ ${count} -lt 300 ]; then
|
||||
echo "FAIL: transfer seems invalid - less then 300 .dat files (${count})"
|
||||
quickCheckOK=0
|
||||
fi
|
||||
count=$(sudo find /mnt/hdd/bitcoin/ -iname *.ldb -type f | wc -l)
|
||||
if [ ${count} -gt 0 ]; then
|
||||
echo "Found data in /mnt/hdd/bitcoin/chainstate"
|
||||
anyDataAtAll=1
|
||||
fi
|
||||
if [ ${count} -lt 700 ]; then
|
||||
echo "FAIL: transfer seems invalid - less then 700 .ldb files (${count})"
|
||||
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
|
@ -66,8 +66,9 @@ echo ""
|
||||
echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need"
|
||||
echo "to be connected to the same local network."
|
||||
echo ""
|
||||
echo "Open a terminal on the source computer and change into the directory that contains the"
|
||||
echo "blockchain data. You should see directories 'blocks', 'chainstate'".
|
||||
echo "If you use a RaspiBlitz (>=v1.5) as Blockchain source go: MENU > REPAIR > COPY-SOURCE"
|
||||
echo "Otherwiese open a terminal on the source computer and change into the directory that"
|
||||
echo "contains the blockchain data. You should see directories 'blocks' & 'chainstate'".
|
||||
echo "Make sure the bitcoin client on that computer is stopped."
|
||||
echo ""
|
||||
echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:"
|
||||
|
@ -102,6 +102,7 @@ echo "*** Init LND Service & Start ***"
|
||||
lndRunning=$(sudo systemctl status lnd.service 2>/dev/null | grep -c running)
|
||||
if [ ${lndRunning} -eq 0 ]; then
|
||||
|
||||
echo "stopping lnd .."
|
||||
sudo systemctl stop lnd 2>/dev/null
|
||||
sudo systemctl disable lnd 2>/dev/null
|
||||
|
||||
@ -234,6 +235,9 @@ if [ ${walletExists} -eq 0 ]; then
|
||||
sudo sed -i "s/^setupStep=.*/setupStep=65/g" /home/admin/raspiblitz.info
|
||||
fi
|
||||
|
||||
echo "waiting ."
|
||||
sleep 10
|
||||
|
||||
else
|
||||
|
||||
############################
|
||||
@ -255,8 +259,30 @@ if [ ${walletExists} -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# recovering from an old wallet while node is not synced is not possible at the moment
|
||||
# because LND will forget the recovery window on restart and not be able to recover funds
|
||||
# TODO: https://github.com/rootzoll/raspiblitz/issues/1126
|
||||
if [ ${setupStep} -lt 100 ]; then
|
||||
if [ "${CHOICE}" == "ONLYSEED" ] || [ "${CHOICE}" == "SEED+SCB" ]; then
|
||||
whiptail --title "UNDER CONSTRUCTION" --msgbox "
|
||||
To recover an old wallet from SEED or SEED+SCB please
|
||||
create an empty NEW WALLET first and setup everything
|
||||
else until you get to the main menu.
|
||||
|
||||
Then once your in the MAIN MENU go to REPAIR > RESET-LND
|
||||
skip all the backups and recover your old wallet.
|
||||
|
||||
Sorry, this process will be optimized soon.
|
||||
" 15 63
|
||||
/home/admin/70initLND.sh
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# WARNING ON ONLY SEED
|
||||
if [ "${CHOICE}" == "ONLYSEED" ]; then
|
||||
|
||||
# ket people know about the difference between SEED & SEED+SCB
|
||||
whiptail --title "IMPORTANT INFO" --yes-button "Continue" --no-button "Go Back" --yesno "
|
||||
Using JUST SEED WORDS will only recover your on-chain funds.
|
||||
To also try to recover the open channel funds you need the
|
||||
@ -377,11 +403,11 @@ to protect the seed words. Most users did not set this.
|
||||
dialog --title " SUCCESS " --msgbox "
|
||||
Looks good :) LND was able to recover the wallet.
|
||||
|
||||
IMPORTANT: After full sync wait an hour - if you
|
||||
see still a on-chain balance of 0 satoshis try to
|
||||
recover your wallet with the ZAP desktop app and
|
||||
then send funds back to your RaspiBlitz.
|
||||
" 12 53
|
||||
IMPORTANT: Please dont reboot the RaspiBlitz until
|
||||
the LND was able to rescan the Blockchain again.
|
||||
" 10 60
|
||||
clear
|
||||
|
||||
else
|
||||
whiptail --title " FAIL " --msgbox "
|
||||
Something went wrong - see info below:
|
||||
@ -398,22 +424,16 @@ ${errMore}
|
||||
fi
|
||||
fi
|
||||
|
||||
clear
|
||||
/home/admin/70initLND.sh
|
||||
|
||||
fi # END OLD WALLET
|
||||
|
||||
else
|
||||
echo "OK - LND wallet already exists."
|
||||
fi
|
||||
|
||||
echo "waiting ."
|
||||
sleep 10
|
||||
|
||||
echo "waiting .."
|
||||
sleep 10
|
||||
echo "waiting ..."
|
||||
sleep 10
|
||||
dialog --pause " Waiting for LND - please wait .." 8 58 30
|
||||
dialog --pause " Waiting for LND - please wait .." 8 58 45
|
||||
|
||||
############################
|
||||
# Copy LND macaroons to admin
|
||||
@ -422,11 +442,15 @@ dialog --pause " Waiting for LND - please wait .." 8 58 30
|
||||
clear
|
||||
echo ""
|
||||
echo "*** Copy LND Macaroons to user admin ***"
|
||||
|
||||
# check if macaroon exists and if not try to unlock LND wallet first
|
||||
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
|
||||
if [ ${macaroonExists} -eq 0 ]; then
|
||||
/home/admin/AAunlockLND.sh
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
# check if macatoon exists now - if not fail
|
||||
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
|
||||
if [ ${macaroonExists} -eq 0 ]; then
|
||||
sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon
|
||||
@ -437,23 +461,11 @@ if [ ${macaroonExists} -eq 0 ]; then
|
||||
echo "You may want try again with starting ./70initLND.sh"
|
||||
exit 1
|
||||
fi
|
||||
macaroonExists=$(sudo ls -la /home/admin/.lnd/data/chain/${network}/${chain}net/ | grep -c admin.macaroon)
|
||||
if [ ${macaroonExists} -eq 0 ]; then
|
||||
sudo mkdir /home/admin/.lnd
|
||||
sudo mkdir /home/admin/.lnd/data
|
||||
sudo mkdir /home/admin/.lnd/data/chain
|
||||
sudo mkdir /home/admin/.lnd/data/chain/${network}
|
||||
sudo mkdir /home/admin/.lnd/data/chain/${network}/${chain}net
|
||||
sudo cp /home/bitcoin/.lnd/tls.cert /home/admin/.lnd
|
||||
sudo cp /home/bitcoin/.lnd/lnd.conf /home/admin/.lnd
|
||||
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon /home/admin/.lnd/data/chain/${network}/${chain}net
|
||||
sudo chown -R admin:admin /home/admin/.lnd/
|
||||
echo "OK - LND Macaroons created"
|
||||
echo ""
|
||||
else
|
||||
echo "OK - Macaroons are already copied"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# copy macaroons to all needed users
|
||||
sudo /home/admin/config.scripts/lnd.check.sh update-credentials
|
||||
echo "OK - LND Macaroons created and copied"
|
||||
echo ""
|
||||
|
||||
###### Unlock Wallet (if needed)
|
||||
echo "*** Check Wallet Lock ***"
|
||||
@ -477,15 +489,12 @@ if [ ${setupStep} -lt 100 ]; then
|
||||
|
||||
else
|
||||
|
||||
# its important that RaspiBlitz dont get rebooted
|
||||
# before LND rescan is finished
|
||||
whiptail --title "RESET DONE" --msgbox "
|
||||
OK LND Reset is done.
|
||||
System will restart now.
|
||||
" 10 35
|
||||
|
||||
# make sure host is named like in the raspiblitz config
|
||||
echo "Setting the Name/Alias/Hostname .."
|
||||
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
|
||||
|
||||
sudo /home/admin/XXshutdown.sh reboot
|
||||
You may now give it
|
||||
extra time to rescan.
|
||||
" 10 25
|
||||
|
||||
fi
|
@ -21,6 +21,20 @@ fi
|
||||
# bitcoin errors always first
|
||||
if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "blockchain-error" ]; then
|
||||
|
||||
####################
|
||||
# Copy Blockchain Source Mode
|
||||
# https://github.com/rootzoll/raspiblitz/issues/1081
|
||||
####################
|
||||
|
||||
if [ "${state}" = "copysource" ]; then
|
||||
l1="Copy Blockchain Source Modus\n"
|
||||
l2="Please restart RaspiBlitz when done.\n"
|
||||
l3="Restart from Terminal: sudo shutdown -r now"
|
||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${localIP}" --infobox "$l1$l2$l3" 5 45
|
||||
sleep 3
|
||||
exit 1
|
||||
fi
|
||||
|
||||
####################
|
||||
# On Bitcoin Error
|
||||
####################
|
||||
|
@ -5,8 +5,10 @@ cd
|
||||
cd /home/admin/assets
|
||||
chmod +x lnbalance.sh
|
||||
chmod +x lnchannels.sh
|
||||
chmod +x lnfwdreport.sh
|
||||
sudo cp lnbalance.sh /usr/local/bin/lnbalance
|
||||
sudo cp lnchannels.sh /usr/local/bin/lnchannels
|
||||
sudo cp lnfwdreport.sh /usr/local/bin/lnfwdreport
|
||||
echo "OK"
|
||||
|
||||
mkdir /home/admin/tmpScriptDL
|
||||
@ -19,4 +21,4 @@ echo "OK - bash completion available after next login"
|
||||
echo "type \"bitcoin-cli getblockch\", press [Tab] → bitcoin-cli getblockchaininfo"
|
||||
rm -r /home/admin/tmpScriptDL
|
||||
|
||||
cd
|
||||
cd
|
||||
|
@ -81,6 +81,11 @@ if [ "${runBehindTor}" = "on" ]; then
|
||||
OPTIONS+=(FULLY_NODED "Fully Noded (IOS+TOR)")
|
||||
fi
|
||||
|
||||
# Additinal Options with no TOR
|
||||
if [ "${runBehindTor}" != "on" ]; then
|
||||
OPTIONS+=(SENDMANY_ANDROID "SendMany (Android)")
|
||||
fi
|
||||
|
||||
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 13 50 7 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
@ -120,6 +125,7 @@ case $CHOICE in
|
||||
exit 1;
|
||||
;;
|
||||
ZAP_IOS)
|
||||
choose_IP_or_TOR
|
||||
appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960"
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
|
||||
whiptail --title "Install Testflight and Zap on your iOS device" \
|
||||
@ -149,6 +155,32 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zap-android ${connect}
|
||||
exit 1;
|
||||
;;
|
||||
SENDMANY_ANDROID)
|
||||
|
||||
# check if keysend is activated first
|
||||
source <(/home/admin/config.scripts/lnd.keysend.sh status)
|
||||
if [ "${keysendOn}" == "0" ]; then
|
||||
whiptail --title " KEYSEND NEEDED " --msgbox "
|
||||
To use the chat feature of the SendMany app, you need to activate the Keysend feature first.
|
||||
|
||||
Please go to MAINMENU > SERVICES and activate KEYSEND first.
|
||||
" 12 65
|
||||
exit 1
|
||||
fi
|
||||
|
||||
appstoreLink="https://github.com/fusion44/sendmany/releases"
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
|
||||
whiptail --title "Install SendMany APK from GithubReleases- (open assets) on your device" \
|
||||
--yes-button "continue" \
|
||||
--no-button "link as QR code" \
|
||||
--yesno "Download & install the SendMany APK from GitHub:\n\n${appstoreLink}\n\nEasiest way to scan QR code on LCD and download/install.\n\nWhen installed and started -> continue." 10 65
|
||||
if [ $? -eq 1 ]; then
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh sendmany-android ${connect}
|
||||
exit 1;
|
||||
;;
|
||||
ZEUS_IOS)
|
||||
appstoreLink="https://testflight.apple.com/join/gpVFzEHN"
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
|
||||
|
@ -46,11 +46,29 @@ RaspiBlitz image to your SD card.
|
||||
" 12 40
|
||||
}
|
||||
|
||||
copyHost()
|
||||
{
|
||||
clear
|
||||
sed -i "s/^state=.*/state=copysource/g" /home/admin/raspiblitz.info
|
||||
sudo systemctl stop lnd
|
||||
sudo systemctl stop ${network}d
|
||||
cd /mnt/hdd/${network}
|
||||
echo
|
||||
echo "*** Copy Blockchain Source Modus ***"
|
||||
echo "Your RaspiBlitz has now stopped LND and ${network}d ..."
|
||||
echo "1. Use command to change to source dir: cd /mnt/hdd/$network"
|
||||
echo "2. Then run the script given by the other RaspiBlitz in Terminal"
|
||||
echo "3. When you are done - Restart RaspiBlitz: sudo shutdown -r now"
|
||||
echo
|
||||
exit 99
|
||||
}
|
||||
|
||||
# Basic Options
|
||||
OPTIONS=(HARDWARE "Run Hardwaretest" \
|
||||
SOFTWARE "Run Softwaretest (DebugReport)" \
|
||||
BACKUP-LND "Backup your LND data (Rescue-File)" \
|
||||
MIGRATION "Migrate Blitz Data to new Hardware" \
|
||||
COPY-SOURCE "Copy Blockchain Source Modus" \
|
||||
RESET-CHAIN "Delete Blockchain & Re-Download" \
|
||||
RESET-LND "Delete LND & start new node/wallet" \
|
||||
RESET-HDD "Delete HDD Data but keep Blockchain" \
|
||||
@ -106,14 +124,19 @@ case $CHOICE in
|
||||
echo "processing ..."
|
||||
sleep 3
|
||||
done
|
||||
# prepare new name
|
||||
sudo sed -i "s/^alias=.*/alias=${result}/g" /home/admin/assets/lnd.${network}.conf
|
||||
|
||||
# make sure host is named like in the raspiblitz config
|
||||
echo "Setting the Name/Alias/Hostname .."
|
||||
sudo /home/admin/config.scripts/lnd.setname.sh ${result}
|
||||
sudo sed -i "s/^hostname=.*/hostname=${result}/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "stopping lnd ..."
|
||||
sudo systemctl stop lnd
|
||||
sudo rm -r /mnt/hdd/lnd
|
||||
/home/admin/70initLND.sh
|
||||
|
||||
# go back to main menu (and show)
|
||||
/home/admin/00raspiblitz.sh
|
||||
exit 1;
|
||||
;;
|
||||
RESET-HDD)
|
||||
@ -130,4 +153,7 @@ case $CHOICE in
|
||||
sudo shutdown now
|
||||
exit 1;
|
||||
;;
|
||||
COPY-SOURCE)
|
||||
copyHost
|
||||
;;
|
||||
esac
|
||||
|
@ -61,7 +61,7 @@ echo "generating QR code ... please wait"
|
||||
whiptail --backtitle "Fund your on chain wallet" \
|
||||
--title "Send ${coininfo}" \
|
||||
--yes-button "DONE" \
|
||||
--no-button "Show QR Code" \
|
||||
--no-button "Console QRcode" \
|
||||
--yesno "${msg}" 0 0
|
||||
|
||||
# display QR code
|
||||
|
@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.46.1] - 2020-04-17
|
||||
### Added
|
||||
- remove LND config check
|
||||
|
||||
## [0.45.0] - 2020-01-25
|
||||
### Added
|
||||
- clean up log statements
|
||||
|
@ -178,15 +178,6 @@ class AppWindow(QMainWindow):
|
||||
if not os.path.exists(rb_info_abs_path):
|
||||
log.warning("file does not exist: {}".format(rb_info_abs_path))
|
||||
|
||||
log.debug("init lnd.conf")
|
||||
lnd_cfg_valid = False
|
||||
self.lnd_cfg = LndConfig(lnd_cfg_abs_path)
|
||||
try:
|
||||
self.lnd_cfg.reload()
|
||||
lnd_cfg_valid = True
|
||||
except Exception as err:
|
||||
pass
|
||||
|
||||
log.debug("init raspiblitz.conf")
|
||||
rb_cfg_valid = False
|
||||
self.rb_cfg = RaspiBlitzConfig(rb_cfg_abs_path)
|
||||
@ -205,7 +196,7 @@ class AppWindow(QMainWindow):
|
||||
except Exception as err:
|
||||
pass
|
||||
|
||||
self.cfg_valid = lnd_cfg_valid and rb_cfg_valid and rb_info_valid
|
||||
self.cfg_valid = rb_cfg_valid and rb_info_valid
|
||||
log.debug("checked cfg_valid with result: {}".format(self.cfg_valid))
|
||||
|
||||
def check_invoice(self, flag, tick=0):
|
||||
@ -305,7 +296,6 @@ class AppWindow(QMainWindow):
|
||||
|
||||
def update_watched_attr(self):
|
||||
log.debug("updating: watched attributes")
|
||||
self.lnd_cfg.reload()
|
||||
self.rb_cfg.reload()
|
||||
self.rb_info.reload()
|
||||
|
||||
|
@ -4,5 +4,5 @@
|
||||
# 3) we can import it into your module module
|
||||
"""
|
||||
|
||||
__version_info__ = ('0', '45', '0')
|
||||
__version_info__ = ('0', '46', '1')
|
||||
__version__ = '.'.join(__version_info__)
|
||||
|
@ -106,6 +106,8 @@ else
|
||||
sudo rm -f -r /mnt/hdd/tor
|
||||
sudo rm -f -r /mnt/hdd/temp
|
||||
sudo rm -f -r /mnt/hdd/ssh
|
||||
sudo rm -f -r /mnt/hdd/app-storage
|
||||
sudo rm -f -r /mnt/hdd/app-data
|
||||
sudo rm -f /mnt/hdd/swapfile
|
||||
sudo rm -f /mnt/hdd/*.*
|
||||
|
||||
|
@ -17,7 +17,7 @@ pathBitcoinBlockchain="/mnt/hdd/bitcoin"
|
||||
pathLitecoinBlockchain="/mnt/hdd/litecoin"
|
||||
|
||||
# where to find the RaspiBlitz HDD template directory (no trailing /)
|
||||
pathTemplateHDD="/mnt/hdd/templateHDD"
|
||||
pathTemplateHDD="/mnt/hdd/app-storage/templateHDD"
|
||||
|
||||
# 0 = ask before formatting/init new HDD
|
||||
# 1 = auto-formatting every new HDD that needs init
|
||||
@ -41,44 +41,61 @@ if [ "$EUID" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get HDD info
|
||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||
|
||||
# check if HDD is mounted
|
||||
if [ ${isMounted} -eq 0 ]; then
|
||||
echo "error='HDD is not mounted'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if HDD is big enough
|
||||
if [ ${hddGigaBytes} -lt 800 ]; then
|
||||
echo "# To run copy station (+/- 1TB needed)"
|
||||
echo "error='HDD is too small'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check that path information is valid
|
||||
if [ -d "$pathBitcoinBlockchain" ]; then
|
||||
echo "# OK found $pathBitcoinBlockchain"
|
||||
else
|
||||
echo "# FAIL path of 'pathBitcoinBlockchain' does not exists: ${pathBitcoinBlockchain}"
|
||||
echo "error='pathBitcoinBlockchain nit found'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure that its running in screen
|
||||
# call with '-foreground' to prevent running in screen
|
||||
if [ "$1" != "-foreground" ]; then
|
||||
screenPID=$(screen -ls | grep "copystation" | cut -d "." -f1 | xargs)
|
||||
if [ ${#screenPID} -eq 0 ]; then
|
||||
# start copystation in sreen
|
||||
echo "starting copystation screen session"
|
||||
echo "# starting copystation screen session"
|
||||
screen -S copystation -dm /home/admin/XXcopyStation.sh -foreground
|
||||
screen -d -r
|
||||
exit 0
|
||||
else
|
||||
echo "changing into running copystation screen session"
|
||||
echo "# changing into running copystation screen session"
|
||||
screen -d -r
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
clear
|
||||
echo "******************************"
|
||||
echo "RASPIBLITZ COPYSTATION SCRIPT"
|
||||
echo "******************************"
|
||||
echo "# ******************************"
|
||||
echo "# RASPIBLITZ COPYSTATION SCRIPT"
|
||||
echo "# ******************************"
|
||||
echo
|
||||
|
||||
echo "*** CHECKING CONFIG"
|
||||
|
||||
# check that path information is valid
|
||||
if [ -d "$pathBitcoinBlockchain" ]; then
|
||||
echo "OK found $pathBitcoinBlockchain"
|
||||
else
|
||||
echo "FAIL path of 'pathBitcoinBlockchain' does not exists: ${pathBitcoinBlockchain}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check that path information is valid
|
||||
if [ -d "$pathTemplateHDD" ]; then
|
||||
echo "OK found $pathTemplateHDD"
|
||||
echo "# OK found $pathTemplateHDD"
|
||||
else
|
||||
echo "Creating: ${pathTemplateHDD}"
|
||||
echo "# Creating: ${pathTemplateHDD}"
|
||||
mkdir ${pathTemplateHDD}
|
||||
chmod 777 ${pathTemplateHDD}
|
||||
fi
|
||||
@ -87,29 +104,26 @@ fi
|
||||
systemctl stop lnd 2>/dev/null
|
||||
systemctl stop background 2>/dev/null
|
||||
|
||||
|
||||
if [ "${nointeraction}" == "1" ]; then
|
||||
echo "setting RaspiBlitz LCD info"
|
||||
sudo sed -i "s/^state=.*/state=copystation/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
sudo sed -i "s/^message=.*/message='Disconnect target HDDs!'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
echo "Disconnect target HDDs! .. 30ses until continue."
|
||||
sleep 30
|
||||
else
|
||||
echo
|
||||
echo "*** INIT HDD SCAN"
|
||||
echo "Please make sure that no HDDs that you want to sync later to are not connected now."
|
||||
echo "PRESS ENTER when ready."
|
||||
read key
|
||||
fi
|
||||
#if [ "${nointeraction}" == "1" ]; then
|
||||
# echo "setting RaspiBlitz LCD info"
|
||||
# sudo sed -i "s/^state=.*/state=copystation/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
# sudo sed -i "s/^message=.*/message='Disconnect target HDDs!'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
# echo "Disconnect target HDDs! .. 30sec until continue."
|
||||
# sleep 30
|
||||
#else
|
||||
# echo
|
||||
# echo "*** INIT HDD SCAN"
|
||||
# echo "Please make sure that no HDDs that you want to sync later to are not connected now."
|
||||
# echo "PRESS ENTER when ready."
|
||||
# read key
|
||||
#fi
|
||||
|
||||
# finding system drives (the drives that should not be synced to)
|
||||
systemDrives=$(lsblk -o NAME | grep "^sd")
|
||||
echo "OK - the following drives detected as system drives:"
|
||||
echo "$systemDrives"
|
||||
echo "# OK - the following drives detected as the system drive: $datadisk"
|
||||
echo
|
||||
|
||||
if [ "${nointeraction}" == "1" ]; then
|
||||
sudo sed -i "s/^message=.*/message='Connect now target HDDs ..'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
sudo sed -i "s/^message=.*/message='Connect target HDDs ..'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
@ -132,7 +146,7 @@ do
|
||||
# only execute every 30min
|
||||
nowTimestamp=$(date +%s)
|
||||
secondsDiff=$(echo "${nowTimestamp}-${lastBlockchainUpdateTimestamp}" | bc)
|
||||
echo "seconds since last update from bitcoind: ${secondsDiff}"
|
||||
echo "# seconds since last update from bitcoind: ${secondsDiff}"
|
||||
echo
|
||||
|
||||
if [ ${secondsDiff} -gt 3000 ]; then
|
||||
@ -142,42 +156,45 @@ do
|
||||
echo "******************************"
|
||||
|
||||
# stop blockchains
|
||||
echo "Stopping Blockchain ..."
|
||||
echo "# Stopping Blockchain ..."
|
||||
systemctl stop bitcoind 2>/dev/null
|
||||
systemctl stop litecoind 2>/dev/null
|
||||
sleep 10
|
||||
|
||||
# sync bitcoin
|
||||
echo "Syncing Bitcoin ..."
|
||||
echo "# Syncing Bitcoin to template folder ..."
|
||||
|
||||
sudo sed -i "s/^message=.*/message='Updating Template: Bitcoin'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
|
||||
# make sure the bitcoin directory in template folder exists
|
||||
if [ ! -d "$pathTemplateHDD/bitcoin" ]; then
|
||||
echo "creating the bitcoin subfolder in the template folder"
|
||||
echo "# creating the bitcoin subfolder in the template folder"
|
||||
mkdir ${pathTemplateHDD}/bitcoin
|
||||
chmod 777 ${pathTemplateHDD}/bitcoin
|
||||
fi
|
||||
|
||||
rsync -a --info=progress2 ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathBitcoinBlockchain}/testnet3 ${pathTemplateHDD}/bitcoin
|
||||
# do the sync to the template folder for BITCOIN
|
||||
rsync -a --info=progress2 --delete ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathTemplateHDD}/bitcoin
|
||||
|
||||
if [ -d "${pathLitecoinBlockchain}" ]; then
|
||||
litecoindirsize=$(sudo du -s -b /mnt/hdd/litecoin | awk '$1=$1' | cut -d " " -f1)
|
||||
if [ -d "${pathLitecoinBlockchain}" ] && [ ${litecoindirsize} -gt 1000000000 ]; then
|
||||
|
||||
# sync litecoin
|
||||
echo "Syncing Litecoin ..."
|
||||
echo "# Syncing Litecoin ..."
|
||||
|
||||
echo "creating the litecoin subfolder in the template folder"
|
||||
echo "# creating the litecoin subfolder in the template folder"
|
||||
mkdir ${pathTemplateHDD}/litecoin 2>/dev/null
|
||||
chmod 777 ${pathTemplateHDD}/litecoin 2>/dev/null
|
||||
|
||||
sudo sed -i "s/^message=.*/message='Updating Template: Litecoin'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
|
||||
rsync -a --info=progress2 ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin
|
||||
# do the sync to the template folder for LITECOIN
|
||||
rsync -a --info=progress2 --delete ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin
|
||||
|
||||
fi
|
||||
|
||||
# restart bitcoind (to let further setup while syncing HDDs)
|
||||
echo "Restarting Blockchain ..."
|
||||
echo "# Restarting Blockchain ..."
|
||||
systemctl start bitcoind 2>/dev/null
|
||||
systemctl start litecoind 2>/dev/null
|
||||
|
||||
@ -188,10 +205,16 @@ do
|
||||
################################################
|
||||
# 2. detect connected HDDs and loop thru them
|
||||
|
||||
echo
|
||||
echo "**************************************"
|
||||
echo "SYNCING TEMPLATE -> CONNECTED HDD/SSDs"
|
||||
echo "**************************************"
|
||||
echo "NOTE: Only use to prepare fresh HDDs"
|
||||
|
||||
sleep 4
|
||||
echo "" > ./.syncinfo.tmp
|
||||
lsblk -o NAME | grep "^sd" | while read -r detectedDrive ; do
|
||||
isSystemDrive=$(echo "${systemDrives}" | grep -c "${detectedDrive}")
|
||||
isSystemDrive=$(echo "${datadisk}" | grep -c "${detectedDrive}")
|
||||
if [ ${isSystemDrive} -eq 0 ]; then
|
||||
|
||||
# check if drives 1st partition is named BLOCKCHAIN & in EXT4 format
|
||||
@ -210,68 +233,42 @@ do
|
||||
size=$(lsblk -o NAME,SIZE -b | grep "^${detectedDrive}" | awk '$1=$1' | cut -d " " -f 2)
|
||||
echo "size: ${size}"
|
||||
if [ ${size} -lt 250000000000 ]; then
|
||||
read key
|
||||
whiptail --title "FAIL" --msgbox "
|
||||
THE DEVICE IS TOO SMALL <250GB
|
||||
Please remove device and PRESS ENTER
|
||||
" 9 46
|
||||
else
|
||||
|
||||
# find biggest partition
|
||||
biggestSize=0
|
||||
lsblk -o NAME,SIZE -b | grep "─${detectedDrive}" | while read -r partitionLine ; do
|
||||
partition=$(echo "${partitionLine}" | cut -d ' ' -f 1 | tr -cd "[:alnum:]")
|
||||
size=$(echo "${partitionLine}" | tr -cd "[0-9]")
|
||||
if [ ${size} -gt ${biggestSize} ]; then
|
||||
formatPartition="${partition}"
|
||||
biggestSize=$size
|
||||
fi
|
||||
echo "${formatPartition}" > .formatPartition.tmp
|
||||
done
|
||||
|
||||
formatPartition=$(cat .formatPartition.tmp)
|
||||
rm .formatPartition.tmp
|
||||
|
||||
if [ ${#formatPartition} -eq 0 ]; then
|
||||
whiptail --title "FAIL" --msgbox "
|
||||
NO PARTITIONS FOUND ON THAT DEVICE
|
||||
Format on external computer with FAT32 first.
|
||||
Please remove device now.
|
||||
" 10 46
|
||||
else
|
||||
|
||||
# if config value "nointeraction=1" default to format
|
||||
if [ "${nointeraction}" != "1" ]; then
|
||||
whiptail --title "Format HDD" --yes-button "Format" --no-button "Cancel" --yesno "
|
||||
# if config value "nointeraction=1" default to format
|
||||
if [ "${nointeraction}" != "1" ]; then
|
||||
whiptail --title "Format HDD" --yes-button "Format" --no-button "Cancel" --yesno "
|
||||
Found new HDD. Do you want to FORMAT now?
|
||||
Please temp lable device with: ${formatPartition}
|
||||
" 10 54
|
||||
choice=$?
|
||||
else
|
||||
choice=0
|
||||
sudo sed -i "s/^message=.*/message='Formatting new HDD: ${formatPartition}'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
fi
|
||||
|
||||
# on cancel
|
||||
if [ "${choice}" != "0" ]; then
|
||||
whiptail --title "Format HDD" --msgbox "
|
||||
OK NO FORMAT - Please remove decive now.
|
||||
" 8 46
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# format the HDD
|
||||
echo "Starting Formatting of device ..."
|
||||
sudo mkfs.ext4 /dev/${formatPartition} -F -L BLOCKCHAIN
|
||||
|
||||
Lable of device with: ${detectedDrive}
|
||||
" 10 54
|
||||
choice=$?
|
||||
else
|
||||
choice=0
|
||||
sudo sed -i "s/^message=.*/message='Formatting new HDD: ${formatPartition}'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
fi
|
||||
|
||||
# on cancel
|
||||
if [ "${choice}" != "0" ]; then
|
||||
whiptail --title "Format HDD" --msgbox "
|
||||
OK NO FORMAT - Please remove decive now.
|
||||
" 8 46
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# format the HDD
|
||||
echo "Starting Formatting of device ${detectedDrive} ..."
|
||||
sudo /home/admin/config.scripts/blitz.datadrive.sh format ext4 ${detectedDrive}
|
||||
|
||||
fi
|
||||
|
||||
fi # end init new HDD
|
||||
|
||||
################################################
|
||||
# 3. sync HDD with template data
|
||||
# 3. sync HDD with template data
|
||||
|
||||
partition=$(lsblk -o NAME,FSTYPE,LABEL | grep "${detectedDrive}" | grep "BLOCKCHAIN" | cut -d ' ' -f 1 | tr -cd "[:alnum:]")
|
||||
if [ ${#partition} -gt 0 ]; then
|
||||
@ -284,15 +281,13 @@ OK NO FORMAT - Please remove decive now.
|
||||
# rsync device
|
||||
mountOK=$(lsblk -o NAME,MOUNTPOINT | grep "${detectedDrive}" | grep -c "/mnt/hdd2")
|
||||
if [ ${mountOK} -eq 1 ]; then
|
||||
if [ "${nointeraction}" == "1" ]; then
|
||||
sudo sed -i "s/^message=.*/message='Syncing from Template: ${partition}'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
fi
|
||||
rsync -a --info=progress2 ${pathTemplateHDD}/* /mnt/hdd2
|
||||
chmod -r 777 /mnt/hdd2
|
||||
sudo sed -i "s/^message=.*/message='Syncing Template -> ${partition}'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
rsync -a --info=progress2 --delete ${pathTemplateHDD}/* /mnt/hdd2
|
||||
sudo chmod -R 777 /mnt/hdd2
|
||||
rm -r /mnt/hdd2/lost+found 2>/dev/null
|
||||
echo "${partition} " >> ./.syncinfo.tmp
|
||||
else
|
||||
echo "FAIL: was not able to mount --> ${partition}"
|
||||
echo "# FAIL: was not able to mount --> ${partition}"
|
||||
fi
|
||||
|
||||
# unmount device
|
||||
@ -309,6 +304,7 @@ OK NO FORMAT - Please remove decive now.
|
||||
echo "HDDs ready synced: ${synced}"
|
||||
echo "*************************"
|
||||
echo "Its safe to disconnect/remove HDDs now."
|
||||
echo "Or connect a new HDD/SSD for syncing."
|
||||
echo "To stop copystation script: CTRL+c"
|
||||
echo ""
|
||||
|
||||
|
@ -134,6 +134,16 @@ else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "${specter}" = "on" ]; then
|
||||
echo "*** LAST 20 SPECTER LOGS ***"
|
||||
echo "sudo journalctl -u cryptoadvance-specter -b --no-pager -n20"
|
||||
sudo journalctl -u cryptoadvance-specter -b --no-pager -n20
|
||||
echo ""
|
||||
else
|
||||
echo "- SPECTER is OFF by config"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "*** HARDWARE TEST RESULTS ***"
|
||||
showImproveInfo=0
|
||||
if [ ${#undervoltageReports} -gt 0 ]; then
|
||||
|
38
home.admin/XXlnfwdreport.sh
Executable file
38
home.admin/XXlnfwdreport.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
_temp="./download/dialog.$$"
|
||||
_error="./.error.out"
|
||||
|
||||
# load raspiblitz config data (with backup from old config)
|
||||
source /home/admin/raspiblitz.info
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||
if [ ${#chain} -eq 0 ]; then
|
||||
echo "gathering chain info ... please wait"
|
||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||
fi
|
||||
|
||||
# let user enter a <pubkey>@host
|
||||
l1="Enter the number of days to query:"
|
||||
l2="e.g. '7' will query the last 7 days"
|
||||
dialog --title "Create a forwarding event report" \
|
||||
--backtitle "Lightning ( ${network} | ${chain} )" \
|
||||
--inputbox "$l1\n$l2" 10 60 7 2>$_temp
|
||||
_input=$(cat $_temp | xargs )
|
||||
shred $_temp
|
||||
if [ ${#_input} -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# build command
|
||||
command="lnfwdreport -n ${chain}net -c ${network} -- ${_input}"
|
||||
clear
|
||||
echo "Generating report..."
|
||||
|
||||
# execute command
|
||||
|
||||
result=$($command 2>$_error)
|
||||
echo ""
|
||||
echo ""
|
||||
echo "$result"
|
||||
echo ""
|
@ -9,6 +9,12 @@ echo "they will get recreated on fresh bootup, by _bootstrap.sh service"
|
||||
sudo rm /etc/ssh/ssh_host_*
|
||||
echo "OK"
|
||||
|
||||
# https://github.com/rootzoll/raspiblitz/issues/1068#issuecomment-599267503
|
||||
echo ""
|
||||
echo "deleting local DNS confs ..."
|
||||
sudo rm /etc/resolv.conf
|
||||
echo "OK"
|
||||
|
||||
echo " "
|
||||
echo "Will shutdown now."
|
||||
echo "Wait until Raspberry LEDs show no activity anymore."
|
||||
|
@ -324,13 +324,13 @@ else
|
||||
fi
|
||||
|
||||
# LCD ROTATE
|
||||
if [ "${#lcdrotate}" -gt 0 ]; then
|
||||
echo "Provisioning LCD rotate - run config script" >> ${logFile}
|
||||
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
|
||||
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${lcdrotate} >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning LCD rotate - not active" >> ${logFile}
|
||||
if [ "${#lcdrotate}" -eq 0 ]; then
|
||||
# when upgrading from an old raspiblitz - enforce lcdrotate = 0
|
||||
lcdrotate=0
|
||||
fi
|
||||
echo "Provisioning LCD rotate - run config script" >> ${logFile}
|
||||
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
|
||||
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${lcdrotate} >> ${logFile} 2>&1
|
||||
|
||||
# TOUCHSCREEN
|
||||
if [ "${#touchscreen}" -gt 0 ]; then
|
||||
@ -359,6 +359,24 @@ else
|
||||
echo "Provisioning LNbits - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# JoinMarket
|
||||
if [ "${joinmarket}" = "on" ]; then
|
||||
echo "Provisioning JoinMarket - run config script" >> ${logFile}
|
||||
sudo sed -i "s/^message=.*/message='Setup JoinMarket'/g" ${infoFile}
|
||||
sudo /home/admin/config.scripts/bonus.joinmarket.sh on >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning JoinMarket - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# JoinMarket
|
||||
if [ "${specter}" = "on" ]; then
|
||||
echo "Provisioning Specter - run config script" >> ${logFile}
|
||||
sudo sed -i "s/^message=.*/message='Setup Specter'/g" ${infoFile}
|
||||
sudo -u admin /home/admin/config.scripts/bonus.cryptoadvance-specter.sh on >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning Specter - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# replay backup LND conf & tlscerts
|
||||
# https://github.com/rootzoll/raspiblitz/issues/324
|
||||
echo "" >> ${logFile}
|
||||
|
@ -71,7 +71,15 @@ logsMegaByte=$(sudo du -c -m /var/log | grep "total" | awk '{print $1;}')
|
||||
if [ ${logsMegaByte} -gt 1000 ]; then
|
||||
echo "WARN !! Logs /var/log in are bigger then 1GB"
|
||||
echo "ACTION --> DELETED ALL LOGS"
|
||||
if [ -d "/var/log/nginx" ]; then
|
||||
nginxLog=1
|
||||
echo "/var/log/nginx is present"
|
||||
fi
|
||||
sudo rm -r /var/log/*
|
||||
if [ $nginxLog == 1 ]; then
|
||||
sudo mkdir /var/log/nginx
|
||||
echo "Recreated /var/log/nginx"
|
||||
fi
|
||||
sleep 3
|
||||
echo "WARN !! Logs in /var/log in were bigger then 1GB and got emergency delete to prevent fillup."
|
||||
echo "If you see this in the logs please report to the GitHub issues, so LOG config needs to hbe optimized."
|
||||
@ -147,15 +155,37 @@ fi
|
||||
# the sd card - switch to hdmi
|
||||
################################
|
||||
|
||||
forceHDMIoutput=$(sudo ls /boot/hdmi 2>/dev/null | grep -c hdmi)
|
||||
forceHDMIoutput=$(sudo ls /boot/hdmi* 2>/dev/null | grep -c hdmi)
|
||||
if [ ${forceHDMIoutput} -eq 1 ]; then
|
||||
# delete that file (to prevent loop)
|
||||
sudo rm /boot/hdmi
|
||||
sudo rm /boot/hdmi*
|
||||
# switch to HDMI what will trigger reboot
|
||||
sudo /home/admin/config.scripts/blitz.lcd.sh hdmi on
|
||||
exit 0
|
||||
fi
|
||||
|
||||
################################
|
||||
# SSH SERVER CERTS RESET
|
||||
# if a file called 'ssh.reset' gets
|
||||
# placed onto the boot part of
|
||||
# the sd card - switch to hdmi
|
||||
################################
|
||||
|
||||
sshReset=$(sudo ls /boot/ssh.reset* 2>/dev/null | grep -c reset)
|
||||
if [ ${sshReset} -eq 1 ]; then
|
||||
# delete that file (to prevent loop)
|
||||
sudo rm /boot/ssh.reset*
|
||||
# show info ssh reset
|
||||
sed -i "s/^state=.*/state=sshreset/g" ${infoFile}
|
||||
sed -i "s/^message=.*/message='resetting SSH & reboot'/g" ${infoFile}
|
||||
# delete ssh certs
|
||||
sudo systemctl stop sshd
|
||||
sudo rm /mnt/hdd/ssh/ssh_host*
|
||||
sudo ssh-keygen -A
|
||||
sudo /home/admin/XXshutdown.sh reboot
|
||||
exit 0
|
||||
fi
|
||||
|
||||
################################
|
||||
# WAIT FOR LOCAL NETWORK
|
||||
################################
|
||||
@ -407,35 +437,8 @@ sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin 2>/dev/null
|
||||
source ${configFile}
|
||||
if [ ${#network} -gt 0 ] && [ ${#chain} -gt 0 ]; then
|
||||
|
||||
echo "making sure LND blockchain RPC password is set correct in lnd.conf" >> $logFile
|
||||
source <(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep "rpcpass" | sed 's/^[a-z]*\./lnd/g')
|
||||
if [ ${#rpcpassword} -gt 0 ]; then
|
||||
sudo sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${rpcpassword}/g" /mnt/hdd/lnd/lnd.conf 2>/dev/null
|
||||
else
|
||||
echo "WARN: could not get value 'rpcuser' from blockchain conf" >> $logFile
|
||||
fi
|
||||
|
||||
echo "updating/cleaning admin user LND data" >> $logFile
|
||||
sudo rm -R /home/admin/.lnd 2>/dev/null
|
||||
sudo mkdir -p /home/admin/.lnd/data/chain/${network}/${chain}net 2>/dev/null
|
||||
sudo cp /mnt/hdd/lnd/lnd.conf /home/admin/.lnd/lnd.conf 2>> $logFile
|
||||
sudo cp /mnt/hdd/lnd/tls.cert /home/admin/.lnd/tls.cert 2>> $logFile
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon > /home/admin/.lnd/data/chain/${network}/${chain}net/admin.macaroon" 2>> $logFile
|
||||
sudo chown admin:admin -R /home/admin/.lnd 2>> $logFile
|
||||
|
||||
echo "updating/cleaning pi user LND data (just read & invoice)" >> $logFile
|
||||
sudo rm -R /home/pi/.lnd 2>/dev/null
|
||||
sudo mkdir -p /home/pi/.lnd/data/chain/${network}/${chain}net/ 2>> $logFile
|
||||
sudo cp /mnt/hdd/lnd/tls.cert /home/pi/.lnd/tls.cert 2>> $logFile
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/readonly.macaroon > /home/pi/.lnd/data/chain/${network}/${chain}net/readonly.macaroon" 2>> $logFile
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/invoice.macaroon > /home/pi/.lnd/data/chain/${network}/${chain}net/invoice.macaroon" 2>> $logFile
|
||||
sudo chown pi:pi -R /home/pi/.lnd 2>> $logFile
|
||||
|
||||
if [ "${LNbits}" = "on" ]; then
|
||||
echo "updating macaroons for LNbits fresh on start" >> $logFile
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh write-macaroons >> $logFile
|
||||
sudo chown admin:admin -R /mnt/hdd/app-data/LNBits
|
||||
fi
|
||||
echo "running LND user credentials update" >> $logFile
|
||||
sudo /home/admin/config.scripts/lnd.check.sh update-credentials >> $logFile
|
||||
|
||||
else
|
||||
echo "skipping admin user LND data update" >> $logFile
|
||||
|
@ -1,2 +1,2 @@
|
||||
# RaspiBlitz Version - always [main].[sub]
|
||||
codeVersion="1.4"
|
||||
codeVersion="1.5"
|
BIN
home.admin/assets/RaspiBlitzRecoverySheet.docx
Normal file
BIN
home.admin/assets/RaspiBlitzRecoverySheet.docx
Normal file
Binary file not shown.
@ -11,7 +11,7 @@ After=bitcoind.service
|
||||
[Service]
|
||||
EnvironmentFile=/mnt/hdd/raspiblitz.conf
|
||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED
|
||||
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort}
|
||||
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort} ${lndExtraParameter}
|
||||
PIDFile=/home/bitcoin/.lnd/lnd.pid
|
||||
User=bitcoin
|
||||
Group=bitcoin
|
||||
|
74
home.admin/assets/lnfwdreport.sh
Executable file
74
home.admin/assets/lnfwdreport.sh
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
network=mainnet
|
||||
chain=bitcoin
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
while [ -n "$1" ]; do # while loop starts
|
||||
case "$1" in
|
||||
-c) chain=$2
|
||||
shift
|
||||
;;
|
||||
-n)
|
||||
network="$2"
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift # The double dash makes them parameters
|
||||
break
|
||||
;;
|
||||
*) echo "Option $1 not recognized" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
fi
|
||||
|
||||
days=${1:-1}
|
||||
start_date=$(date -d "$date -$days days" +%s)
|
||||
|
||||
declare -A pubKeyAliasLookup
|
||||
while IFS= read -r pubKey
|
||||
do
|
||||
alias=$(lncli --network $network --chain $chain getnodeinfo $pubKey | jq '.node.alias')
|
||||
alias=${alias:1:-1}
|
||||
pubKeyAliasLookup[$pubKey]=$alias
|
||||
# echo $pubKey : ${pubKeyAliasLookup[$pubKey]}
|
||||
done < <(lncli --network $network --chain $chain listpeers | jq '.peers[].pub_key' | tr -d '"')
|
||||
|
||||
declare -A channelIdPubKeyLookup
|
||||
while IFS=, read -r remotePubKey channelId
|
||||
do
|
||||
channelIdPubKeyLookup[$channelId]=$remotePubKey
|
||||
done < <(lncli --network $network --chain $chain listchannels \
|
||||
| jq --raw-output '.channels[] | [.remote_pubkey,.chan_id] | @csv' \
|
||||
| tr -d '"')
|
||||
|
||||
OUTPUT="Date,Channel In,Channel Out,Amount,Fee
|
||||
----------------,----------,-----------,------,---"
|
||||
|
||||
declare -i index_offset=0
|
||||
while :
|
||||
do
|
||||
events=$(lncli --network $network --chain $chain fwdinghistory --start_time $start_date --index_offset $index_offset \
|
||||
| jq -r '(([.last_offset_index, (.forwarding_events | length)]) | @csv),
|
||||
(.forwarding_events[]
|
||||
| [(.timestamp | tonumber | strftime("%a %d %h %H:%M")), .chan_id_in, .chan_id_out, .amt_out, .fee]
|
||||
| @csv)' \
|
||||
| tr -d '"')
|
||||
IFS=, read last_offset_index event_count <<< "$events"
|
||||
|
||||
while IFS=, read eventDate channelIdIn channelIdOut amountIn fee
|
||||
do
|
||||
channelInPubKey=${channelIdPubKeyLookup[$channelIdIn]}
|
||||
channelOutPubKey=${channelIdPubKeyLookup[$channelIdOut]}
|
||||
OUTPUT="${OUTPUT}
|
||||
${eventDate},${pubKeyAliasLookup[$channelInPubKey]},${pubKeyAliasLookup[$channelOutPubKey]},$amountIn,$fee"
|
||||
|
||||
done < <(tail -n +2 <<< $events)
|
||||
|
||||
if [ $event_count -lt 100 ]; then break; fi
|
||||
index_offset=$last_offset_index
|
||||
|
||||
done
|
||||
|
||||
column -t -s',' <<< "$OUTPUT"
|
@ -174,30 +174,6 @@ def main():
|
||||
# parse args
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
# LND Config
|
||||
lnd_cfg_valid = False
|
||||
|
||||
lnd_cfg = LndConfig()
|
||||
if os.path.exists(lnd_cfg.abs_path):
|
||||
try:
|
||||
lnd_cfg.reload()
|
||||
|
||||
lnd_cfg_valid = True
|
||||
if not args.quiet:
|
||||
print("LND Config: \t\tOK")
|
||||
except Exception as err:
|
||||
if not args.quiet:
|
||||
print("LND Config: \t\tERROR")
|
||||
log.warning(err)
|
||||
print("# Use command to fix: sudo nano /mnt/hdd/lnd/lnd.conf")
|
||||
print("# CTRL+o to save / CRTL+x to exit / then reboot")
|
||||
|
||||
else:
|
||||
if not args.quiet:
|
||||
print("LND Config: \t\tMISSING")
|
||||
|
||||
|
||||
# Raspi Config
|
||||
rb_cfg_valid = False
|
||||
|
||||
@ -244,17 +220,6 @@ def main():
|
||||
|
||||
|
||||
if args.print:
|
||||
print("=======\n= LND =\n=======")
|
||||
if lnd_cfg_valid:
|
||||
print("rpc_list: \t\t{}".format(lnd_cfg.rpc_listen))
|
||||
print("rpc_list_host: \t\t{}".format(lnd_cfg.rpc_listen_host))
|
||||
print("rpc_list_port: \t\t{}".format(lnd_cfg.rpc_listen_port))
|
||||
print("")
|
||||
else:
|
||||
print("invalid or missing")
|
||||
print("")
|
||||
|
||||
|
||||
print("====================\n= RaspiBlitzConfig =\n====================")
|
||||
if rb_cfg_valid:
|
||||
print("auto_nat_discovery: \t\t{}".format(rb_cfg.auto_nat_discovery))
|
||||
|
@ -196,6 +196,12 @@ if [ "$1" = "status" ]; then
|
||||
echo "hddGotBlockchain=0"
|
||||
fi
|
||||
|
||||
# check size in bytes and GBs
|
||||
size=$(lsblk -o NAME,SIZE -b | grep "^${hdd}" | awk '$1=$1' | cut -d " " -f 2)
|
||||
echo "hddBytes=${size}"
|
||||
hddGigaBytes=$(echo "scale=0; ${size}/1024/1024/1024" | bc -l)
|
||||
echo "hddGigaBytes=${hddGigaBytes}"
|
||||
|
||||
# used space - at the moment just string info to display
|
||||
if [ ${isBTRFS} -eq 0 ]; then
|
||||
# EXT4 calculations
|
||||
@ -297,14 +303,16 @@ if [ "$1" = "format" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
>&2 echo "# Checking on SWAP"
|
||||
if [ ${isSwapExternal} -eq 1 ]; then
|
||||
>&2 echo "# Switching off external SWAP"
|
||||
# get basic info on data drives
|
||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||
|
||||
if [ ${isSwapExternal} -eq 1 ] && [ "${hdd}" == "${datadisk}" ]; then
|
||||
>&2 echo "# Switching off external SWAP of system drive"
|
||||
sudo dphys-swapfile swapoff 1>/dev/null
|
||||
sudo dphys-swapfile uninstall 1>/dev/null
|
||||
fi
|
||||
|
||||
>&2 echo "# Unmounting all data drives"
|
||||
>&2 echo "# Unmounting all partitions of this device"
|
||||
# remove device from all system mounts (also fstab)
|
||||
lsblk -o NAME,UUID | grep "${hdd}" | awk '$1=$1' | cut -d " " -f 2 | grep "-" | while read -r uuid ; do
|
||||
>&2 echo "# Cleaning /etc/fstab from ${uuid}"
|
||||
@ -313,24 +321,26 @@ if [ "$1" = "format" ]; then
|
||||
done
|
||||
sudo mount -a
|
||||
|
||||
# unmount drives
|
||||
sudo umount /mnt/hdd 2>/dev/null
|
||||
sudo umount /mnt/temp 2>/dev/null
|
||||
sudo umount /mnt/storage 2>/dev/null
|
||||
unmounted1=$(df | grep -c "/mnt/hdd")
|
||||
if [ ${unmounted1} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/hdd'"
|
||||
exit 1
|
||||
fi
|
||||
unmounted2=$(df | grep -c "/mnt/temp")
|
||||
if [ ${unmounted2} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/temp'"
|
||||
exit 1
|
||||
fi
|
||||
unmounted3=$(df | grep -c "/mnt/storage")
|
||||
if [ ${unmounted3} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/storage'"
|
||||
exit 1
|
||||
if [ "${hdd}" == "${datadisk}" ]; then
|
||||
>&2 echo "# Make sure system drives are unmounted .."
|
||||
sudo umount /mnt/hdd 2>/dev/null
|
||||
sudo umount /mnt/temp 2>/dev/null
|
||||
sudo umount /mnt/storage 2>/dev/null
|
||||
unmounted1=$(df | grep -c "/mnt/hdd")
|
||||
if [ ${unmounted1} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/hdd'"
|
||||
exit 1
|
||||
fi
|
||||
unmounted2=$(df | grep -c "/mnt/temp")
|
||||
if [ ${unmounted2} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/temp'"
|
||||
exit 1
|
||||
fi
|
||||
unmounted3=$(df | grep -c "/mnt/storage")
|
||||
if [ ${unmounted3} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/storage'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# wipe all partitions and write fresh GPT
|
||||
@ -354,6 +364,9 @@ fi
|
||||
# formatting old: EXT4
|
||||
if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then
|
||||
|
||||
# prepare temp mount point
|
||||
sudo mkdir -p /tmp/ext4 1>/dev/null
|
||||
|
||||
# write new EXT4 partition
|
||||
>&2 echo "# Creating the one big partition"
|
||||
sudo parted /dev/${hdd} mkpart primary ext4 0% 100% 1>/dev/null 2>/dev/null
|
||||
@ -376,10 +389,10 @@ if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then
|
||||
done
|
||||
|
||||
# make sure /mnt/hdd is unmounted before formatting
|
||||
sudo umount -f /mnt/hdd 2>/dev/null
|
||||
unmounted=$(df | grep -c "/mnt/hdd")
|
||||
sudo umount -f /tmp/ext4 2>/dev/null
|
||||
unmounted=$(df | grep -c "/tmp/ext4")
|
||||
if [ ${unmounted} -gt 0 ]; then
|
||||
echo "error='failed to unmount /mnt/hdd'"
|
||||
echo "error='failed to unmount /tmp/ext4'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -402,7 +415,7 @@ if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then
|
||||
|
||||
# setting fsk check intervall to 1
|
||||
# see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572
|
||||
sudo tune2fs -c 1 /dev/sda1
|
||||
sudo tune2fs -c 1 /dev/${hdd}1
|
||||
|
||||
>&2 echo "# OK EXT 4 format done"
|
||||
exit 0
|
||||
|
@ -21,7 +21,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# add default 'lcdrotate' raspiblitz.conf if needed
|
||||
if [ ${#lcdrotate} -eq 0 ]; then
|
||||
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
|
||||
echo "lcdrotate=1" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt
|
||||
@ -42,6 +42,11 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
echo "Turn OFF: LCD ROTATE"
|
||||
|
||||
# add default 'lcdrotate' raspiblitz.conf if needed
|
||||
if [ ${#lcdrotate} -eq 0 ]; then
|
||||
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt
|
||||
sudo sed -i "s/^lcdrotate=.*/lcdrotate=0/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
|
@ -225,30 +225,38 @@ data.multiPass = '$newPassword';
|
||||
console.log(JSON.stringify(data, null, 2));
|
||||
EOF
|
||||
rm -f /home/rtl/RTL/backup-RTL-Config.json
|
||||
rm -f /home/rtl/RTL/RTL-Config.json
|
||||
mv /home/admin/RTL-Config.json /home/rtl/RTL/
|
||||
chown rtl:rtl /home/rtl/RTL/RTL-Config.json
|
||||
fi
|
||||
|
||||
# electrs
|
||||
if [ "${ElectRS}" == "on" ]; then
|
||||
echo "# changing ELECTRS password"
|
||||
echo "# changing the RPC password for ELECTRS"
|
||||
RPC_USER=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
|
||||
sed -i "s/^cookie = \"$RPC_USER.*\"/cookie = \"$RPC_USER:${newPassword}\"/g" /home/electrs/.electrs/config.toml 2>/dev/null
|
||||
fi
|
||||
|
||||
# BTC-RPC-Explorer
|
||||
if [ "${BTCRPCexplorer}" = "on" ]; then
|
||||
echo "# changing BTCRPCEXPLORER password"
|
||||
echo "# changing the RPC password for BTCRPCEXPLORER"
|
||||
sed -i "s/^BTCEXP_BITCOIND_PASS=.*/BTCEXP_BITCOIND_PASS=${newPassword}/g" /home/btcrpcexplorer/.config/btc-rpc-explorer.env 2>/dev/null
|
||||
sed -i "s/^BTCEXP_BASIC_AUTH_PASSWORD=.*/BTCEXP_BASIC_AUTH_PASSWORD=${newPassword}/g" /home/btcrpcexplorer/.config/btc-rpc-explorer.env 2>/dev/null
|
||||
fi
|
||||
|
||||
# BTCPayServer
|
||||
if [ "${BTCPayServer}" == "on" ]; then
|
||||
echo "# changing BTCPAYSERVER password"
|
||||
echo "# changing the RPC password for BTCPAYSERVER"
|
||||
sed -i "s/^btc.rpc.password=.*/btc.rpc.password=${newPassword}/g" /home/btcpay/.nbxplorer/Main/settings.config 2>/dev/null
|
||||
fi
|
||||
|
||||
# JoinMarket
|
||||
if [ "${joinmarket}" == "on" ]; then
|
||||
echo "# changing the RPC password for JOINMARKET"
|
||||
sed -i "s/^rpc_password =.*/rpc_password = ${newPassword}/g" /home/joinmarket/.joinmarket/joinmarket.cfg 2>/dev/null
|
||||
echo "# changing the password for the 'joinmarket' user"
|
||||
echo "joinmarket:${newPassword}" | sudo chpasswd
|
||||
fi
|
||||
echo "# OK -> RPC Password B changed"
|
||||
echo "# Reboot is needed"
|
||||
exit 0
|
||||
|
@ -221,7 +221,7 @@ if [ ${lndRunning} -eq 1 ]; then
|
||||
# lnd scan progress
|
||||
scanTimestamp=$(echo ${lndinfo} | jq -r '.best_header_timestamp')
|
||||
nowTimestamp=$(date +%s)
|
||||
if [ ${scanTimestamp} -gt ${nowTimestamp} ]; then
|
||||
if [ ${#scanTimestamp} -gt 0 ] && [ ${scanTimestamp} -gt ${nowTimestamp} ]; then
|
||||
scanTimestamp=${nowTimestamp}
|
||||
fi
|
||||
if [ ${#scanTimestamp} -gt 0 ]; then
|
||||
|
@ -161,7 +161,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
sudo -u btcpay git clone https://github.com/dgarage/NBXplorer.git 2>/dev/null
|
||||
cd NBXplorer
|
||||
# check https://github.com/dgarage/NBXplorer/releases
|
||||
sudo -u btcpay git reset --hard v2.1.7
|
||||
sudo -u btcpay git reset --hard v2.1.24
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj
|
||||
|
||||
@ -235,8 +235,8 @@ EOF
|
||||
echo "Downloading BTCPayServer source code.."
|
||||
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null
|
||||
cd btcpayserver
|
||||
# check https://github.com/btcpayserver/btcpayserver/releases
|
||||
sudo -u btcpay git reset --hard v1.0.3.156
|
||||
# check https://github.com/btcpayserver/btcpayserver/releases
|
||||
sudo -u btcpay git reset --hard v1.0.4.1
|
||||
# from the build.sh with path
|
||||
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj
|
||||
|
||||
|
288
home.admin/config.scripts/bonus.cryptoadvance-specter.sh
Executable file
288
home.admin/config.scripts/bonus.cryptoadvance-specter.sh
Executable file
@ -0,0 +1,288 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://github.com/cryptoadvance/specter-desktop
|
||||
# ~/.config/btc-rpc-explorer.env
|
||||
# https://github.com/janoside/btc-rpc-explorer/blob/master/.env-sample
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "small config script to switch cryptoadvance specter on or off"
|
||||
echo "bonus.cryptoadvance-specter.sh [status|on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# show info menu
|
||||
if [ "$1" = "menu" ]; then
|
||||
|
||||
# get status
|
||||
echo "# collecting status info ... (please wait)"
|
||||
source <(sudo /home/admin/config.scripts/bonus.cryptoadvance-specter.sh status)
|
||||
|
||||
# get network info
|
||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
toraddress=https://$(sudo cat /mnt/hdd/tor/cryptoadvance-specter/hostname 2>/dev/null)
|
||||
|
||||
if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then
|
||||
|
||||
# TOR
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}"
|
||||
whiptail --title " Cryptoadvance Specter " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:25441
|
||||
You have to accept the self-signed-certificate.
|
||||
Login with the Pin being Password B. If you have connected to a different Bitcoin RPC Endpoint, the Pin is the configured RPCPassword.
|
||||
Hidden Service address for TOR Browser (QR see LCD):
|
||||
${toraddress}\n
|
||||
" 16 70
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
else
|
||||
|
||||
# IP + Domain
|
||||
whiptail --title " Cryptoadvance Specter " --msgbox "Open the following URL in your local web browser:
|
||||
https://${localip}:25441
|
||||
You have to accept the self-signed-certificate.
|
||||
Login with the Pin being Password B. If you have connected to a different Bitcoin RPC Endpoint, the Pin is the configured RPCPassword.\n
|
||||
Activate TOR to access the web block explorer from outside your local network.
|
||||
Unfortunately the camera is currently not usable via Tor, though.
|
||||
" 12 54
|
||||
fi
|
||||
|
||||
echo "please wait ..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# add default value to raspi config if needed
|
||||
if ! grep -Eq "^specter=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "specter=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
# status
|
||||
if [ "$1" = "status" ]; then
|
||||
|
||||
if [ "${specter}" = "on" ]; then
|
||||
echo "configured=1"
|
||||
|
||||
# check for error
|
||||
isDead=$(sudo systemctl status cryptoadvance-specter | grep -c 'inactive (dead)')
|
||||
if [ ${isDead} -eq 1 ]; then
|
||||
echo "error='Service Failed'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "configured=0"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# stop service
|
||||
echo "making sure services are not running"
|
||||
sudo systemctl stop cryptoadvance-specter 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL Cryptoadvance Specter ***"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/cryptoadvance-specter.service 2>/dev/null | grep -c 'cryptoadvance-specter.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
|
||||
echo "*** Enable wallets in Bitcoin Core ***"
|
||||
sudo sed -i "s/^disablewallet=.*/disablewallet=0/g" /home/bitcoin/.bitcoin/bitcoin.conf
|
||||
sudo service bitcoind stop
|
||||
sudo service bitcoind start
|
||||
|
||||
echo "*** Installing prerequisites ***"
|
||||
sudo apt install -y libusb-1.0.0-dev libudev-dev virtualenv libssl-dev
|
||||
|
||||
# activating Authentication here ...
|
||||
echo "*** creating App-config ***"
|
||||
cat > /home/admin/config.json <<EOF
|
||||
{
|
||||
"auth":"rpcpasswordaspin"
|
||||
}
|
||||
EOF
|
||||
sudo mkdir -p /home/bitcoin/.specter
|
||||
sudo mv /home/admin/config.json /home/bitcoin/.specter/config.json
|
||||
sudo chown -R bitcoin:bitcoin /home/bitcoin/.specter
|
||||
|
||||
echo "*** creating a virtualenv ***"
|
||||
sudo -u bitcoin virtualenv --python=python3 /home/bitcoin/.specter/.env
|
||||
|
||||
echo "*** installing specter ***"
|
||||
sudo -u bitcoin /home/bitcoin/.specter/.env/bin/python3 -m pip install --upgrade cryptoadvance.specter
|
||||
|
||||
|
||||
# Creating self-signed-certificate
|
||||
# Mandatory as the camera doesn't work without https
|
||||
echo "*** Creating self-signed certificate ***"
|
||||
openssl req -x509 -newkey rsa:4096 -nodes -out /tmp/cert.pem -keyout /tmp/key.pem -days 365 -subj "/C=US/ST=Nooneknows/L=Springfield/O=Dis/CN=www.fakeurl.com"
|
||||
sudo mv /tmp/cert.pem /home/bitcoin/.specter
|
||||
sudo chown -R bitcoin:bitcoin /home/bitcoin/.specter/cert.pem
|
||||
sudo mv /tmp/key.pem /home/bitcoin/.specter
|
||||
sudo chown -R bitcoin:bitcoin /home/bitcoin/.specter/key.pem
|
||||
|
||||
# open firewall
|
||||
echo "*** Updating Firewall ***"
|
||||
sudo ufw allow 25441 comment 'cryptoadvance-specter'
|
||||
sudo ufw --force enable
|
||||
echo ""
|
||||
|
||||
echo "*** Installing udev-rules for hardware-wallets ***"
|
||||
cat > /home/admin/20-hw1.rules <<EOF
|
||||
HW.1 / Nano
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1b7c|2b7c|3b7c|4b7c", TAG+="uaccess", TAG+="udev-acl"
|
||||
# Blue
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0000|0000|0001|0002|0003|0004|0005|0006|0007|0008|0009|000a|000b|000c|000d|000e|000f|0010|0011|0012|0013|0014|0015|0016|0017|0018|0019|001a|001b|001c|001d|001e|001f", TAG+="uaccess", TAG+="udev-acl"
|
||||
# Nano S
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001|1000|1001|1002|1003|1004|1005|1006|1007|1008|1009|100a|100b|100c|100d|100e|100f|1010|1011|1012|1013|1014|1015|1016|1017|1018|1019|101a|101b|101c|101d|101e|101f", TAG+="uaccess", TAG+="udev-acl"
|
||||
# Aramis
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0002|2000|2001|2002|2003|2004|2005|2006|2007|2008|2009|200a|200b|200c|200d|200e|200f|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|201a|201b|201c|201d|201e|201f", TAG+="uaccess", TAG+="udev-acl"
|
||||
# HW2
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0003|3000|3001|3002|3003|3004|3005|3006|3007|3008|3009|300a|300b|300c|300d|300e|300f|3010|3011|3012|3013|3014|3015|3016|3017|3018|3019|301a|301b|301c|301d|301e|301f", TAG+="uaccess", TAG+="udev-acl"
|
||||
# Nano X
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0004|4000|4001|4002|4003|4004|4005|4006|4007|4008|4009|400a|400b|400c|400d|400e|400f|4010|4011|4012|4013|4014|4015|4016|4017|4018|4019|401a|401b|401c|401d|401e|401f", TAG+="uaccess", TAG+="udev-acl"
|
||||
EOF
|
||||
cat > /home/admin/51-coinkite.rules <<EOF
|
||||
# Linux udev support file.
|
||||
#
|
||||
# This is a example udev file for HIDAPI devices which changes the permissions
|
||||
# to 0666 (world readable/writable) for a specific device on Linux systems.
|
||||
#
|
||||
# - Copy this file into /etc/udev/rules.d and unplug and re-plug your Coldcard.
|
||||
# - Udev does not have to be restarted.
|
||||
#
|
||||
|
||||
# probably not needed:
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666"
|
||||
|
||||
# required:
|
||||
# from <https://github.com/signal11/hidapi/blob/master/udev/99-hid.rules>
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666"
|
||||
EOF
|
||||
cat > /home/admin/51-trezor.rules <<EOF
|
||||
# Trezor: The Original Hardware Wallet
|
||||
# https://trezor.io/
|
||||
#
|
||||
# Put this file into /etc/udev/rules.d
|
||||
#
|
||||
# If you are creating a distribution package,
|
||||
# put this into /usr/lib/udev/rules.d or /lib/udev/rules.d
|
||||
# depending on your distribution
|
||||
|
||||
# Trezor
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
|
||||
|
||||
# Trezor v2
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c0", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
|
||||
EOF
|
||||
cat > /home/admin/51-usb-keepkey.rules <<EOF
|
||||
# KeepKey: Your Private Bitcoin Vault
|
||||
# http://www.keepkey.com/
|
||||
# Put this file into /usr/lib/udev/rules.d or /etc/udev/rules.d
|
||||
|
||||
# KeepKey HID Firmware/Bootloader
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n"
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
|
||||
|
||||
# KeepKey WebUSB Firmware/Bootloader
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n"
|
||||
KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
|
||||
EOF
|
||||
|
||||
sudo mv /home/admin/20-hw1.rules /home/admin/51-coinkite.rules /home/admin/51-trezor.rules /home/admin/51-usb-keepkey.rules /etc/udev/rules.d/
|
||||
sudo chown root:root /etc/udev/rules.d/*
|
||||
sudo udevadm trigger
|
||||
sudo udevadm control --reload-rules
|
||||
sudo groupadd plugdev
|
||||
sudo usermod -aG plugdev bitcoin
|
||||
|
||||
# install service
|
||||
echo "*** Install cryptoadvance-specter systemd service ***"
|
||||
cat > /home/admin/cryptoadvance-specter.service <<EOF
|
||||
# systemd unit for Cryptoadvance Specter
|
||||
|
||||
[Unit]
|
||||
Description=cryptoadvance-specter
|
||||
Wants=${network}d.service
|
||||
After=${network}d.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/bitcoin/.specter/.env/bin/python3 -m cryptoadvance.specter server --host 0.0.0.0 --cert=/home/bitcoin/.specter/cert.pem --key=/home/bitcoin/.specter/key.pem
|
||||
User=bitcoin
|
||||
Environment=PATH=/home/bitcoin/.specter/.env/bin:/home/bitcoin/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/bin
|
||||
Restart=always
|
||||
TimeoutSec=120
|
||||
RestartSec=30
|
||||
StandardOutput=null
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo mv /home/admin/cryptoadvance-specter.service /etc/systemd/system/cryptoadvance-specter.service
|
||||
sudo systemctl enable cryptoadvance-specter
|
||||
sudo systemctl start cryptoadvance-specter
|
||||
|
||||
echo "OK - the cryptoadvance-specter service is now enabled and started"
|
||||
else
|
||||
echo "cryptoadvance-specter already installed."
|
||||
fi
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^specter=.*/specter=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
## Enable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active
|
||||
# see /home/admin/config.scripts/bonus.electrsexplorer.sh
|
||||
# run every 10 min by _background.sh
|
||||
|
||||
# Hidden Service for BTC-RPC-explorer if Tor is active
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
if [ "${runBehindTor}" = "on" ]; then
|
||||
# correct old Hidden Service with port
|
||||
sudo sed -i "s/^HiddenServicePort 25441 127.0.0.1:25441/HiddenServicePort 80 127.0.0.1:25441/g" /etc/tor/torrc
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh cryptoadvance-specter 80 25441
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch off
|
||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^specter=.*/specter=off/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/cryptoadvance-specter.service 2>/dev/null | grep -c 'cryptoadvance-specter.service')
|
||||
if [ ${isInstalled} -eq 1 ]; then
|
||||
echo "*** REMOVING Cryptoadvance Specter ***"
|
||||
sudo systemctl stop cryptoadvance-specter
|
||||
sudo systemctl disable cryptoadvance-specter
|
||||
sudo rm /etc/systemd/system/cryptoadvance-specter.service
|
||||
|
||||
if whiptail --defaultno --yesno "Do you want to delete all Data related to specter? This includes also Bitcoin-Core-Wallets managed by specter?" 0 0; then
|
||||
echo "*** Removing wallets in core ***"
|
||||
bitcoin-cli listwallets | jq -r .[] | tail -n +2
|
||||
for i in $(bitcoin-cli listwallets | jq -r .[] | tail -n +2)
|
||||
do
|
||||
name=$(echo $i | cut -d"/" -f2)
|
||||
bitcoin-cli unloadwallet specter/$name
|
||||
done
|
||||
sudo rm -rf /home/bitcoin/.bitcoin/specter
|
||||
|
||||
echo "*** Removing /home/bitcoin/.specter ***"
|
||||
sudo rm -rf /home/bitcoin/.specter
|
||||
fi
|
||||
|
||||
echo "OK Cryptoadvance Specter removed."
|
||||
else
|
||||
echo "Cryptoadvance Specter is not installed."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Parameter $1"
|
||||
exit 1
|
@ -56,10 +56,10 @@ if [ "$1" = "status" ]; then
|
||||
echo "localTCPPortActive=${localPortRunning}"
|
||||
publicPortRunning=$(nc -z -w6 ${publicIP} 50001 2>/dev/null; echo $?)
|
||||
if [ "${publicPortRunning}" == "0" ]; then
|
||||
# OK looks good - but just means that somethingis answering on that port
|
||||
# OK looks good - but just means that something is answering on that port
|
||||
echo "publicTCPPortAnswering=1"
|
||||
else
|
||||
# no answere on that port
|
||||
# no answer on that port
|
||||
echo "publicTCPPortAnswering=0"
|
||||
fi
|
||||
echo "portHTTP='50002'"
|
||||
@ -67,10 +67,10 @@ if [ "$1" = "status" ]; then
|
||||
echo "localHTTPPortActive=${localPortRunning}"
|
||||
publicPortRunning=$(nc -z -w6 ${publicIP} 50002 2>/dev/null; echo $?)
|
||||
if [ "${publicPortRunning}" == "0" ]; then
|
||||
# OK looks good - but just means that somethingis answering on that port
|
||||
# OK looks good - but just means that something is answering on that port
|
||||
echo "publicHTTPPortAnswering=1"
|
||||
else
|
||||
# no answere on that port
|
||||
# no answer on that port
|
||||
echo "publicHTTPPortAnswering=0"
|
||||
fi
|
||||
# add TOR info
|
||||
@ -81,6 +81,9 @@ if [ "$1" = "status" ]; then
|
||||
else
|
||||
echo "TORrunning=0"
|
||||
fi
|
||||
# check Nginx
|
||||
nginxTest=$(sudo nginx -t 2>&1 | grep -c "test is successful")
|
||||
echo "nginxTest=$nginxTest"
|
||||
|
||||
else
|
||||
echo "isSynced=0"
|
||||
@ -119,6 +122,23 @@ This can take multiple hours.
|
||||
" 9 48
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ${nginxTest} -eq 0 ]; then
|
||||
dialog --title "Testing nginx.conf has failed" --msgbox "
|
||||
Nginx is in a failed state. Will attempt to fix.
|
||||
Try connecting via port 50002 or Tor again once finished.
|
||||
Check 'sudo nginx -t' for a detailed error message.
|
||||
" 9 61
|
||||
logFileMissing=$(sudo nginx -t 2>&1 | grep -c "/var/log/nginx/access.log")
|
||||
if [ ${logFileMissing} -eq 1 ]; then
|
||||
sudo mkdir /var/log/nginx
|
||||
sudo systemctl restart nginx
|
||||
fi
|
||||
/home/admin/config.scripts/internet.selfsignedcert.sh
|
||||
echo "Press ENTER to get back to main menu."
|
||||
read key
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Options (available without TOR)
|
||||
OPTIONS=( \
|
||||
@ -138,7 +158,7 @@ This can take multiple hours.
|
||||
echo "https://electrum.org"
|
||||
echo
|
||||
echo "On Network Settings > Server menu:"
|
||||
echo "- deavtivate automatic server selection"
|
||||
echo "- deactivate automatic server selection"
|
||||
echo "- as manual server set '${localIP}' & '${portHTTP}'"
|
||||
echo "- laptop and RaspiBlitz need to be within same local network"
|
||||
echo
|
||||
@ -146,11 +166,11 @@ This can take multiple hours.
|
||||
echo "electrum --oneserver --server ${localIP}:${portHTTP}:s"
|
||||
if [ ${TORrunning} -eq 1 ]; then
|
||||
echo ""
|
||||
echo "The TOR Hidden Service address for electrs is (see LCD for QR code):"
|
||||
echo "The Tor Hidden Service address for electrs is (see LCD for QR code):"
|
||||
echo "${TORaddress}"
|
||||
echo
|
||||
echo "To connect through TOR open the Tor Browser and start with the options:"
|
||||
echo "electrum --oneserver --server=$TOR_ADDRESS:50002:s --proxy socks5:127.0.0.1:9150"
|
||||
echo "electrum --oneserver --server${TORaddress}:50002:s --proxy socks5:127.0.0.1:9150"
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${TORaddress}"
|
||||
fi
|
||||
echo
|
||||
|
214
home.admin/config.scripts/bonus.joinmarket.sh
Normal file
214
home.admin/config.scripts/bonus.joinmarket.sh
Normal file
@ -0,0 +1,214 @@
|
||||
#!/bin/bash
|
||||
|
||||
# links:
|
||||
# https://github.com/JoinMarket-Org/joinmarket-clientserver#quickstart---recommended-installation-method-linux-only
|
||||
# https://github.com/openoms/bitcoin-tutorials/tree/master/joinmarket
|
||||
# https://github.com/openoms/joininbox
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "JoinMarket install script to switch JoinMarket on or off"
|
||||
echo "sudo /home/admin/config.scrips/bonus.joinmarket.sh on|off"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if sudo
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root (with sudo)"
|
||||
exit
|
||||
fi
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# add default value to raspi config if needed
|
||||
if ! grep -Eq "^joinmarket=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "joinmarket=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
# show info menu
|
||||
if [ "$1" = "menu" ]; then
|
||||
whiptail --title " JoinMarket info " --msgbox "Usage:
|
||||
https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md\n
|
||||
Start to use by logging in to the 'joinmarket' user with:
|
||||
sudo su joinmarket\n
|
||||
Can log in directly with the 'joinmarket' user via ssh.
|
||||
The user password is the PASSWORD_B.
|
||||
" 14 81
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL JOINMARKET ***"
|
||||
|
||||
# check if running Tor
|
||||
if [ ${runBehindTor} = on ]; then
|
||||
echo "OK, running behind Tor."
|
||||
else
|
||||
echo "Not running Tor"
|
||||
echo "Activate Tor from the SERVICES menu before installing JoinMarket."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure the Bitcoin Core wallet is on
|
||||
/home/admin/config.scripts/network.wallet.sh on
|
||||
|
||||
if [ ! -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ] ; then
|
||||
|
||||
echo "*** Cleaning before install ***"
|
||||
sudo userdel -rf joinmarket 2>/dev/null
|
||||
|
||||
echo "*** Add the 'joinmarket' user ***"
|
||||
adduser --disabled-password --gecos "" joinmarket
|
||||
|
||||
echo "*** setting PASSWORD_B as the password for the 'joinmarket' user ***"
|
||||
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
|
||||
echo "joinmarket:$PASSWORD_B" | sudo chpasswd
|
||||
# add to sudo group (required for installation)
|
||||
adduser joinmarket sudo
|
||||
# configure sudo for usage without password entry for the joinmarket user
|
||||
echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo
|
||||
|
||||
# make a folder for authorized keys
|
||||
sudo -u joinmarket mkdir -p /home/joinmarket/.ssh
|
||||
chmod -R 700 /home/joinmarket/.ssh
|
||||
|
||||
# install the command-line fuzzy finder (https://github.com/junegunn/fzf)
|
||||
bash -c "echo 'source /usr/share/doc/fzf/examples/key-bindings.bash' >> /home/joinmarket/.bashrc"
|
||||
|
||||
# store JoinMarket data on HDD
|
||||
mkdir /mnt/hdd/app-data/.joinmarket 2>/dev/null
|
||||
|
||||
# copy old JoinMarket data to app-data
|
||||
cp -rf /home/admin/joinmarket-clientserver/scripts/wallets /mnt/hdd/app-data/.joinmarket/ 2>/dev/null
|
||||
|
||||
chown -R joinmarket:joinmarket /mnt/hdd/app-data/.joinmarket
|
||||
ln -s /mnt/hdd/app-data/.joinmarket /home/joinmarket/ 2>/dev/null
|
||||
chown -R joinmarket:joinmarket /home/joinmarket/.joinmarket
|
||||
|
||||
# install joinmarket
|
||||
cd /home/joinmarket
|
||||
# PySide2 for armf: https://packages.debian.org/buster/python3-pyside2.qtcore
|
||||
sudo apt install -y python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets zlib1g-dev libjpeg-dev
|
||||
# from https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/INSTALL.md
|
||||
sudo apt install -y python3-dev python3-pip git build-essential automake pkg-config libtool libffi-dev libssl-dev libgmp-dev libsodium-dev
|
||||
|
||||
sudo -u joinmarket git clone https://github.com/Joinmarket-Org/joinmarket-clientserver
|
||||
cd joinmarket-clientserver
|
||||
git reset --hard v0.6.2
|
||||
|
||||
# set up jmvenv
|
||||
sudo apt install -y virtualenv
|
||||
# use the PySide2 armf package from the system
|
||||
sudo -u joinmarket virtualenv --system-site-packages -p /usr/bin/python3.7 jmvenv
|
||||
source jmvenv/bin/activate || exit 1
|
||||
pip install -r requirements/base.txt
|
||||
# https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/requirements/gui.txt
|
||||
/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c 'import PySide2'
|
||||
pip install qrcode[pil]
|
||||
pip install https://github.com/sunu/qt5reactor/archive/58410aaead2185e9917ae9cac9c50fe7b70e4a60.zip#egg=qt5reactor
|
||||
|
||||
# autostart for joinmarket
|
||||
bash -c "echo '# automatically start startup.sh for joinmarket unless' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo '# when running in a tmux session' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo 'if [ -z \"\$TMUX\" ]; then' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo ' /home/joinmarket/startup.sh' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo 'fi' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo '# always activate jmvenv with PySide2 and cd to scripts' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo '. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo '/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\"' >> /home/joinmarket/.bashrc"
|
||||
bash -c "echo 'cd /home/joinmarket/joinmarket-clientserver/scripts/' >> /home/joinmarket/.bashrc"
|
||||
|
||||
cat > /home/admin/startup.sh <<EOF
|
||||
# check for joinmarket.cfg
|
||||
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
|
||||
echo ""
|
||||
echo "Welcome to the JoinMarket command line!"
|
||||
echo ""
|
||||
echo "Notes on usage:"
|
||||
echo "https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md"
|
||||
echo ""
|
||||
echo "To return to the RaspiBlitz menu open a new a terminal window or use: exit"
|
||||
echo ""
|
||||
else
|
||||
echo "Generating the joinmarket.cfg"
|
||||
echo ""
|
||||
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate &&\
|
||||
cd /home/joinmarket/joinmarket-clientserver/scripts/
|
||||
python wallet-tool.py generate --datadir=/home/joinmarket/.joinmarket
|
||||
sudo chmod 600 /home/joinmarket/.joinmarket/joinmarket.cfg || exit 1
|
||||
echo ""
|
||||
echo "Editing the joinmarket.cfg"
|
||||
sed -i "s/^rpc_user =.*/rpc_user = raspibolt/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
PASSWORD_B=\$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
|
||||
sed -i "s/^rpc_password =.*/rpc_password = \$PASSWORD_B/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "Filled the bitcoin RPC password (PASSWORD_B)"
|
||||
#communicate with IRC servers via Tor
|
||||
sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^host = irc.hackint.org/#host = irc.hackint.org/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^#host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^socks5 = false/#socks5 = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^#socks5 = true/socks5 = true/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^#port = 6667/port = 6667/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
sed -i "s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
|
||||
echo "Edited the joinmarket.cfg to communicate over Tor only."
|
||||
echo ""
|
||||
echo "Welcome to the JoinMarket command line!"
|
||||
echo ""
|
||||
echo "Notes on usage:"
|
||||
echo "https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md"
|
||||
echo ""
|
||||
echo "To return to the RaspiBlitz menu open a new a terminal window or use: exit"
|
||||
echo ""
|
||||
fi
|
||||
EOF
|
||||
|
||||
mv /home/admin/startup.sh /home/joinmarket/startup.sh
|
||||
chown joinmarket:joinmarket /home/joinmarket/startup.sh
|
||||
chmod +x /home/joinmarket/startup.sh
|
||||
|
||||
else
|
||||
echo "JoinMarket is already installed"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ] ; then
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^joinmarket=.*/joinmarket=on/g" /mnt/hdd/raspiblitz.conf
|
||||
# starting info
|
||||
echo ""
|
||||
echo "Start to use by logging in to the 'joinmarket' user with:"
|
||||
echo "sudo su joinmarket"
|
||||
echo ""
|
||||
echo "If logging in directly via ssh the password is the PASSWORD_B"
|
||||
echo ""
|
||||
else
|
||||
echo " Failed to install JoinMarket"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
# switch off
|
||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^joinmarket=.*/joinmarket=off/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
if [ -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ] ; then
|
||||
echo "*** REMOVING JOINMARKET ***"
|
||||
sudo userdel -rf joinmarket 2>/dev/null
|
||||
echo "OK JoinMarket removed"
|
||||
else
|
||||
echo "JoinMarket is not installed."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "FAIL - Unknown Parameter $1"
|
||||
echo "may need reboot to run
|
||||
exit 1
|
@ -4,7 +4,7 @@
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "# config script to connect mobile apps with lnd connect"
|
||||
echo "# will autodetect dyndns, sshtunnel or TOR"
|
||||
echo "# bonus.lndconnect.sh [zap-ios|zap-android|zeus-ios|zeus-android|shango-ios|shango-android] [?ip|tor]"
|
||||
echo "# bonus.lndconnect.sh [zap-ios|zap-android|zeus-ios|zeus-android|shango-ios|shango-android|sendmany-android] [?ip|tor]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -57,9 +57,6 @@ supportsTOR=0
|
||||
if [ "${targetWallet}" = "zap-ios" ]; then
|
||||
connector="lndconnect"
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
# deactivated until fix: https://github.com/rootzoll/raspiblitz/issues/1001
|
||||
echo "error='no tor support'"
|
||||
exit 1
|
||||
# when ZAP runs on TOR it uses REST
|
||||
port="8080"
|
||||
extraparamter="--nocert"
|
||||
@ -93,6 +90,17 @@ elif [ "${targetWallet}" = "zeus-android" ]; then
|
||||
connector="lndconnect"
|
||||
port="8080"
|
||||
|
||||
elif [ "${targetWallet}" = "sendmany-android" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
echo "error='no tor support'"
|
||||
exit 1
|
||||
#port="8080"
|
||||
#extraparamter="--nocert"
|
||||
fi
|
||||
port="10009"
|
||||
|
||||
elif [ "${targetWallet}" = "shango-ios" ]; then
|
||||
|
||||
connector="shango"
|
||||
@ -200,11 +208,11 @@ msg=""
|
||||
if [ $(echo "${host}" | grep -c '192.168') -gt 0 ]; then
|
||||
msg="Make sure you are on the same local network.\n(WLAN same as LAN - use WIFI not cell network on phone).\n\n"
|
||||
fi
|
||||
msg="You should now see the pairing QR code on the RaspiBlitz LCD.\n\n${msg}When you start the App choose to connect to your own node.\n(DIY / Remote-Node / lndconnect)\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and <continue> or <show QR code> to see it in this window."
|
||||
msg="You should now see the pairing QR code on the RaspiBlitz LCD.\n\n${msg}When you start the App choose to connect to your own node.\n(DIY / Remote-Node / lndconnect)\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and <continue> or <console QRcode> to see it in this window."
|
||||
whiptail --backtitle "Connecting Mobile Wallet" \
|
||||
--title "Pairing by QR code" \
|
||||
--yes-button "continue" \
|
||||
--no-button "show QR code" \
|
||||
--no-button "console QRcode" \
|
||||
--yesno "${msg}" 18 65
|
||||
if [ $? -eq 1 ]; then
|
||||
# backup - show QR code on screen (not LCD)
|
||||
|
@ -41,7 +41,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
cd /home/bitcoin
|
||||
sudo -u bitcoin git clone https://github.com/lightninglabs/loop.git
|
||||
cd /home/bitcoin/loop
|
||||
sudo -u bitcoin git reset --hard v0.4.1-beta
|
||||
# https://github.com/lightninglabs/loop/releases
|
||||
sudo -u bitcoin git reset --hard v0.5.1-beta
|
||||
cd /home/bitcoin/loop/cmd
|
||||
go install ./...
|
||||
|
||||
|
@ -84,11 +84,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
sudo -u rtl rm -rf /home/rtl/RTL 2>/dev/null
|
||||
sudo -u rtl git clone https://github.com/ShahanaFarooqui/RTL.git /home/rtl/RTL
|
||||
cd /home/rtl/RTL
|
||||
sudo -u rtl git reset --hard v0.6.7
|
||||
sudo -u rtl git reset --hard v0.7.0
|
||||
# from https://github.com/Ride-The-Lightning/RTL/commits/master
|
||||
# git checkout 917feebfa4fb583360c140e817c266649307ef72
|
||||
# git fetch origin
|
||||
# git checkout feature/0.6.5
|
||||
if [ -d "/home/rtl/RTL" ]; then
|
||||
echo "OK - RTL code copy looks good"
|
||||
else
|
||||
@ -101,7 +99,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
# install
|
||||
echo "*** Run: npm install ***"
|
||||
export NG_CLI_ANALYTICS=false
|
||||
sudo -u rtl npm install --only=production
|
||||
sudo -u rtl npm install --only=prod
|
||||
cd ..
|
||||
# check if node_modules exist now
|
||||
if [ -d "/home/rtl/RTL/node_modules" ]; then
|
||||
@ -139,6 +137,7 @@ data.nodes[0].Settings.channelBackupPath = '/home/rtl/RTL-SCB-backup-$hostname'
|
||||
//Output data
|
||||
console.log(JSON.stringify(data, null, 2));
|
||||
EOF
|
||||
sudo rm -f /home/rtl/RTL/RTL-Config.json
|
||||
sudo mv /home/admin/RTL-Config.json /home/rtl/RTL/
|
||||
sudo chown rtl:rtl /home/rtl/RTL/RTL-Config.json
|
||||
echo ""
|
||||
|
@ -3,6 +3,8 @@
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "# script to upload a file to DropBox (without third party libs)"
|
||||
echo "# dropbox.upload.sh on [AUTHTOKEN]"
|
||||
echo "# dropbox.upload.sh off"
|
||||
echo "# dropbox.upload.sh upload [AUTHTOKEN] [FILEPATH]"
|
||||
echo "# dropbox.upload.sh check [AUTHTOKEN]"
|
||||
echo "# for Dropbox Setup with Authtoken, see:"
|
||||
@ -11,9 +13,47 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# get first parameter
|
||||
MODE="$1"
|
||||
if [ "${MODE}" == "check" ]; then
|
||||
if [ "${MODE}" == "on" ]; then
|
||||
|
||||
# second parameter: dropbox auth token
|
||||
authtoken="$2"
|
||||
|
||||
# get auth token from user if not given as second parameter
|
||||
if [ ${#authtoken} -eq 0 ]; then
|
||||
sudo touch /home/admin/.tmp
|
||||
sudo chmod 777 /home/admin/.tmp
|
||||
whiptail --title " Static Channel Backup on Dropbox " --inputbox "
|
||||
Follow the steps described at the following link
|
||||
to get the DropBox-Authtoken from your account:
|
||||
https://github.com/rootzoll/raspiblitz/#b-dropbox-backup-target" 11 70 2>/home/admin/.tmp
|
||||
authtoken=$(cat /home/admin/.tmp)
|
||||
shred /home/admin/.tmp
|
||||
fi
|
||||
|
||||
# quick check on authtoken
|
||||
if [ ${#authtoken} -gt 80 ]; then
|
||||
echo "err='authtoken unvalid'"
|
||||
exit
|
||||
fi
|
||||
|
||||
# set in config - that acivates the dropbox back in background process
|
||||
if [ ${#authtoken} -gt 0 ]; then
|
||||
if [ ${#dropboxBackupTarget} -eq 0 ]; then
|
||||
echo "dropboxBackupTarget='${authtoken}'" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
sudo sed -i "s/^dropboxBackupTarget=.*/dropboxBackupTarget='${authtoken}'/g" /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
elif [ "${MODE}" == "off" ]; then
|
||||
|
||||
# to turn backup off - delete the parameter from the config file
|
||||
sudo sed -i '/dropboxBackupTarget=.*/d' /mnt/hdd/raspiblitz.conf
|
||||
|
||||
elif [ "${MODE}" == "check" ]; then
|
||||
|
||||
# get needed second parameter
|
||||
DROPBOX_APITOKEN="$2"
|
||||
|
@ -47,7 +47,7 @@ if [ "${runBehindTor}" = "on" ]; then
|
||||
isHiddenService=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c $service)
|
||||
if [ ${isHiddenService} -eq 0 ]; then
|
||||
#check if the port is already forwarded
|
||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort)
|
||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c "\b127.0.0.1:$fromPort\b")
|
||||
if [ ${alreadyThere} -gt 0 ]; then
|
||||
echo "The port $fromPort is already forwarded. Check /etc/tor/torrc for the details."
|
||||
exit 1
|
||||
@ -60,7 +60,7 @@ HiddenServicePort $toPort 127.0.0.1:$fromPort" | sudo tee -a /etc/tor/torrc
|
||||
|
||||
# check and insert second port pair
|
||||
if [ ${#toPort2} -gt 0 ]; then
|
||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort2)
|
||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c "\b127.0.0.1:$fromPort2\b")
|
||||
if [ ${alreadyThere} -gt 0 ]; then
|
||||
echo "The port $fromPort2 is already forwarded. Check the /etc/tor/torrc for the details."
|
||||
else
|
||||
@ -91,7 +91,7 @@ HiddenServicePort $toPort 127.0.0.1:$fromPort" | sudo tee -a /etc/tor/torrc
|
||||
echo "$TOR_ADDRESS"
|
||||
echo "use with the port: $toPort"
|
||||
echo ""
|
||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c 127.0.0.1:$fromPort2)
|
||||
alreadyThere=$(sudo cat /etc/tor/torrc 2>/dev/null | grep -c "\b127.0.0.1:$fromPort2\b")
|
||||
if [ ${#toPort2} -gt 0 ]; then
|
||||
if [ ${alreadyThere} -eq 0 ]; then
|
||||
echo "or the port: $toPort2"
|
||||
|
@ -154,7 +154,7 @@ activateLndOverTOR()
|
||||
sudo systemctl disable lnd 2>/dev/null
|
||||
|
||||
echo "editing /etc/systemd/system/lnd.service"
|
||||
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --tor\.active --tor\.streamisolation --tor\.v3 --listen=127\.0\.0\.1\:9735/g" /etc/systemd/system/lnd.service
|
||||
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --tor\.active --tor\.streamisolation --tor\.v3 --listen=127\.0\.0\.1\:9735 \${lndExtraParameter}/g" /etc/systemd/system/lnd.service
|
||||
|
||||
echo "Enable LND again"
|
||||
sudo systemctl enable lnd
|
||||
@ -257,6 +257,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo ""
|
||||
|
||||
echo "*** Install Tor ***"
|
||||
echo "*** Installing NYX - TOR monitoring Tool ***"
|
||||
# NYX - Tor monitor tool
|
||||
# https://nyx.torproject.org/#home
|
||||
sudo apt install tor tor-arm -y
|
||||
|
||||
echo ""
|
||||
@ -335,18 +338,7 @@ EOF
|
||||
sudo rm $torrc
|
||||
sudo mv ./torrc $torrc
|
||||
sudo chmod 644 $torrc
|
||||
sudo chown -R bitcoin:bitcoin /var/run/tor/
|
||||
echo ""
|
||||
|
||||
# NYX - Tor monitor tool
|
||||
# https://nyx.torproject.org/#home
|
||||
echo "*** Installing NYX - TOR monitoring Tool ***"
|
||||
nyxInstalled=$(sudo pip list 2>/dev/null | grep 'nyx' -c)
|
||||
if [ ${nyxInstalled} -eq 0 ]; then
|
||||
sudo pip install nyx
|
||||
else
|
||||
echo "NYX already installed"
|
||||
fi
|
||||
sudo chown -R bitcoin:bitcoin /var/run/tor/ 2>/dev/null
|
||||
echo ""
|
||||
|
||||
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
|
||||
@ -409,7 +401,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
echo "*** Removing TOR from LND ***"
|
||||
sudo systemctl disable lnd
|
||||
echo "editing /etc/systemd/system/lnd.service"
|
||||
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}/g" /etc/systemd/system/lnd.service
|
||||
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort} \${lndExtraParameter}/g" /etc/systemd/system/lnd.service
|
||||
|
||||
sudo systemctl enable lnd
|
||||
echo "OK"
|
||||
|
@ -3,10 +3,12 @@
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "# script to check LND states"
|
||||
echo "# lnd.check.sh basic-setup"
|
||||
echo "# lnd.check.sh update-credentials"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# load raspiblitz conf
|
||||
source /home/admin/raspiblitz.info
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# check basic LND setup
|
||||
@ -173,6 +175,46 @@ if [ "$1" == "basic-setup" ]; then
|
||||
fi
|
||||
echo "rpcpasscorrect=${rpcpasscorrect}"
|
||||
|
||||
# enforce basic LND credentials for users
|
||||
elif [ "$1" == "update-credentials" ]; then
|
||||
|
||||
echo "# making sure LND blockchain RPC password is set correct in lnd.conf"
|
||||
source <(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep "rpcpass" | sed 's/^[a-z]*\./lnd/g')
|
||||
if [ ${#rpcpassword} -gt 0 ]; then
|
||||
sudo sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${rpcpassword}/g" /mnt/hdd/lnd/lnd.conf 2>/dev/null
|
||||
else
|
||||
echo "# WARN: could not get value 'rpcuser' from blockchain conf"
|
||||
fi
|
||||
|
||||
echo "# make sure admin user LND data dirs exist"
|
||||
sudo mkdir -p /home/admin/.lnd
|
||||
sudo mkdir -p /home/admin/.lnd/data
|
||||
sudo mkdir -p /home/admin/.lnd/data/chain
|
||||
sudo mkdir -p /home/admin/.lnd/data/chain/${network}
|
||||
sudo mkdir -p /home/admin/.lnd/data/chain/${network}/${chain}net
|
||||
|
||||
echo "# updating/cleaning admin user LND data"
|
||||
sudo rm -R /home/admin/.lnd 2>/dev/null
|
||||
sudo mkdir -p /home/admin/.lnd/data/chain/${network}/${chain}net 2>/dev/null
|
||||
sudo cp /mnt/hdd/lnd/lnd.conf /home/admin/.lnd/lnd.conf
|
||||
sudo cp /mnt/hdd/lnd/tls.cert /home/admin/.lnd/tls.cert
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon > /home/admin/.lnd/data/chain/${network}/${chain}net/admin.macaroon"
|
||||
sudo chown admin:admin -R /home/admin/.lnd
|
||||
|
||||
echo "# updating/cleaning pi user LND data (just read & invoice)"
|
||||
sudo rm -R /home/pi/.lnd 2>/dev/null
|
||||
sudo mkdir -p /home/pi/.lnd/data/chain/${network}/${chain}net/
|
||||
sudo cp /mnt/hdd/lnd/tls.cert /home/pi/.lnd/tls.cert
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/readonly.macaroon > /home/pi/.lnd/data/chain/${network}/${chain}net/readonly.macaroon"
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/invoice.macaroon > /home/pi/.lnd/data/chain/${network}/${chain}net/invoice.macaroon"
|
||||
sudo chown pi:pi -R /home/pi/.lnd
|
||||
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
echo "# updating macaroons for LNBits fresh on start"
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh write-macaroons
|
||||
sudo chown admin:admin -R /mnt/hdd/app-data/LNBits
|
||||
fi
|
||||
|
||||
else
|
||||
echo "# FAIL: parameter not known"
|
||||
fi
|
@ -1,237 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import os
|
||||
import sys
|
||||
import binascii
|
||||
import grpc
|
||||
from lndlibs import rpc_pb2 as ln
|
||||
from lndlibs import rpc_pb2_grpc as lnrpc
|
||||
from pathlib2 import Path
|
||||
|
||||
print("This is the legacy - Python2 only - version.")
|
||||
if sys.version_info > (3, 0):
|
||||
print("Can't run on Python3")
|
||||
sys.exit()
|
||||
|
||||
# display config script info
|
||||
if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "help":
|
||||
print("# ! always activate virtual env first: source /home/admin/python-env-lnd/bin/activate")
|
||||
print("# ! and run with with: python /home/admin/config.scripts/lnd.initwallet.py")
|
||||
print("# creating or recovering the LND wallet")
|
||||
print("# lnd.initwallet2.py new [walletpassword] [?seedpassword]")
|
||||
print("# lnd.initwallet2.py seed [walletpassword] [\"seeds-words-seperated-spaces\"] [?seedpassword]")
|
||||
print("# lnd.initwallet2.py scb [walletpassword] [\"seeds-words-seperated-spaces\"] [filepathSCB] [?seedpassword]")
|
||||
print("err='missing parameters'")
|
||||
sys.exit(1)
|
||||
|
||||
mode = sys.argv[1]
|
||||
|
||||
|
||||
def new(stub, wallet_password="", seed_entropy=None):
|
||||
if seed_entropy:
|
||||
# provide 16-bytes of static data to get reproducible seeds for TESTING!)
|
||||
print("WARNING: Use this for testing only!!")
|
||||
request = ln.GenSeedRequest(seed_entropy=seed_entropy)
|
||||
else:
|
||||
request = ln.GenSeedRequest()
|
||||
|
||||
try:
|
||||
response = stub.GenSeed(request)
|
||||
seed_words = response.cipher_seed_mnemonic
|
||||
seed_words_str = ', '.join(seed_words)
|
||||
print("seedwords='" + seed_words_str + "'")
|
||||
|
||||
# add a 6x4 formatted version to the output
|
||||
seed_words_6x4 = ""
|
||||
for i in range(0, len(seed_words)):
|
||||
if i % 6 == 0 and i != 0:
|
||||
seed_words_6x4 = seed_words_6x4 + "\n"
|
||||
single_word = str(i + 1) + ":" + seed_words[i]
|
||||
while len(single_word) < 12:
|
||||
single_word = single_word + " "
|
||||
seed_words_6x4 = seed_words_6x4 + single_word
|
||||
print("seedwords6x4='" + seed_words_6x4 + "'")
|
||||
|
||||
except grpc.RpcError as rpc_error_call:
|
||||
code = rpc_error_call.code()
|
||||
print >> sys.stderr, code
|
||||
details = rpc_error_call.details()
|
||||
print("err='RPCError GenSeedRequest'")
|
||||
print("errMore=\"" + details + "\"")
|
||||
sys.exit(1)
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
print >> sys.stderr, e
|
||||
print("err='GenSeedRequest'")
|
||||
sys.exit(1)
|
||||
|
||||
request = ln.InitWalletRequest(
|
||||
wallet_password=wallet_password,
|
||||
cipher_seed_mnemonic=seed_words
|
||||
)
|
||||
try:
|
||||
response = stub.InitWallet(request)
|
||||
except grpc.RpcError as rpc_error_call:
|
||||
code = rpc_error_call.code()
|
||||
print >> sys.stderr, code
|
||||
details = rpc_error_call.details()
|
||||
print("err='RPCError InitWallet'")
|
||||
print("errMore=\"" + details + "\"")
|
||||
sys.exit(1)
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
print >> sys.stderr, e
|
||||
print("err='InitWallet'")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def seed(stub, wallet_password="", seed_words="", seed_password=""):
|
||||
request = ln.InitWalletRequest(
|
||||
wallet_password=wallet_password,
|
||||
cipher_seed_mnemonic=seed_words,
|
||||
recovery_window=250,
|
||||
aezeed_passphrase=seed_password
|
||||
)
|
||||
|
||||
try:
|
||||
response = stub.InitWallet(request)
|
||||
except grpc.RpcError as rpc_error_call:
|
||||
code = rpc_error_call.code()
|
||||
print >> sys.stderr, code
|
||||
details = rpc_error_call.details()
|
||||
print("err='RPCError InitWallet'")
|
||||
print("errMore=\"" + details + "\"")
|
||||
sys.exit(1)
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
print >> sys.stderr, e
|
||||
print("err='InitWallet'")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def scb(stub, wallet_password="", seed_words="", seed_password="", file_path_scb=""):
|
||||
with open(file_path_scb, 'rb') as f:
|
||||
content = f.read()
|
||||
scb_hex_str = binascii.hexlify(content)
|
||||
print(scb_hex_str)
|
||||
|
||||
request = ln.InitWalletRequest(
|
||||
wallet_password=wallet_password,
|
||||
cipher_seed_mnemonic=seed_words,
|
||||
recovery_window=250,
|
||||
aezeed_passphrase=seed_password,
|
||||
channel_backups=scb_hex_str
|
||||
)
|
||||
|
||||
try:
|
||||
response = stub.InitWallet(request)
|
||||
except grpc.RpcError as rpc_error_call:
|
||||
code = rpc_error_call.code()
|
||||
print >> sys.stderr, code
|
||||
details = rpc_error_call.details()
|
||||
print("err='RPCError InitWallet'")
|
||||
print("errMore=\"" + details + "\"")
|
||||
sys.exit(1)
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
print >> sys.stderr, e
|
||||
print("err='InitWallet'")
|
||||
sys.exit(1)
|
||||
|
||||
print("err='TODO: implement creating from seed/scb'")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def parse_args():
|
||||
wallet_password = ""
|
||||
seed_words = ""
|
||||
seed_password = ""
|
||||
filepath_scb = ""
|
||||
|
||||
if mode == "new":
|
||||
|
||||
print("# *** CREATING NEW LND WALLET ***")
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
wallet_password = sys.argv[2]
|
||||
if len(wallet_password) < 8:
|
||||
print("err='wallet password is too short'")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("err='wallet password is too short'")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) > 3:
|
||||
seed_password = sys.argv[3]
|
||||
|
||||
elif mode == "seed" or mode == "scb":
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
wallet_password = sys.argv[2]
|
||||
if len(wallet_password) < 8:
|
||||
print("err='wallet password is too short'")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("err='not correct amount of parameter - missing wallet password'")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) > 3:
|
||||
seed_word_str = sys.argv[3]
|
||||
seed_words = seed_word_str.split(" ")
|
||||
if len(seed_words) < 24:
|
||||
print("err='not 24 seed words separated by just spaces (surrounded with \")'")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("err='not correct amount of parameter - missing seed string'")
|
||||
sys.exit(1)
|
||||
|
||||
if mode == "seed":
|
||||
|
||||
if len(sys.argv) > 4:
|
||||
seed_password = sys.argv[4]
|
||||
|
||||
elif mode == "scb":
|
||||
|
||||
if len(sys.argv) > 4:
|
||||
filepath_scb = sys.argv[4]
|
||||
scb_file = Path(filepath_scb)
|
||||
if scb_file.is_file():
|
||||
print("# OK SCB file exists")
|
||||
else:
|
||||
print("err='the given filepathSCB - file does not exists or no permission'")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("err='not correct amount of parameter - missing seed filepathSCB'")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) > 5:
|
||||
seed_password = sys.argv[4]
|
||||
|
||||
else:
|
||||
|
||||
print("err='unknown mode parameter - run without any parameters to see options'")
|
||||
sys.exit(1)
|
||||
|
||||
return wallet_password, seed_words, seed_password, filepath_scb
|
||||
|
||||
|
||||
def main():
|
||||
wallet_password, seed_words, seed_password, file_path_scb = parse_args()
|
||||
|
||||
os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'
|
||||
cert = open('/mnt/hdd/lnd/tls.cert', 'rb').read()
|
||||
ssl_creds = grpc.ssl_channel_credentials(cert)
|
||||
channel = grpc.secure_channel('localhost:10009', ssl_creds)
|
||||
stub = lnrpc.WalletUnlockerStub(channel)
|
||||
|
||||
if mode == "new":
|
||||
new(stub, wallet_password)
|
||||
|
||||
elif mode == "seed":
|
||||
seed(stub, wallet_password, seed_words, seed_password)
|
||||
|
||||
elif mode == "scb":
|
||||
scb(stub, wallet_password, seed_words, seed_password, file_path_scb)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
44
home.admin/config.scripts/lnd.keysend.sh
Normal file
44
home.admin/config.scripts/lnd.keysend.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# based on: https://github.com/rootzoll/raspiblitz/issues/1000
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "activate/deactivate LND keysend feature"
|
||||
echo "lnd.keysend.sh [on|off|status]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# note: this script is not run during provision/recovery
|
||||
# because if the lnd extra parameter is set in raspiblitz.conf,
|
||||
# it will automatically be used by the service
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
parameter=$1
|
||||
if [ "${parameter}" == "on" ]; then
|
||||
|
||||
# store to raspiblitz config (delete old line / add new)
|
||||
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
|
||||
echo "lndExtraParameter='--accept-keysend'" >> /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "# OK - keysend feature is switched ON"
|
||||
echo "# LND or RaspiBlitz needs restart"
|
||||
|
||||
elif [ "${parameter}" == "off" ]; then
|
||||
|
||||
# just remove the parameter from the config file
|
||||
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "# OK - keysend feature is switched OFF"
|
||||
echo "# LND or RaspiBlitz needs restart"
|
||||
|
||||
elif [ "${parameter}" == "status" ]; then
|
||||
|
||||
keysendOn=$(echo "${lndExtraParameter}" | grep -c 'accept-keysend')
|
||||
keysendRunning=$(sudo systemctl status lnd | grep -c 'accept-keysend')
|
||||
echo "keysendOn=${keysendOn}"
|
||||
echo "keysendRunning=${keysendRunning}"
|
||||
|
||||
else
|
||||
echo "err='unknown parameter'"
|
||||
fi
|
@ -73,10 +73,6 @@ else
|
||||
sudo sed -i "s/^lndPort=.*/lndPort=${portnumber}/g" /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
# 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}:\${lndPort}/g" /etc/systemd/system/lnd.service
|
||||
|
||||
# enable service again
|
||||
echo "enable service again"
|
||||
sudo systemctl enable lnd
|
||||
|
Loading…
x
Reference in New Issue
Block a user