Improve setup reliability and VM compatibility (#2744)

This commit is contained in:
openoms 2021-11-30 11:58:06 +00:00 committed by GitHub
parent 3a09f3a3e5
commit 3c3df62a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 158 additions and 113 deletions

View File

@ -63,7 +63,6 @@ The channels would need to be closed to use the same funds in an other node.
* https://lightning.readthedocs.io/
## Commands and aliases
* Check if the C-lightning daemon is running:
```
sudo systemctl status lightningd
@ -80,6 +79,7 @@ or with the alias: `cllog`
alias clconf='sudo nano /home/bitcoin/.lightning/config'
alias cllog='sudo tail -n 30 -f /home/bitcoin/.lightning/bitcoin/cl.log'
```
## Directories
* All data is stored on the disk in:
`/mnt/hdd/app-data/.lightningd`
@ -91,18 +91,17 @@ or with the alias: `cllog`
### Default values
* on the RaspiBlitz for mainnet
```
network=bitcoin
announce-addr=127.0.0.1:9736
log-file=cl.log
log-level=info
plugin-dir=/home/bitcoin/cln-plugins-enabled
# Tor settings
proxy=127.0.0.1:9050
bind-addr=127.0.0.1:9736
addr=statictor:127.0.0.1:9051/torport=9736
always-use-proxy=true
```
```
network=bitcoin
log-file=cl.log
log-level=info
plugin-dir=/home/bitcoin/cln-plugins-enabled
# Tor settings
proxy=127.0.0.1:9050
bind-addr=127.0.0.1:9736
addr=statictor:127.0.0.1:9051/torport=9736
always-use-proxy=true
```
### All possible config settings
* can be shown by running:
`lightningd --help`
@ -264,7 +263,8 @@ or with the alias: `cllog`
### Implemented plugins
* summary
* sparko
* clboss
* [CLBOSS](#clboss)
* [feeadjuster](#feeadjuster)
### Add a custom plugin
* Place the plugin in the `/home/bitcoin/cl-plugins-enabled` directory
@ -312,12 +312,13 @@ https://github.com/ZmnSCPxj/clboss#clboss-status
### Feeadjuster
* Install:
`config.scripts/cl-plugin.feedadjuster.sh on`
* to set the default fees in the config add:
```
fee-base=BASEFEE_IN_MILLISATS
fee-per-satoshi=PPM_FEE_IN_SATS
```
* to set the default fees add to the C-lightning `config` file:
```
fee-base=BASEFEE_IN_MILLISATS
fee-per-satoshi=PPM_FEE_IN_SATS
```
* more options for the feeadjuster to be set in the c-lightning config can be seen in the [code](https://github.com/lightningd/plugins/blob/c16c564c2c5549b8f7236815490260c49e9e9bf4/feeadjuster/feeadjuster.py#L318):
```
plugin.add_option(
@ -526,7 +527,6 @@ Will need to pay through a peer which supports the onion messages which means yo
* https://bitcoin.stackexchange.com/questions/107484/how-can-i-decode-the-feature-string-of-a-lightning-node-with-bolt-9
* Convert the hex number from `lightning-cli listpeers` to binary: https://www.binaryhexconverter.com/hex-to-binary-converter and count the position of the bits from the right.
## Testnets
* for testnet and signet there are prefixes `t` and `s` used for the aliases, daemons and their own plugin directory names.
* Testnet
@ -576,16 +576,20 @@ To display it as text:
```
sudo cat /home/bitcoin/.lightning/bitcoin/hsm_secret | xxd
```
### Channel database
* Stored on the disk and synchronised to the SDcard with the help of the bakcup plugin.
* Stored on the disk and synchronised to the SDcard with the help of the `backup` plugin.
### Recovery
* https://lightning.readthedocs.io/FAQ.html#database-corruption-channel-state-lost
* https://lightning.readthedocs.io/FAQ.html#loss
#### Recover from a cl-rescue file
* use the `REPAIR-CL` - `FILERESTORE` option in the menu for instructions to upload
#### Recover from a seed
* use the `REPAIR-CL` - `SEEDRESTORE` option in the menu for instructions to paste the seedwords to restore
#### Rescan the chain after restoring a used c-lightning wallet
* https://lightning.readthedocs.io/FAQ.html#rescanning-the-block-chain-for-lost-utxos
* Stop `lightningd`:
@ -631,7 +635,6 @@ To display it as text:
```
## Script file help list
* generate a list of the help texts on a RaspiBlitz:
```
cd /home/admin/config.scripts/

60
FAQ.md
View File

@ -24,6 +24,25 @@
- [Can I run the RaspiBlitz without a display/LCD?](#can-i-run-the-raspiblitz-without-a-displaylcd)
- [How do I find the IP address when running without a display?](#how-do-i-find-the-ip-address-when-running-without-a-display)
- [Upgrade](#upgrade)
- [Is using the prepared SD card image secure?](#is-using-the-prepared-sd-card-image-secure)
- [How to verify the SD card image after download?](#how-to-verify-the-sd-card-image-after-download)
- [What changed on every upgrade?](#what-changed-on-every-upgrade)
- [How do I upgrade my RaspiBlitz?](#how-do-i-upgrade-my-raspiblitz)
- [Why do I need to re-burn my SD card for an update?](#why-do-i-need-to-re-burn-my-sd-card-for-an-update)
- [How can I update LND or bitcoind even before the next RaspiBlitz update?](#how-can-i-update-lnd-or-bitcoind-even-before-the-next-raspiblitz-update)
- [SSH](#ssh)
- [What to do when on SSH I see "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"](#what-to-do-when-on-ssh-i-see-warning-remote-host-identification-has-changed)
- [How do I unplug/shutdown safely without SSH](#how-do-i-unplugshutdown-safely-without-ssh)
- [I cannot connect via SSH to my RaspiBlitz. What do I do?](#i-cannot-connect-via-ssh-to-my-raspiblitz-what-do-i-do)
- [How to SSH over Tor?](#how-to-ssh-over-tor)
- [How to setup port-forwarding with a SSH tunnel?](#how-to-setup-port-forwarding-with-a-ssh-tunnel)
- [How do I setup just a port-forwarding user on my public server?](#how-do-i-setup-just-a-port-forwarding-user-on-my-public-server)
- [Display](#display)
- [Can I flip the screen?](#can-i-flip-the-screen)
- [How to fix my upside down LCD after update?](#how-to-fix-my-upside-down-lcd-after-update)
- [Can I run the RaspiBlitz without a display/LCD?](#can-i-run-the-raspiblitz-without-a-displaylcd)
- [How do I find the IP address when running without a display?](#how-do-i-find-the-ip-address-when-running-without-a-display)
- [Debug](#debug)
- [I have the full blockchain on another storage. How do I copy it to the RaspiBlitz?](#i-have-the-full-blockchain-on-another-storage-how-do-i-copy-it-to-the-raspiblitz)
- [How do I generate a Debug Report?](#how-do-i-generate-a-debug-report)
@ -37,7 +56,7 @@
- [How do I move funds & channels from RaspiBlitz to LND Lightning Desktop App?](#how-do-i-move-funds--channels-from-raspiblitz-to-lnd-lightning-desktop-app)
- [How do I change the Name/Alias of my lightning node](#how-do-i-change-the-namealias-of-my-lightning-node)
- [How do I change the public port LND/Lightning node is running on?](#how-do-i-change-the-public-port-lndlightning-node-is-running-on)
- [How do I solve a "signature mismatch after caveat verification" error on LND?](#how-do-i-solve-a-signature-mismatch-after-caveat-verification-error)
- [How do I solve a "signature mismatch after caveat verification" error?](#how-do-i-solve-a-signature-mismatch-after-caveat-verification-error)
- [Why is my node not routing?](#why-is-my-node-not-routing)
- [When using Auto-Unlock, how much security do I lose?](#when-using-auto-unlock-how-much-security-do-i-lose)
- [I connected my HDD but it still says 'Connect HDD' on the display?](#i-connected-my-hdd-but-it-still-says-connect-hdd-on-the-display)
@ -57,7 +76,34 @@
- [How do I setup fresh/clean/reset and without going into recovery mode?](#how-do-i-setup-freshcleanreset-and-without-going-into-recovery-mode)
- [My blockchain data is corrupted - what can I do?](#my-blockchain-data-is-corrupted---what-can-i-do)
- [I have two RaspiBlitz in my network - can they both be public?](#i-have-two-raspiblitz-in-my-network---can-they-both-be-public)
- [How can I enforce UASP mode for my SSD controller?](#how-can-I-enforce-UASP-mode-for-my-SSD-controller)
- [How can I enforce UASP mode for my SSD controller?](#how-can-i-enforce-uasp-mode-for-my-ssd-controller)
- [Development](#development)
- [What is the process of creating a new SD card image release?](#what-is-the-process-of-creating-a-new-sd-card-image-release)
- [How can I customize my RaspiBlitz or add other software?](#how-can-i-customize-my-raspiblitz-or-add-other-software)
- [Versioning](#versioning)
- [GitHub Workflow](#github-workflow)
- [Can I run RaspiBlitz on other computers than RaspberryPi?](#can-i-run-raspiblitz-on-other-computers-than-raspberrypi)
- [How can I build an SD card from another branch?](#how-can-i-build-an-sd-card-from-another-branch)
- [How can I build an SD card from my forked GitHub Repo?](#how-can-i-build-an-sd-card-from-my-forked-github-repo)
- [How can I checkout a new branch from the RaspiBlitz repo to my forked repo?](#how-can-i-checkout-a-new-branch-from-the-raspiblitz-repo-to-my-forked-repo)
- [How can I sync a branch of my forked GitHub with my local RaspiBlitz?](#how-can-i-sync-a-branch-of-my-forked-github-with-my-local-raspiblitz)
- [How contribute a feature/change from my forked branch back to the RaspiBlitz repo?](#how-contribute-a-featurechange-from-my-forked-branch-back-to-the-raspiblitz-repo)
- [How can I help testing a Pull Request?](#how-can-i-help-testing-a-pull-request)
- [Extras](#extras)
- [How do I connect a UPS to the RaspiBlitz?](#how-do-i-connect-a-ups-to-the-raspiblitz)
- [Can I run my RaspiBlitz on Solar Energy?](#can-i-run-my-raspiblitz-on-solar-energy)
- [How to use the Let's Encrypt client](#how-to-use-the-lets-encrypt-client)
- [Let's Encrypt - HTTP-01](#lets-encrypt---http-01)
- [Let's Encrypt - DNS-01](#lets-encrypt---dns-01)
- [Let's Encrypt - eMail Address](#lets-encrypt---email-address)
- [Let's Encrypt - Installation details](#lets-encrypt---installation-details)
- [What is this mnemonic seed word list?](#what-is-this-mnemonic-seed-word-list)
- [How do I set up VNC?](#how-do-i-set-up-vnc)
- [Why use BTRFS on RaspiBlitz?](#why-use-btrfs-on-raspiblitz)
- [Storing your important Data in RAID1 with a USB Thumb Drive](#storing-your-important-data-in-raid1-with-a-usb-thumb-drive)
- [Snapshotting the Blockchain](#snapshotting-the-blockchain)
- [How do I use BTRFS on RaspiBlitz?](#how-do-i-use-btrfs-on-raspiblitz)
- [How to recover a BTRFS partition?](#how-to-recover-a-btrfs-partition)
- [Development](#development)
- [What is the process of creating a new SD card image release?](#what-is-the-process-of-creating-a-new-sd-card-image-release)
@ -274,15 +320,7 @@ useradd -g forwardings -d /home [USERNAME]
echo 'command="date" [CONTENT-OF-RASPIBLITZ-ROOT-SSH-PUBKEY]' > /etc/ssh/authorized_keys/[USERNAME]
```
The `[CONTENT-OF-RASPIBLITZ-ROOT-SSH-PUBKEY]` you get when running the `internet.sshtunnel.py` script on the RaspiBlitz (see above). Now restart the RaspiBlitz. The server should not need a restart after adding a additional forwarding user.
To check if a tunnel is running on on server check: `netstat -tulpn`
To check for any errors on RaspiBlitz after restart check logs: `sudo journalctl -f -u autossh-tunnel.service`
### How can I repair my SSH login?
If you cannot login via SSH into your RaspiBlitz your SSH RaspiBlitz certs might be corrupted. To renew and reset those do the following (since version 1.5):
As a result you should see a "good signature" message with a main fingerprint the same as you can find on the [keybase.io/rootzoll](https://keybase.io/rootzoll) that is ending on `1C73 060C 7C17 6461` the sub fingerprint should end on `A2D7 AA9D D1B5 CC56 47DA`. If that fingerprint is correct, the SD card image you downloaded is a original release RaspiBlitz.
- 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

View File

@ -279,6 +279,11 @@ elif [ -f "/usr/bin/python3.8" ]; then
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
sudo ln -s /usr/bin/python3.8 /usr/bin/python3.7
echo "python calls python3.8"
elif [ -f "/usr/bin/python3.9" ]; then
# use python 3.9 if available
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
sudo ln -s /usr/bin/python3.9 /usr/bin/python3.7
echo "python calls python3.9"
else
echo "!!! FAIL !!!"
echo "There is no tested version of python present"

View File

@ -601,6 +601,7 @@ if [ ${isMounted} -eq 0 ]; then
# if setup - run provision setup first
if [ "${setupPhase}" == "setup" ]; then
echo "Calling _provision.setup.sh for basic setup tasks .." >> $logFile
echo "Follow in a new terminal with: 'tail -f raspiblitz.provision-setup.log'" >> $logFile
sed -i "s/^message=.*/message='Provision Setup'/g" ${infoFile}
/home/admin/_provision.setup.sh
errorState=$?

View File

@ -262,7 +262,8 @@ if [ "${lightning}" == "lnd" ]; then
if [ "${seedWords}" != "" ] && [ "${staticchannelbackup}" != "" ]; then
echo "WALLET --> SEED + SCB " >> ${logFile}
sudo sed -i "s/^message=.*/message='LND Wallet (SEED & SCB)'/g" ${infoFile}
sudo sed -i "s/^message=.*/message='LND Wallet (SEED & SCB)'/g" ${infoFile}
if ! pip list | grep grpc; then sudo -H python3 -m pip install grpcio==1.38.1; fi
sudo /home/admin/config.scripts/lnd.initwallet.py scb mainnet ${passwordC} "${seedWords}" "${staticchannelbackup}" ${seedPassword}
if [ "${err}" != "" ]; then
sed -i "s/^state=.*/state=error/g" ${infoFile}
@ -278,7 +279,8 @@ if [ "${lightning}" == "lnd" ]; then
elif [ "${seedWords}" != "" ]; then
echo "WALLET --> SEED" >> ${logFile}
sudo sed -i "s/^message=.*/message='LND Wallet (SEED)'/g" ${infoFile}
sudo sed -i "s/^message=.*/message='LND Wallet (SEED)'/g" ${infoFile}
if ! pip list | grep grpc; then sudo -H python3 -m pip install grpcio==1.38.1; fi
sudo /home/admin/config.scripts/lnd.initwallet.py seed mainnet ${passwordC} "${seedWords}" ${seedPassword}
if [ "${err}" != "" ]; then
sed -i "s/^state=.*/state=error/g" ${infoFile}
@ -294,7 +296,8 @@ if [ "${lightning}" == "lnd" ]; then
else
echo "WALLET --> NEW" >> ${logFile}
sudo sed -i "s/^message=.*/message='LND Wallet (NEW)'/g" ${infoFile}
sudo sed -i "s/^message=.*/message='LND Wallet (NEW)'/g" ${infoFile}
if ! pip list | grep grpc; then sudo -H python3 -m pip install grpcio==1.38.1; fi
source <(sudo /home/admin/config.scripts/lnd.initwallet.py new mainnet ${passwordC})
if [ "${err}" != "" ]; then
sed -i "s/^state=.*/state=error/g" ${infoFile}

View File

@ -833,6 +833,7 @@ if [ "${lightning}" == "lnd" ];then
if [ "${passwordFlagExists}" == "1" ]; then
echo "Found /mnt/hdd/passwordc.flag .. changing password" >> ${logFile}
oldPasswordC=$(sudo cat /mnt/hdd/passwordc.flag)
if ! pip list | grep grpc; then sudo -H python3 -m pip install grpcio==1.38.1; fi
sudo /home/admin/config.scripts/lnd.initwallet.py change-password mainnet "${oldPasswordC}" "${passwordC}" >> ${logFile}
sudo shred -u /mnt/hdd/passwordc.flag
else

View File

@ -9,14 +9,13 @@ if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
exit 1
fi
# CHAIN is signet | testnet | mainnet
# CHAIN is mainnet | testnet | signet
CHAIN=$2
if [ "${CHAIN}" != signet ]&&[ "${CHAIN}" != testnet ]&&[ "${CHAIN}" != mainnet ];then
echo "# ${CHAIN} is not supported"
exit 1
fi
# prefix for parallel services
# prefixes for parallel services
if [ ${CHAIN} = testnet ];then
prefix="t"
bitcoinprefix="test"
@ -155,18 +154,27 @@ WantedBy=multi-user.target
sudo systemctl enable ${prefix}bitcoind
echo "# OK - the bitcoin daemon on ${CHAIN} service is now enabled"
# add aliases
if [ ${CHAIN} != mainnet ];then
if [ $(alias | grep -c ${prefix}bitcoin) -eq 0 ];then
bash -c "echo 'alias ${prefix}bitcoin-cli=\"/usr/local/bin/bitcoin-cli\
-rpcport=${rpcprefix}8332\"' \
>> /home/admin/_aliases"
bash -c "echo 'alias ${prefix}bitcoind=\"/usr/local/bin/bitcoind\
-${CHAIN}\"' \
>> /home/admin/_aliases"
fi
sudo chown admin:admin /home/admin/_aliases
echo "# Add aliases ${prefix}bitcoin-cli, ${prefix}bitcoind, ${prefix}bitcoinlog"
if [ $(alias | grep -c "alias ${prefix}bitcoin-cli") -eq 0 ];then
echo "\
alias ${prefix}bitcoin-cli=\"/usr/local/bin/bitcoin-cli\
-rpcport=${rpcprefix}8332\"
alias ${prefix}bitcoind=\"/usr/local/bin/bitcoind -${CHAIN}\"\
" | sudo tee -a /home/admin/_aliases
fi
if [ $(alias | grep -c "alias ${prefix}bitcoinlog") -eq 0 ];then
if [ ${CHAIN} = signet ]; then
bitcoinlogpath="/mnt/hdd/bitcoin/signet/debug.log"
elif [ ${CHAIN} = testnet ]; then
bitcoinlogpath="/mnt/hdd/bitcoin/testnet3/debug.log"
elif [ ${CHAIN} = mainnet ]; then
bitcoinlogpath="/mnt/hdd/bitcoin/debug.log"
fi
echo "\
alias ${prefix}bitcoinlog=\"sudo tail -n 30 -f ${bitcoinlogpath}\"\
" | sudo tee -a /home/admin/_aliases
fi
sudo chown admin:admin /home/admin/_aliases
source /home/admin/raspiblitz.info
if [ "${state}" == "ready" ]; then

View File

@ -61,7 +61,7 @@ isSwapExternal=$(swapon -s | grep -c "${externalSwapPath}")
# output and exit if just status action
if [ "$1" = "status" ]; then
# optional second parameter can be 'bitcoin' or 'litecoin'
# optional second parameter can be 'bitcoin'
blockchainType=$2
echo "# RASPIBLITZ DATA DRIVE Status"
@ -97,9 +97,9 @@ if [ "$1" = "status" ]; then
testdevice=$(echo $testname | sed 's/[^a-z]*//g')
testpartition=$(echo $testname | grep -P '[a-z]{3,5}[0-9]{1}')
if [ ${#testpartition} -gt 0 ]; then
testsize=$(echo $line | sed "s/ */ /g" | cut -d " " -f 2 | sed 's/[^0-9]*//g')
testsize=$(echo $line | sed "s/ */ /g" | cut -d " " -f 2 | sed 's/[^0-9]*//g')
else
testsize=0
testsize=0
fi
#echo "# line($line)"
@ -119,32 +119,39 @@ if [ "$1" = "status" ]; then
#echo "# bootPartition(${bootPartition})"
#echo "# hdd(${hdd})"
if [ $testpartitioncount -gt 0 ]; then
# if a partition was found - make sure to skip the OS and boot partitions
if [ "${testpartition}" != "${OSPartition}" ] && [ "${testpartition}" != "${bootPartition}" ]; then
# make sure to use the biggest
if [ ${testsize} -gt ${sizeDataPartition} ]; then
sizeDataPartition=${testsize}
hddDataPartition="${testpartition}"
hdd="${testdevice}"
fi
fi
if [ "$(uname -m)" = "x86_64" ]; then
testParentDisk=$(echo "$testpartition" | sed 's/[^a-z]*//g')
OSParentDisk=$(echo "$OSPartition" | sed 's/[^a-z]*//g')
bootParentDisk=$(echo "$bootPartition" | sed 's/[^a-z]*//g')
if [ "$testdevice" != "$OSParentDisk" ] && [ "$testdevice" != "$bootParentDisk" ];then
sizeDataPartition=${testsize}
hddDataPartition="${testpartition}"
hdd="${testdevice}"
fi
elif [ $testpartitioncount -gt 0 ]; then
# if a partition was found - make sure to skip the OS and boot partitions
if [ "${testpartition}" != "${OSPartition}" ] && [ "${testpartition}" != "${bootPartition}" ]; then
# make sure to use the biggest
if [ ${testsize} -gt ${sizeDataPartition} ]; then
sizeDataPartition=${testsize}
hddDataPartition="${testpartition}"
hdd="${testdevice}"
fi
fi
else
# default hdd set, when there is no OSpartition and there might be no partitions at all
if [ "${OSPartition}" = "root" ] && [ "${hdd}" = "" ] && [ "${testdevice}" != "" ]; then
# default hdd set, when there is no OSpartition and there might be no partitions at all
if [ "${OSPartition}" = "root" ] && [ "${hdd}" = "" ] && [ "${testdevice}" != "" ]; then
hdd="${testdevice}"
fi
# make sure to use the biggest
if [ ${testsize} -gt ${sizeDataPartition} ]; then
fi
# make sure to use the biggest
if [ ${testsize} -gt ${sizeDataPartition} ]; then
# Partition to be created is smaller than disk so this is not correct (but close)
sizeDataPartition=$(sudo fdisk -l /dev/$testdevice | grep GiB | cut -d " " -f 5)
hddDataPartition="${testdevice}1"
hdd="${testdevice}"
fi
sizeDataPartition=$(sudo fdisk -l /dev/$testdevice | grep GiB | cut -d " " -f 5)
hddDataPartition="${testdevice}1"
hdd="${testdevice}"
fi
fi
done < .lsblk.tmp
rm -f .lsblk.tmp 1>/dev/null 2>/dev/null
@ -256,12 +263,8 @@ if [ "$1" = "status" ]; then
# check for blockchain data on storage
hddBlocksBitcoin=$(sudo ls /mnt/storage${subVolumeDir}/bitcoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
echo "hddBlocksBitcoin=${hddBlocksBitcoin}"
hddBlocksLitecoin=$(sudo ls /mnt/storage${subVolumeDir}/litecoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
echo "hddBlocksLitecoin=${hddBlocksLitecoin}"
if [ "${blockchainType}" = "bitcoin" ] && [ ${hddBlocksBitcoin} -eq 1 ]; then
echo "hddGotBlockchain=1"
elif [ "${blockchainType}" = "litecoin" ] && [ ${hddBlocksLitecoin} -eq 1 ]; then
echo "hddGotBlockchain=1"
elif [ ${#blockchainType} -gt 0 ]; then
echo "hddGotBlockchain=0"
fi
@ -299,7 +302,6 @@ if [ "$1" = "status" ]; then
# if not ext4 or btrfs - there is no usable data
echo "hddRaspiData=0"
echo "hddBlocksBitcoin=0"
echo "hddBlocksLitecoin=0"
echo "hddGotBlockchain=0"
fi
fi
@ -338,12 +340,8 @@ if [ "$1" = "status" ]; then
# check if blockchain data is available
hddBlocksBitcoin=$(sudo ls /mnt/hdd/bitcoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
echo "hddBlocksBitcoin=${hddBlocksBitcoin}"
hddBlocksLitecoin=$(sudo ls /mnt/hdd/litecoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
echo "hddBlocksLitecoin=${hddBlocksLitecoin}"
if [ "${blockchainType}" = "bitcoin" ] && [ ${hddBlocksBitcoin} -eq 1 ]; then
echo "hddGotBlockchain=1"
elif [ "${blockchainType}" = "litecoin" ] && [ ${hddBlocksLitecoin} -eq 1 ]; then
echo "hddGotBlockchain=1"
elif [ ${#blockchainType} -gt 0 ]; then
echo "hddGotBlockchain=0"
fi
@ -362,7 +360,7 @@ if [ "$1" = "status" ]; then
hdd_data_free1Kblocks=$(df -h -k /dev/${hddDataPartitionExt4} | grep "/dev/${hddDataPartitionExt4}" | sed -e's/ */ /g' | cut -d" " -f 4 | tr -dc '0-9')
hddUsedInfo="${hdd_used_space} (${hdd_used_ratio}%)"
else
# BRTS calculations
# BTRFS calculations
# TODO: this is the final/correct way - make better later
# https://askubuntu.com/questions/170044/btrfs-and-missing-free-space
datadrive=$(df -h | grep "/dev/${hdd}1" | sed -e's/ */ /g' | cut -d" " -f 5)
@ -1345,12 +1343,6 @@ if [ "$1" = "link" ]; then
else
sudo rm /home/bitcoin/.bitcoin 2>/dev/null
fi
if [ $(sudo ls -la /home/bitcoin/ | grep -c "litecoin ->") -eq 0 ]; then
>&2 echo "# - /home/bitcoin/.litecoin -> is not a link, cleaning"
sudo rm -r /home/bitcoin/.litecoin 2>/dev/null
else
sudo rm /home/bitcoin/.litecoin 2>/dev/null
fi
# make sure common base directory exits
sudo mkdir -p /mnt/hdd/lnd
@ -1368,14 +1360,6 @@ if [ "$1" = "link" ]; then
sudo ln -s /mnt/storage/bitcoin /mnt/hdd/bitcoin
sudo rm /mnt/storage/bitcoin/bitcoin 2>/dev/null
fi
if [ $(ls -F /mnt/hdd/litecoin | grep -c '/mnt/hdd/litecoin@') -eq 0 ]; then
sudo mkdir -p /mnt/storage/litecoin
sudo cp -R /mnt/hdd/litecoin/* /mnt/storage/litecoin 2>/dev/null
sudo chown -R bitcoin:bitcoin /mnt/storage/litecoin
sudo rm -r /mnt/hdd/litecoin
sudo ln -s /mnt/storage/litecoin /mnt/hdd/litecoin
sudo rm /mnt/storage/litecoin/litecoin 2>/dev/null
fi
>&2 echo "# linking lnd for user bitcoin"
sudo rm /home/bitcoin/.lnd 2>/dev/null
@ -1383,7 +1367,6 @@ if [ "$1" = "link" ]; then
>&2 echo "# - linking blockchain for user bitcoin"
sudo ln -s /mnt/storage/bitcoin /home/bitcoin/.bitcoin
sudo ln -s /mnt/storage/litecoin /home/bitcoin/.litecoin
>&2 echo "# - linking storage into /mnt/hdd"
sudo mkdir -p /mnt/storage/app-storage
@ -1405,15 +1388,11 @@ if [ "$1" = "link" ]; then
>&2 echo "# opening blockchain into /mnt/hdd"
sudo mkdir -p /mnt/hdd/bitcoin
sudo mkdir -p /mnt/hdd/litecoin
>&2 echo "# linking blockchain for user bitcoin"
sudo rm /home/bitcoin/.bitcoin 2>/dev/null
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin
sudo rm /home/bitcoin/.litecoin 2>/dev/null
sudo ln -s /mnt/hdd/litecoin /home/bitcoin/.litecoin
>&2 echo "# linking lnd for user bitcoin"
sudo rm /home/bitcoin/.lnd 2>/dev/null
sudo ln -s /mnt/hdd/lnd /home/bitcoin/.lnd
@ -1426,10 +1405,8 @@ if [ "$1" = "link" ]; then
# fix ownership of linked files
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin
sudo chown -R bitcoin:bitcoin /mnt/hdd/litecoin
sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd
sudo chown -R bitcoin:bitcoin /home/bitcoin/.lnd
sudo chown -R bitcoin:bitcoin /home/bitcoin/.litecoin
sudo chown -R bitcoin:bitcoin /home/bitcoin/.bitcoin
sudo chown -R bitcoin:bitcoin /mnt/hdd/app-storage
sudo chown -R bitcoin:bitcoin /mnt/hdd/app-data
@ -1585,7 +1562,7 @@ if [ "$1" = "clean" ]; then
# deactivate delete if a blockchain directory (if -keepblockchain)
if [ "$3" = "-keepblockchain" ]; then
if [ "${entry}" = "bitcoin" ] || [ "${entry}" = "litecoin" ]; then
if [ "${entry}" = "bitcoin" ]; then
delete=0
fi
fi
@ -1594,7 +1571,7 @@ if [ "$1" = "clean" ]; then
if [ "${entry}" = "torrent" ] || [ "${entry}" = "app-storage" ]; then
whenDeleteSchredd=0
fi
if [ "${entry}" = "bitcoin" ] || [ "${entry}" = "litecoin" ]; then
if [ "${entry}" = "bitcoin" ]; then
whenDeleteSchredd=0
fi
# if BTRFS just shred stuff in /mnt/hdd/temp (because thats EXT4)
@ -1636,7 +1613,7 @@ if [ "$1" = "clean" ]; then
# KEEP BLOCKCHAIN means just blocks & chainstate - delete the rest
if [ "$3" = "-keepblockchain" ]; then
chains=(bitcoin litecoin)
chains=(bitcoin)
for chain in "${chains[@]}"
do
echo "Cleaning Blockchain: ${chain}"
@ -1717,8 +1694,6 @@ if [ "$1" = "clean" ]; then
# deleting the blocks and chainstate
sudo rm -R ${basePath}/bitcoin/blocks 1>/dev/null 2>/dev/null
sudo rm -R ${basePath}/bitcoin/chainstate 1>/dev/null 2>/dev/null
sudo rm -R ${basePath}/litecoin/blocks 1>/dev/null 2>/dev/null
sudo rm -R ${basePath}/litecoin/chainstate 1>/dev/null 2>/dev/null
>&2 echo "# OK cleaning done."
exit 1

View File

@ -371,6 +371,7 @@ elif [ "${abcd}" = "c" ]; then
sleep 2
err=""
if ! pip list | grep grpc; then sudo -H python3 -m pip install grpcio==1.38.1; fi
source <(sudo /home/admin/config.scripts/lnd.initwallet.py change-password mainnet $oldPassword $newPassword)
if [ "${err}" != "" ]; then
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Was not able to change password\n\n${err}\n${errMore}" 10 52

View File

@ -135,7 +135,7 @@ bitcoin.node=bitcoind
echo "# Create /etc/systemd/system/.lnd.service"
echo "
[Unit]
Description=LND on $NETWORK
Description=LND on $CHAIN
[Service]
User=bitcoin
@ -167,11 +167,18 @@ WantedBy=multi-user.target
fi
echo
echo "# Adding aliases"
echo "\
echo "# Add aliases ${netprefix}lncli, ${netprefix}lndlog"
if [ $(alias | grep -c "alias ${netprefix}lncli") -eq 0 ];then
echo "\
alias ${netprefix}lncli=\"sudo -u bitcoin /usr/local/bin/lncli\
-n=${CHAIN} --rpcserver localhost:1${rpcportmod}009\"\
" | sudo tee -a /home/admin/_aliases
fi
if [ $(alias | grep -c "alias ${netprefix}lndlog") -eq 0 ];then
echo "\
alias ${netprefix}lndlog=\"sudo tail -n 30 -f /mnt/hdd/lnd/logs/${network}/${CHAIN}/lnd.log\"\
" | sudo tee -a /home/admin/_aliases
fi
# if parameter "initwallet" was set and wallet does not exist yet
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${CHAIN}/wallet.db 2>/dev/null | grep -c "wallet.db")
@ -185,6 +192,7 @@ alias ${netprefix}lncli=\"sudo -u bitcoin /usr/local/bin/lncli\
else
passwordC="raspiblitz"
fi
if ! pip list | grep grpc; then sudo -H python3 -m pip install grpcio==1.38.1; fi
source <(sudo /home/admin/config.scripts/lnd.initwallet.py new ${CHAIN} ${passwordC})
if [ "${err}" != "" ]; then
clear

View File

@ -7,7 +7,9 @@ To generate the lnd RPC libs - login as admin and run:
```
cd
sudo python3 -m pip install grpcio grpcio-tools googleapis-common-protos pathlib2
rm -rf googleapis
git clone https://github.com/googleapis/googleapis.git
rm -rf protobuffs
mkdir protobuffs
curl -o ./rpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.proto
curl -o ./walletunlocker.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/walletunlocker.proto