mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-23 14:40:45 +01:00
#227 new bitcoin torrents and removed index copy
This commit is contained in:
parent
8d36bd3f86
commit
4ccd4536fb
15 changed files with 2126 additions and 10574 deletions
4
FAQ.md
4
FAQ.md
|
@ -176,7 +176,6 @@ You can simply use the HDD of another RaspiBlitz or you prepare a HDD yourself b
|
|||
```
|
||||
/bitcoin/blocks
|
||||
/bitcoin/chainstate
|
||||
/bitcoin/indexes
|
||||
```
|
||||
|
||||
optional you can add also the testnet data:
|
||||
|
@ -184,7 +183,6 @@ optional you can add also the testnet data:
|
|||
```
|
||||
/bitcoin/testnet3/blocks
|
||||
/bitcoin/testnet3/chainstate
|
||||
/bitcoin/testnet3/indexes
|
||||
```
|
||||
|
||||
To connect the 2nd HDD to the RaspiBlitz, the use of a Y cable to provide extra power is recommended (see optional shopping list). Because the RaspiBlitz cannot run 2 HDDs without extra power. For extra power you can use a battery pack (like in picture below) or choose a external HDD with its own power supply.
|
||||
|
@ -547,7 +545,6 @@ Now change to your computer where you package the torrent files and transfere th
|
|||
```
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/blocks ./blocks
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/chainstate ./chainstate
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/indexes ./indexes
|
||||
```
|
||||
|
||||
Also have an almost 100% synced bitcoind TESTNET with txindex=1 on a RaspiBlitz
|
||||
|
@ -574,7 +571,6 @@ Now change again to your computer where you package the torrent files and transf
|
|||
mkdir testnet3
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/blocks ./testnet3/blocks
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/chainstate ./testnet3/chainstate
|
||||
scp -r bitcoin@[RaspiBlitzIP]:/mnt/hdd/bitcoin/testnet3/indexes ./testnet3/indexes
|
||||
```
|
||||
|
||||
(Re-)name the "torrent base directory" to the same name as the torrent UPDATE file itself later (without the .torrent ending). The update torrentfile should always have the following naming schema:
|
||||
|
|
|
@ -142,7 +142,6 @@ A prepared HDD is formatted in EXT4 and named "BLOCKCHAIN". In folder called `bi
|
|||
```
|
||||
/bitcoin/blocks
|
||||
/bitcoin/chainstate
|
||||
/bitcoin/indexes
|
||||
```
|
||||
|
||||
optionaly you can add also the testnet data:
|
||||
|
@ -150,7 +149,6 @@ optionaly you can add also the testnet data:
|
|||
```
|
||||
/bitcoin/testnet3/blocks
|
||||
/bitcoin/testnet3/chainstate
|
||||
/bitcoin/testnet3/indexes
|
||||
```
|
||||
|
||||
The bitcoin core client the folders are from needs to have `txindex=1` in the bitcoin.conf and needs to be stopped while the data is copied to the HDD.
|
||||
|
|
|
@ -178,18 +178,6 @@ if [ ${mountOK} -eq 1 ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# check if there is ftp data to continue
|
||||
downloadProgressExists=$(sudo ls /mnt/hdd/ 2>/dev/null | grep "download" -c)
|
||||
if [ ${downloadProgressExists} -eq 1 ]; then
|
||||
# check if there is a running screen session to return to
|
||||
noScreenSession=$(screen -ls | grep -c "No Sockets found")
|
||||
if [ ${noScreenSession} -eq 0 ]; then
|
||||
echo "found download in data .. resuming"
|
||||
/home/admin/50downloadHDD.sh
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# HDD is empty - get Blockchain
|
||||
|
||||
#Bitcoin
|
||||
|
|
|
@ -105,24 +105,9 @@ fi
|
|||
echo ""
|
||||
echo "*** Copy Blockchain ***"
|
||||
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/chainstate /mnt/hdd/bitcoin
|
||||
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/indexes /mnt/hdd/bitcoin
|
||||
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/testnet3 /mnt/hdd/bitcoin
|
||||
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/blocks /mnt/hdd/bitcoin
|
||||
|
||||
# echo "cleaning up - ok if files do not exists"
|
||||
# sudo rm /mnt/hdd/${network}/${network}.conf
|
||||
# sudo rm /mnt/hdd/${network}/${network}.pid
|
||||
# sudo rm /mnt/hdd/${network}/banlist.dat
|
||||
# sudo rm /mnt/hdd/${network}/debug.log
|
||||
# sudo rm /mnt/hdd/${network}/fee_estimates.dat
|
||||
# sudo rm /mnt/hdd/${network}/mempool.dat
|
||||
# sudo rm /mnt/hdd/${network}/peers.dat
|
||||
# sudo rm /mnt/hdd/${network}/testnet3/banlist.dat
|
||||
# sudo rm /mnt/hdd/${network}/testnet3/debug.log
|
||||
# sudo rm /mnt/hdd/${network}/testnet3/fee_estimates.dat
|
||||
# sudo rm /mnt/hdd/${network}/testnet3/mempool.dat
|
||||
# sudo rm /mnt/hdd/${network}/testnet3/peers.dat
|
||||
|
||||
sudo umount -l /mnt/genesis
|
||||
echo "OK - Copy done :)"
|
||||
echo ""
|
||||
|
@ -161,17 +146,6 @@ if [ ${count} -lt 1400 ]; then
|
|||
echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})"
|
||||
quickCheckOK=0
|
||||
fi
|
||||
count=$(sudo ls /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | grep -c '.ldb')
|
||||
if [ ${count} -gt 0 ]; then
|
||||
echo "Found data in /mnt/hdd/bitcoin/indexes/txindex"
|
||||
anyDataAtAll=1
|
||||
fi
|
||||
# if [ ${count} -lt 5200 ]; then
|
||||
# echo "FAIL: less then 5200 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)"
|
||||
if [ ${count} -lt 2300 ]; then
|
||||
echo "FAIL: less then 2300 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)"
|
||||
quickCheckOK=0
|
||||
fi
|
||||
|
||||
# just if any data transferred ..
|
||||
if [ ${anyDataAtAll} -eq 1 ]; then
|
||||
|
|
|
@ -67,14 +67,14 @@ echo "Both computers (your RaspberryPi and the other computer with the full bloc
|
|||
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' & 'indexes'".
|
||||
echo "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:"
|
||||
if [ "${CHOICE}" = "WINDOWS" ]; then
|
||||
echo "sudo scp -r ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||
echo "sudo scp -r ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||
else
|
||||
echo "sudo rsync -avhW --progress ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||
echo "sudo rsync -avhW --progress ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||
fi
|
||||
echo ""
|
||||
echo "This command may ask you first about the admin password of the other computer (because sudo)."
|
||||
|
@ -106,15 +106,6 @@ if [ ${count} -lt 1400 ]; then
|
|||
echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})"
|
||||
quickCheckOK=0
|
||||
fi
|
||||
count=$(sudo ls /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | grep -c '.ldb')
|
||||
if [ ${count} -gt 0 ]; then
|
||||
echo "Found data in /mnt/hdd/bitcoin/indexes/txindex"
|
||||
anyDataAtAll=1
|
||||
fi
|
||||
if [ ${count} -lt 500 ]; then
|
||||
echo "FAIL: less then 500 .ldb files (${count}) in /mnt/hdd/bitcoin/indexes/txindex (transfere seems invalid)"
|
||||
quickCheckOK=0
|
||||
fi
|
||||
|
||||
echo "*********************************************"
|
||||
echo "QUICK CHECK RESULT"
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
#!/bin/bash
|
||||
echo ""
|
||||
|
||||
## get basic info
|
||||
source /home/admin/raspiblitz.info
|
||||
|
||||
# *** BITCOIN (just mainnet) ***
|
||||
bitcoinList="" # url to list with other sources
|
||||
#bitcoinUrl="ftp://anonymous:anonymous@91.83.237.185:21/raspiblitz-bitcoin-2018-07-16"
|
||||
bitcoinUrl="ftp://f00f39c4:download@w0189aba.kasserver.com/"
|
||||
bitcoinSize=253000000 # 253827180-tolerance
|
||||
|
||||
# *** LITECOIN ***
|
||||
litecoinList="" # url to list with other sources
|
||||
litecoinUrl="ftp://anonymous:anonymous@ftp.rotzoll.de/pub/raspiblitz-litecoin-2018-11-30"
|
||||
litecoinSize=22220000 # 22221160-tolerance
|
||||
|
||||
# NOTE TO GET THE SIZE RIGHT: for new download add 9999999999 as size. Run download.
|
||||
# When finished the warning comes up and behind WARNING: copy that number
|
||||
|
||||
# settings based on network
|
||||
list=$bitcoinList
|
||||
url=$bitcoinUrl
|
||||
size=$bitcoinSize
|
||||
if [ "$network" = "litecoin" ]; then
|
||||
list=$litecoinList
|
||||
url=$litecoinUrl
|
||||
size=$litecoinSize
|
||||
fi
|
||||
|
||||
# screen background monitoring settings
|
||||
name="Download"
|
||||
targetDir="/mnt/hdd/download/"
|
||||
targetSize=$size
|
||||
command="sudo wget -c -r -P ${targetDir} -q --show-progress ${url}"
|
||||
|
||||
# starting session if needed
|
||||
echo "checking if ${name} has a running screen session"
|
||||
screen -wipe 1>/dev/null
|
||||
isRunning=$( screen -S ${name} -ls | grep "${name}" -c )
|
||||
echo "isRunning(${isRunning})"
|
||||
if [ ${isRunning} -eq 0 ]; then
|
||||
echo "Starting screen session"
|
||||
sudo mkdir ${targetDir} 2>/dev/null
|
||||
screen -S ${name} -dm ${command}
|
||||
else
|
||||
echo "Continue screen session"
|
||||
fi
|
||||
sleep 3
|
||||
|
||||
# monitor session
|
||||
screenDump="... started ..."
|
||||
actualSize=0
|
||||
while :
|
||||
do
|
||||
|
||||
# check if session is still running
|
||||
screen -wipe 1>/dev/null
|
||||
isRunning=$( screen -S ${name} -ls | grep "${name}" -c )
|
||||
if [ ${isRunning} -eq 0 ]; then
|
||||
echo "OK - session finished"
|
||||
break
|
||||
fi
|
||||
|
||||
# calculate progress and write it to file for LCD to read
|
||||
freshSize=$( du -s ${targetDir} | head -n1 | awk '{print $1;}' )
|
||||
if [ ${#actualSize} -eq 0 ]; then
|
||||
freshSize=0
|
||||
fi
|
||||
progress=$(echo "scale=2; $freshSize*100/$targetSize" | bc)
|
||||
echo $progress > ".${name}.progress"
|
||||
|
||||
actualSize=$freshSize
|
||||
|
||||
# display info screen
|
||||
clear
|
||||
echo "****************************************************"
|
||||
echo "Monitoring Screen Session: ${name}"
|
||||
echo "Progress: ${progress}% (${actualSize} of ${targetSize})"
|
||||
echo "If needed press key x to stop ${name}"
|
||||
echo "NOTICE: This can take multiple hours or days !!"
|
||||
echo "Its OK to close terminal now and SSH back in later."
|
||||
echo "****************************************************"
|
||||
screen -S ${name} -X hardcopy .${name}.out
|
||||
newScreenDump=$(cat .${name}.out | grep . | tail -8)
|
||||
if [ ${#newScreenDump} -gt 0 ]; then
|
||||
screenDump=$newScreenDump
|
||||
fi
|
||||
echo "$screenDump"
|
||||
|
||||
# wait 2 seconds for key input
|
||||
read -n 1 -t 2 keyPressed
|
||||
|
||||
# check if user wants to abort session
|
||||
if [ "${keyPressed}" = "x" ]; then
|
||||
echo ""
|
||||
echo "Aborting ${name}"
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# clean up
|
||||
rm -f .${name}.out
|
||||
rm -f .${name}.progress
|
||||
|
||||
# quit session if still running
|
||||
if [ ${isRunning} -eq 1 ]; then
|
||||
# get the PID of screen session
|
||||
sessionPID=$(screen -ls | grep "${name}" | cut -d "." -f1 | xargs)
|
||||
echo "killing screen session PID(${sessionPID})"
|
||||
# kill all child processes of screen sceesion
|
||||
pkill -P ${sessionPID}
|
||||
echo "proccesses killed"
|
||||
sleep 3
|
||||
# tell the screen session to quit and wait a bit
|
||||
screen -S ${name} -X quit 1>/dev/null
|
||||
sleep 3
|
||||
echo "cleaning screen"
|
||||
screen -wipe 1>/dev/null
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
# the path wget will download to
|
||||
targetPath=$(echo ${url} | cut -d '@' -f2)
|
||||
echo "path to downloaded data is ${targetPath}"
|
||||
|
||||
# calculate progress and write it to file for LCD to read
|
||||
finalSize=$( du -s ${targetDir} 2>/dev/null | head -n1 | awk '{print $1;}' )
|
||||
if [ ${#finalSize} -eq 0 ]; then
|
||||
finalSize=0
|
||||
fi
|
||||
echo "final size is ${finalSize} of targeted size ${targetSize}"
|
||||
|
||||
# check result
|
||||
if [ ${finalSize} -lt ${targetSize} ]; then
|
||||
|
||||
# Download failed
|
||||
sleep 3
|
||||
echo -ne '\007'
|
||||
dialog --title " WARNING (${finalSize}) " --yesno "The download failed or is not complete. Maybe try again (later). Do you want keep already downloaded data for next try?" 8 57
|
||||
response=$?
|
||||
case $response in
|
||||
1) sudo rm -rf /mnt/hdd/download ;;
|
||||
esac
|
||||
./00raspiblitz.sh
|
||||
exit 1;
|
||||
|
||||
else
|
||||
|
||||
# Download worked
|
||||
echo "*** Moving Files ***"
|
||||
sudo mv ${targetDir}${targetPath} /mnt/hdd/${network}
|
||||
echo "OK"
|
||||
|
||||
if [ ${setupStep} -lt 100 ]; then
|
||||
# set SetupState
|
||||
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
|
||||
# continue setup
|
||||
./60finishHDD.sh
|
||||
fi
|
||||
|
||||
fi
|
|
@ -5,12 +5,31 @@ source /home/admin/raspiblitz.info
|
|||
|
||||
# only show warning when bitcoin
|
||||
if [ "$network" = "bitcoin" ]; then
|
||||
msg=" The RaspberryPi has very limited CPU power.\n"
|
||||
msg="$msg To sync & validate the complete blockchain\n"
|
||||
msg="$msg can take multiple days - even weeks!\n"
|
||||
msg="$msg Its recommended to use another option.\n"
|
||||
msg="$msg \n"
|
||||
msg="$msg So do you really want start syncing now?"
|
||||
|
||||
# detect hardware version of RaspberryPi
|
||||
# https://www.unixtutorial.org/command-to-confirm-raspberry-pi-model
|
||||
raspberryPi=$(cat /proc/device-tree/model | cut -d " " -f 3 | sed 's/[^0-9]*//g')
|
||||
if [ ${#raspberryPi} -eq 0 ]; then
|
||||
raspberryPi=0
|
||||
fi
|
||||
echo "RaspberryPi Model Version: ${raspberryPi}"
|
||||
if [ ${raspberryPi} -lt 4 ]; then
|
||||
# raspberryPi 3 and lower
|
||||
msg=" This old RaspberryPi has very limited CPU power.\n"
|
||||
msg="$msg To sync & validate the complete blockchain\n"
|
||||
msg="$msg can take multiple days - even weeksn"
|
||||
msg="$msg Its recommended to use another option.\n"
|
||||
msg="$msg \n"
|
||||
msg="$msg So do you really want start syncing now?"
|
||||
else
|
||||
# raspberryPi 4 and up
|
||||
msg=" Your RaspiBlitz will sync and validate\n"
|
||||
msg="$msg the complete blockchain by itself.\n"
|
||||
msg="$msg This can take multiple days, but\n"
|
||||
msg="$msg its the best to do it this way.\n"
|
||||
msg="$msg \n"
|
||||
msg="$msg So do you want start syncing now?"
|
||||
fi
|
||||
|
||||
dialog --title " WARNING " --yesno "${msg}" 11 57
|
||||
response=$?
|
||||
|
@ -21,11 +40,19 @@ if [ "$network" = "bitcoin" ]; then
|
|||
esac
|
||||
|
||||
clear
|
||||
echo "********************************"
|
||||
echo "This is madness. This is Sparta!"
|
||||
echo "********************************"
|
||||
echo ""
|
||||
sleep 3
|
||||
if [ ${raspberryPi} -lt 4 ]; then
|
||||
echo "********************************"
|
||||
echo "This is madness. This is Sparta!"
|
||||
echo "********************************"
|
||||
echo ""
|
||||
sleep 3
|
||||
else
|
||||
echo "**********************************"
|
||||
echo "Dont Trust, verify - starting sync"
|
||||
echo "**********************************"
|
||||
echo ""
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ source /home/admin/raspiblitz.info
|
|||
#bitcoinUpdate="raspiblitz-bitcoin1-2019-04-09-update"
|
||||
# taken from https://getbitcoinblockchain.com/
|
||||
# TODO later first try to download from that website and have local torrent files for backup
|
||||
bitcoinBase="bitcoin2-base"
|
||||
bitcoinUpdate="bitcoin2-update"
|
||||
bitcoinBase="raspiblitz-bitcoin2-2019-05-01-base"
|
||||
bitcoinUpdate="raspiblitz-bitcoin2-2019-06-29-update"
|
||||
|
||||
litecoinBase="raspiblitz-litecoin1-2018-11-18-base"
|
||||
litecoinUpdate="raspiblitz-litecoin1-2018-11-18-update"
|
||||
|
@ -38,6 +38,11 @@ updateTorrentFile=${bitcoinUpdate}
|
|||
if [ "$network" = "litecoin" ]; then
|
||||
baseTorrentFile=${litecoinBase}
|
||||
updateTorrentFile=${litecoinUpdate}
|
||||
else
|
||||
|
||||
# try download latest getbitcoinblockchain.com torrent files
|
||||
|
||||
|
||||
fi
|
||||
echo "# TORRENT-FILES"
|
||||
echo "baseTorrent='${baseTorrentFile}'"
|
||||
|
|
|
@ -159,7 +159,7 @@ do
|
|||
chmod 777 ${pathTemplateHDD}/bitcoin
|
||||
fi
|
||||
|
||||
rsync -a --info=progress2 ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/indexes ${pathBitcoinBlockchain}/blocks ${pathBitcoinBlockchain}/testnet3 ${pathTemplateHDD}/bitcoin
|
||||
rsync -a --info=progress2 ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathBitcoinBlockchain}/testnet3 ${pathTemplateHDD}/bitcoin
|
||||
|
||||
if [ -d "${pathLitecoinBlockchain}" ]; then
|
||||
|
||||
|
@ -172,7 +172,7 @@ do
|
|||
|
||||
sudo sed -i "s/^message=.*/message='Updating Template: Litecoin'/g" /home/admin/raspiblitz.info 2>/dev/null
|
||||
|
||||
rsync -a --info=progress2 ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/indexes ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin
|
||||
rsync -a --info=progress2 ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin
|
||||
|
||||
fi
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ testnet=0
|
|||
# litcoind options
|
||||
server=1
|
||||
daemon=1
|
||||
txindex=1
|
||||
txindex=0
|
||||
disablewallet=1
|
||||
|
||||
# Connection settings
|
||||
|
|
File diff suppressed because one or more lines are too long
2075
home.admin/assets/raspiblitz-bitcoin2-2019-06-29-update.torrent
Normal file
2075
home.admin/assets/raspiblitz-bitcoin2-2019-06-29-update.torrent
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue