mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-18 18:07:45 +01:00
copy sync blockchain from other client support
This commit is contained in:
13
FAQ.md
13
FAQ.md
@@ -32,6 +32,18 @@ Of course people should modify the system, add own scripts, etc ... but if you w
|
|||||||
|
|
||||||
BTW there is a beneficial side effect, when updating with a new SD card: You also get rid of any maleware or system bloat that happend in the past. You start with a fresh system :)
|
BTW there is a beneficial side effect, when updating with a new SD card: You also get rid of any maleware or system bloat that happend in the past. You start with a fresh system :)
|
||||||
|
|
||||||
|
## I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?
|
||||||
|
|
||||||
|
Copying a already synced blockchain from another computer (for example your Laptop) can be a quick way to get the RaspiBlitz started. Also that way you synced and verified the blockchain yourself and not trusting the RaspiBlitz FTP/Torrent downloads (dont trust, verify).
|
||||||
|
|
||||||
|
One requirement is that the blockchain is from another bitcoin-core client with version greater or equal to 0.17.1 with transaction index switched on (`txindex=1` in the `bitcoin.conf`).
|
||||||
|
|
||||||
|
But we dont copy the data via USB to the device, because the HDD needs to be formatted in EXT4 and that is usually not read/writeable by Windows or Mac computers. So I will explain a way to copy the data thru your local network. This should work from Windows, Mac, Linux and even from another already synced RaspiBlitz.
|
||||||
|
|
||||||
|
Both computers (your RaspberryPi and the other computer with the full blockchain on) need to be connected to the same local network. Start the setup of the RaspiBlitz with a fresh SD card like explained in the README - its OK that there is no blockchain data on your HDD. At the point of the Setup about `Getting the Blockchain` choose the COPY option. Starting from version 1.0 of the RaspiBlitz this will give you further detailed instructions how to transfere the blockchain data onto your RaspiBlitz. In short: On your computer with the blockchain data you will execute SCP commands, that will copy the data over to your RaspiBlitz.
|
||||||
|
|
||||||
|
Once you finsihed the transfere the Raspiblitz will make a quick check - but beware that if there is an error during transfere it can result that yo
|
||||||
|
|
||||||
## How to backup my Lightning Node?
|
## How to backup my Lightning Node?
|
||||||
|
|
||||||
CAUTION: Restoring a backup can lead to LOSS OF ALL CHANNEL FUNDS if its not the latest channel state. There is no perfect backup solution for lightning nodes yet - this topic is in development by the community.
|
CAUTION: Restoring a backup can lead to LOSS OF ALL CHANNEL FUNDS if its not the latest channel state. There is no perfect backup solution for lightning nodes yet - this topic is in development by the community.
|
||||||
@@ -44,7 +56,6 @@ To really have a good backup to rely on such feature needs to be part of the LND
|
|||||||
|
|
||||||
But you can try to backup at your own risk. All your Lightning Node data is within the `/mnt/hdd/lnd` directory. Just run a backup of that data when the lnd service is stopped.
|
But you can try to backup at your own risk. All your Lightning Node data is within the `/mnt/hdd/lnd` directory. Just run a backup of that data when the lnd service is stopped.
|
||||||
|
|
||||||
|
|
||||||
## How do I change the Name/Alias of my lightning node
|
## How do I change the Name/Alias of my lightning node
|
||||||
|
|
||||||
Use the "Change Name/Alias of Node" option in main menu. The RaspiBlitz will make a reboot after this.
|
Use the "Change Name/Alias of Node" option in main menu. The RaspiBlitz will make a reboot after this.
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ if [ ${mountOK} -eq 1 ]; then
|
|||||||
echo "Bitcoin Options"
|
echo "Bitcoin Options"
|
||||||
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \
|
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title "Getting the Blockchain" \
|
||||||
--menu "You need a copy of the Bitcoin Blockchain - you have 3 options:" 13 75 4 \
|
--menu "You need a copy of the Bitcoin Blockchain - you have 3 options:" 13 75 4 \
|
||||||
T "TORRENT --> TESTNET + MAINNET thru Torrent (DEFAULT)" \
|
T "TORRENT --> MAINNET + TESTNET thru Torrent (DEFAULT)" \
|
||||||
D "DOWNLOAD --> TESTNET + MAINNET per FTP (FALLBACK)" \
|
D "DOWNLOAD --> MAINNET + TESTNET per FTP (FALLBACK)" \
|
||||||
C "COPY --> TESTNET + MAINNET from another HDD (TRICKY+FAST)" \
|
C "COPY --> USE BLOCKCHAINDATA from another computer" \
|
||||||
S "SYNC --> JUST TESTNET thru Bitoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty)
|
S "SYNC --> JUST TESTNET thru Bitoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
# Litecoin
|
# Litecoin
|
||||||
@@ -173,7 +173,6 @@ if [ ${mountOK} -eq 1 ]; then
|
|||||||
--menu "You need a copy of the Litecoin Blockchain - you have 3 options:" 13 75 4 \
|
--menu "You need a copy of the Litecoin Blockchain - you have 3 options:" 13 75 4 \
|
||||||
T "TORRENT --> MAINNET thru Torrent (DEFAULT)" \
|
T "TORRENT --> MAINNET thru Torrent (DEFAULT)" \
|
||||||
D "DOWNLOAD --> MAINNET per FTP (FALLBACK)" \
|
D "DOWNLOAD --> MAINNET per FTP (FALLBACK)" \
|
||||||
C "COPY --> MAINNET from another HDD (TRICKY+FAST)" \
|
|
||||||
S "SYNC --> MAINNET thru Litecoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty)
|
S "SYNC --> MAINNET thru Litecoin Network (FALLBACK+SLOW)" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
# error
|
# error
|
||||||
|
|||||||
@@ -3,98 +3,100 @@
|
|||||||
## get basic info
|
## get basic info
|
||||||
source /home/admin/raspiblitz.info 2>/dev/null
|
source /home/admin/raspiblitz.info 2>/dev/null
|
||||||
|
|
||||||
echo ""
|
# get local ip
|
||||||
echo "*** Check 1st HDD ***"
|
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
sleep 4
|
|
||||||
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
|
# create bitcoin base directory and link with bitcoin user
|
||||||
if [ ${hddA} -eq 0 ]; then
|
sudo mkdir /mnt/hdd/bitcoin
|
||||||
echo "FAIL - 1st HDD not found as sda1"
|
sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin
|
||||||
echo "Try 'sudo shutdown -r now'"
|
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK - HDD as sda1 found"
|
|
||||||
echo ""
|
|
||||||
echo "*** Copy Blockchain form a second HDD ***"
|
|
||||||
echo ""
|
|
||||||
echo "WARNING: The RaspiBlitz cannot run 2 HDDs without extra Power!"
|
|
||||||
echo ""
|
|
||||||
echo "You can use a Y cable for the second HDD to inject extra power."
|
|
||||||
echo "Like this one: https://www.amazon.de/dp/B00ZJBIHVY"
|
|
||||||
echo "If you see on LCD a error on connecting the 2nd HDD do a restart."
|
|
||||||
echo ""
|
|
||||||
echo "You can use the HDD of another RaspiBlitz for this."
|
|
||||||
echo "The 2nd HDD needs to be formated Ext4/exFAT and the folder '${network}' is in root of 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
|
|
||||||
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
|
|
||||||
if [ ${hddA} -eq 0 ]; then
|
|
||||||
echo "FAIL - connection to 1st HDD lost"
|
|
||||||
echo "It seems there was a POWEROUTAGE while connecting the 2nd HDD."
|
|
||||||
echo "Try to avoid this next time by adding extra Power or connect more securely."
|
|
||||||
echo "You need now to reboot with 'sudo shutdown -r now' and then try again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
hddB=$(lsblk | grep -c sdb1)
|
|
||||||
if [ ${hddB} -eq 1 ]; then
|
|
||||||
echo "OK - 2nd HDD found"
|
|
||||||
ready=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** Mounting 2nd HDD ***"
|
echo "*** Instructions to COPY BLOCKCHAIN from another computer (only MAINNET) ***"
|
||||||
sudo mkdir /mnt/genesis
|
echo ""
|
||||||
echo "try ext4 .."
|
echo "You can use the blockchain from another bitcoin-core client with version greater or equal"
|
||||||
sudo mount -t ext4 /dev/sdb1 /mnt/genesis
|
echo "to 0.17.1 with transaction index switched on (`txindex=1` in the `bitcoin.conf`)."
|
||||||
sleep 2
|
echo ""
|
||||||
mountOK=$(lsblk | grep -c /mnt/genesis)
|
echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need"
|
||||||
if [ ${mountOK} -eq 0 ]; then
|
echo "to be connected to the same local network."
|
||||||
echo "try exfat .."
|
echo ""
|
||||||
sudo mount -t exfat /dev/sdb1 /mnt/genesis
|
echo "Open a terminal on the other computer and change into the directory that constains the"
|
||||||
sleep 2
|
echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'indexes'".
|
||||||
|
echo "Make sure the bitcoin client on that computer is stopped."
|
||||||
|
echo ""
|
||||||
|
echo "Copy, Paste and Execute the following commands - line by line:"
|
||||||
|
echo "scp -R ./blocks bitcoin@${localip}:/home/bitcoin/.bitcoin/blocks"
|
||||||
|
echo "scp -R ./chainstate bitcoin@${localip}:/home/bitcoin/.bitcoin/chainstate"
|
||||||
|
echo "scp -R ./indexes bitcoin@${localip}:/home/bitcoin/.bitcoin/indexes"
|
||||||
|
echo ""
|
||||||
|
echo "Every command above needs your SSH PASSWORD A to work and will take some time to transfer."
|
||||||
|
echo "PRESS ENTER if all 3 transfers are done or if you dont care and you want to return to menu."
|
||||||
|
read key
|
||||||
|
|
||||||
|
# unlink bitcoin user (will created later in setup again)
|
||||||
|
sudo unlink /home/bitcoin/.bitcoin
|
||||||
|
|
||||||
|
# make quick check if data is there
|
||||||
|
anyDataAtAll=0
|
||||||
|
quickCheckOK=1
|
||||||
|
count=$(sudo ls /mnt/hdd/bitcoin/blocks | grep -c '.dat')
|
||||||
|
if [ ${count} -gt 0 ]; then
|
||||||
|
echo "Found data in /mnt/hdd/bitcoin/blocks"
|
||||||
|
anyDataAtAll=1
|
||||||
|
if
|
||||||
|
if [ ${count} -lt 3000 ]; then
|
||||||
|
echo "FAIL: transfere seems invalid - less then 3000 .dat files (${count})"
|
||||||
|
quickCheckOK=0
|
||||||
fi
|
fi
|
||||||
mountOK=$(lsblk | grep -c /mnt/genesis)
|
count=$(sudo ls /mnt/hdd/bitcoin/chainstate | grep -c '.ldb')
|
||||||
if [ ${mountOK} -eq 0 ]; then
|
if [ ${count} -gt 0 ]; then
|
||||||
echo "FAIL - not able to mount the 2nd HDD"
|
echo "Found data in /mnt/hdd/bitcoin/chainstate"
|
||||||
echo "only ext4 and exfat possible"
|
anyDataAtAll=1
|
||||||
sleep 4
|
fi
|
||||||
./10setupBlitz.sh
|
fi [ ${count} -lt 1400 ]; then
|
||||||
exit 1
|
echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})"
|
||||||
|
quickCheckOK=0
|
||||||
|
fi
|
||||||
|
count=$(sudo ls /mnt/hdd/bitcoin/indexes/txindex | grep -c '.ldb')
|
||||||
|
if [ ${count} -gt 0 ]; then
|
||||||
|
echo "Found data in /mnt/hdd/bitcoin/indexes/txindex"
|
||||||
|
anyDataAtAll=1
|
||||||
|
fi
|
||||||
|
if [ ${count} -lt 5200 ]; then
|
||||||
|
echo "FAIL: less then 5200 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)"
|
||||||
|
quickCheckOK=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# just if any data transferred ..
|
||||||
|
if [ ${anyDataAtAll} -eq 1 ]; then
|
||||||
|
|
||||||
|
# data was invalkid - ask user to keep?
|
||||||
|
if [ ${quickCheckOK} -eq 0 ]; then
|
||||||
|
echo "*********************************************"
|
||||||
|
echo "There seems to be a invalid transfere."
|
||||||
|
echo "Wait 5 secs ..."
|
||||||
|
sleep 5
|
||||||
|
dialog --title " INVALID TRANSFER" --yesno "Quickcheck shows the data you transferred is invalid/incomplete.\nThis can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 57
|
||||||
|
response=$?
|
||||||
|
echo "response(${response})"
|
||||||
|
case $response in
|
||||||
|
0) 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
|
else
|
||||||
echo "OK - 2nd HDD mounted at /mnt/genesis"
|
|
||||||
|
# when no data transferred - just delete bitcoin base dir again
|
||||||
|
sudo rm -rf /mnt/hdd/bitcoin
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
# setup script will decide the next logical step
|
||||||
echo "*** Copy Blockchain ***"
|
./10setupBlitz.sh
|
||||||
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin /mnt/hdd/
|
|
||||||
echo "cleaning up - ok if files do not exists"
|
|
||||||
sudo rm /mnt/hdd/${network}/${network}.conf
|
|
||||||
sudo rm /mnt/hdd/${network}/${network}.pid
|
|
||||||
sudo rm /mnt/hdd/${network}/banlist.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/debug.log
|
|
||||||
sudo rm /mnt/hdd/${network}/fee_estimates.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/mempool.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/peers.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/testnet3/banlist.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/testnet3/debug.log
|
|
||||||
sudo rm /mnt/hdd/${network}/testnet3/fee_estimates.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/testnet3/mempool.dat
|
|
||||||
sudo rm /mnt/hdd/${network}/testnet3/peers.dat
|
|
||||||
sudo umount -l /mnt/genesis
|
|
||||||
echo "OK - Copy done :)"
|
|
||||||
echo ""
|
|
||||||
echo "---> You can now disconnect the 2nd HDD"
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
./60finishHDD.sh
|
|
||||||
@@ -1,30 +1,60 @@
|
|||||||
|
#!/bin/bash
|
||||||
echo ""
|
echo ""
|
||||||
echo "!!!! This will DELETE your data & POSSIBLE FUNDS from the HDD !!!!"
|
extraParameter="$1"
|
||||||
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
if [ "${extraParameter}" = "-all" ]; then
|
||||||
read key
|
|
||||||
sudo dphys-swapfile swapoff
|
echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
|
||||||
sudo systemctl stop bitcoind.service 2>/dev/null
|
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
||||||
sudo systemctl stop litecoind.service 2>/dev/null
|
read key
|
||||||
sudo systemctl stop lnd.service 2>/dev/null
|
|
||||||
sudo rm -f -r /mnt/hdd/lnd
|
sudo dphys-swapfile swapoff
|
||||||
sudo rm -f -r /mnt/hdd/ssh
|
sudo systemctl stop bitcoind.service 2>/dev/null
|
||||||
sudo rm -f /mnt/hdd/swapfile
|
sudo systemctl stop litecoind.service 2>/dev/null
|
||||||
sudo rm -f /mnt/hdd/bitcoin/bitcoin.conf
|
sudo systemctl stop lnd.service 2>/dev/null
|
||||||
sudo rm -f /mnt/hdd/bitcoin/bitcoin.pid
|
|
||||||
sudo rm -f /mnt/hdd/bitcoin/*.dat
|
# delete plain all on HDD
|
||||||
sudo rm -f /mnt/hdd/bitcoin/*.log
|
sudo cd /mnt/hdd
|
||||||
sudo rm -f /mnt/hdd/bitcoin/*.pid
|
rm -R -- */
|
||||||
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.dat
|
cd
|
||||||
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.log
|
|
||||||
sudo rm -f /mnt/hdd/bitcoin/testnet3/.lock
|
else
|
||||||
sudo rm -f /mnt/hdd/litecoin/litecoin.conf
|
|
||||||
sudo rm -f /mnt/hdd/litecoin/litecoin.pid
|
echo "!!!! This will DELETE your personal data & POSSIBLE FUNDS from the HDD !!!!"
|
||||||
sudo rm -f /mnt/hdd/litecoin/*.dat
|
echo "--> It will keep Blockchain data - sou you dont have to download/copy again."
|
||||||
sudo rm -f /mnt/hdd/litecoin/*.log
|
echo "--> If you want to delete also blockchain data, please run with '-all' parameter."
|
||||||
sudo rm -f /mnt/hdd/litecoin/*.pid
|
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
||||||
sudo rm -f -r /mnt/hdd/lost+found
|
read key
|
||||||
sudo rm -f -r /mnt/hdd/download
|
|
||||||
sudo rm -f -r /mnt/hdd/tor
|
sudo dphys-swapfile swapoff
|
||||||
sudo rm -f /mnt/hdd/raspiblitz.conf
|
sudo systemctl stop bitcoind.service 2>/dev/null
|
||||||
sudo rm -f /home/admin/raspiblitz.info
|
sudo systemctl stop litecoind.service 2>/dev/null
|
||||||
|
sudo systemctl stop lnd.service 2>/dev/null
|
||||||
|
|
||||||
|
# just delete selective
|
||||||
|
sudo rm -f -r /mnt/hdd/lnd
|
||||||
|
sudo rm -f -r /mnt/hdd/ssh
|
||||||
|
sudo rm -f /mnt/hdd/swapfile
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/bitcoin.conf
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/bitcoin.pid
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/*.dat
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/*.log
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/*.pid
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.dat
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/testnet3/*.log
|
||||||
|
sudo rm -f /mnt/hdd/bitcoin/testnet3/.lock
|
||||||
|
sudo rm -f /mnt/hdd/litecoin/litecoin.conf
|
||||||
|
sudo rm -f /mnt/hdd/litecoin/litecoin.pid
|
||||||
|
sudo rm -f /mnt/hdd/litecoin/*.dat
|
||||||
|
sudo rm -f /mnt/hdd/litecoin/*.log
|
||||||
|
sudo rm -f /mnt/hdd/litecoin/*.pid
|
||||||
|
sudo rm -f -r /mnt/hdd/lost+found
|
||||||
|
sudo rm -f -r /mnt/hdd/download
|
||||||
|
sudo rm -f -r /mnt/hdd/tor
|
||||||
|
sudo rm -f /mnt/hdd/raspiblitz.conf
|
||||||
|
sudo rm -f /home/admin/raspiblitz.info
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo "OK - the HDD is now clean"
|
echo "OK - the HDD is now clean"
|
||||||
|
echo "reboot -> sudo shutdown -r now"
|
||||||
|
echo "power off -> sudo shutdown now"
|
||||||
|
|||||||
Reference in New Issue
Block a user