Browse Source

typos and PATH fix

dev
openoms 6 years ago
parent
commit
9f8abe4ea7
  1. 219
      DietPi/Tor/96addTorService_from_RaspiBlitz_v0.92.sh
  2. 412
      DietPi/Tor/Tor_install_output
  3. 10
      README.md
  4. 29
      build.sdcard/raspbianStretchDesktop.sh
  5. 4
      home.admin/00infoBlitz.sh
  6. 4
      home.admin/50copyHDD.sh
  7. 222
      home.admin/96addTorService.sh
  8. 2
      home.admin/assets/lnd.service
  9. 2
      install_on_DietPi.md

219
DietPi/Tor/96addTorService_from_RaspiBlitz_v0.92.sh

@ -1,219 +0,0 @@
#!/bin/bash
# Background:
# https://medium.com/@lopp/how-to-run-bitcoin-as-a-tor-hidden-service-on-ubuntu-cff52d543756
# https://bitcoin.stackexchange.com/questions/70069/how-can-i-setup-bitcoin-to-be-anonymous-with-tor
# https://github.com/lightningnetwork/lnd/blob/master/docs/configuring_tor.md
# load network
network=`cat .network`
chain="$(${network}-cli getblockchaininfo | jq -r '.chain')"
# location of TOR config
torrc="/etc/tor/torrc"
# check if TOR was already installed and is funtional
clear
echo ""
echo "*** Check if TOR service is functional ***"
torRunning=$(curl --connect-timeout 10 --socks5-hostname 127.0.0.1:9050 https://check.torproject.org | grep "Congratulations. This browser is configured to use Tor." -c)
if [ ${torRunning} -gt 0 ]; then
clear
echo "You are all good - TOR is already running."
echo ""
exit 0
else
echo "TOR not running ... proceed with switching to TOR."
echo ""
fi
# ask user if to proceed
dialog --title " WARNING " --yesno "At the moment you just can switch TOR on - YOU CANNOT SWITCH BACK. Do you want to proceed?" 8 57
response=$?
case $response in
1) exit 1;
esac
echo "*** Adding Tor Sources to sources.list ***"
echo "deb http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
echo ""
echo "*** Installing dirmngr ***"
sudo apt install dirmngr
echo ""
## lopp: gpg --keyserver keys.gnupg.net --recv 886DDD89
echo "*** Fetching GPG key ***"
gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
echo ""
echo "*** Updating System ***"
sudo apt-get update
echo ""
echo "*** Install Tor ***"
sudo apt install tor tor-arm -y
echo ""
echo "*** Tor Config ***"
sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor
sudo mkdir /mnt/hdd/tor/sys
sudo mkdir /mnt/hdd/tor/web80
sudo mkdir /mnt/hdd/tor/lnd9735
sudo mkdir /mnt/hdd/tor/lndrpc9735
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
### See 'man tor', or https://www.torproject.org/docs/tor-manual.html
DataDirectory /mnt/hdd/tor/sys
PidFile /mnt/hdd/tor/sys/tor.pid
SafeLogging 0
Log notice stdout
Log notice file /mnt/hdd/tor/notice.log
Log info file /mnt/hdd/tor/info.log
RunAsDaemon 1
User bitcoin
PortForwarding 1
ControlPort 9051
SocksPort 9050
CookieAuthFile /mnt/hdd/tor/sys/control_auth_cookie
CookieAuthentication 1
CookieAuthFileGroupReadable 1
# Hidden Service v2 for WEB ADMIN INTERFACE
HiddenServiceDir /mnt/hdd/tor/web80/
HiddenServicePort 80 127.0.0.1:80
# Hidden Service v2 for LND RPC
HiddenServiceDir /mnt/hdd/tor/lndrpc10009/
HiddenServicePort 80 127.0.0.1:10009
# Hidden Service v3 for LND incomming connections (just in case)
# https://trac.torproject.org/projects/tor/wiki/doc/NextGenOnions#Howtosetupyourownprop224service
HiddenServiceDir /mnt/hdd/tor/lnd9735
HiddenServiceVersion 3
HiddenServicePort 9735 127.0.0.1:9735
# NOTE: bitcoind get tor service automatically - see /mnt/hdd/bitcoin for onion key
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
echo ""
echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload
sudo systemctl restart tor@default
echo ""
echo "*** Waiting for TOR to boostrap ***"
torIsBootstrapped=0
while [ ${torIsBootstrapped} -eq 0 ]
do
echo "--- Checking 1 ---"
date +%s
sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
echo "torIsBootstrapped(${torIsBootstrapped})"
echo "If this takes too long --> CTRL+c, reboot and check manually"
sleep 5
done
echo "OK - Tor Bootstrap is ready"
echo ""
echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
if [ ${networkIsTor} -eq 0 ]; then
echo "Only Connect thru TOR"
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
if [ "${network}" = "bitcoin" ]; then
echo "Adding some bitcoin onion nodes to connect to"
echo "addnode=fno4aakpl6sg6y47.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=toguvy5upyuctudx.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=ndndword5lpb7eex.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=6m2iqgnqjxh7ulyk.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=5tuxetn7tar3q5kp.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
fi
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${network}/${network}.conf
else
echo "Chain network already configured for TOR"
fi
echo "*** ${network} re-init - Waiting for Onion Address ***"
# restarting bitcoind to start with tor and generare onion.address
echo "restarting ${network}d ..."
sudo systemctl restart ${network}d
sleep 8
onionAddress=""
while [ ${#onionAddress} -eq 0 ]
do
echo "--- Checking 2 ---"
date +%s
testNetAdd=""
if [ "${chain}" = "test" ];then
testNetAdd="/testnet3"
fi
sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10
onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
sleep 5
done
onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9')
echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}"
echo ""
echo "*** Setting your Onion Address ***"
onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
echo ""
# ACTIVATE LND OVER TOR
echo "*** Putting LND behind TOR ***"
echo "Disable LND again"
sudo systemctl disable lnd
echo "Writing Public Onion Address to /run/publicip (just in case for TotHiddenServiceV3)"
echo "PUBLICIP=${onionLND}" | sudo tee /run/publicip
echo "Configure and Changing to lnd.tor.service"
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.tor.service
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.tor.service
sudo cp /home/admin/assets/lnd.tor.service /etc/systemd/system/lnd.service
sudo chmod +x /etc/systemd/system/lnd.service
echo "Enable LND again"
sudo systemctl enable lnd
echo "OK"
echo ""
echo "*** Finshing Setup / REBOOT ***"
echo "OK - all should be set"
echo ""
echo "PRESS ENTER ... to REBOOT"
read key
sudo shutdown -r now
exit 0

412
DietPi/Tor/Tor_install_output

@ -1,412 +0,0 @@
admin@DietPi:~$ sudo nano 96addTorService.sh
admin@DietPi:~$ ./96addTorService.sh
*** Check if TOR service is functional ***
./96addTorService.sh: line 20: [: -gt: unary operator expected
TOR not running ... proceed with switching to TOR.
┌────────────────────── WARNING ────────────────────────┐
│ At the moment you just can switch TOR on - YOU CANNOT │
│ SWITCH BACK. Do you want to proceed? │
│ │
│ │
├───────────────────────────────────────────────────────┤
│ < Yes > < No > │
└───────────────────────────────────────────────────────┘
*** Adding Tor Sources to sources.list ***
deb http://deb.torproject.org/torproject.org stretch main
deb-src http://deb.torproject.org/torproject.org stretch main
OK
*** Installing dirmngr ***
Reading package lists... Done
Building dependency tree
Reading state information... Done
dirmngr is already the newest version (2.1.18-8~deb9u3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:6 and /etc/apt/sources.list:8
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:6 and /etc/apt/sources.list:10
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
*** Fetching GPG key ***
uid deb.torproject.org archive signing key
sig!3 EE8CBC9E886DDD89 2009-09-04 [self-signature]
sig!3 EE8CBC9E886DDD89 2012-08-29 [self-signature]
sig!3 EE8CBC9E886DDD89 2014-08-31 [self-signature]
sig!3 EE8CBC9E886DDD89 2018-08-06 [self-signature]
sub 74A941BA219EC810
sig! EE8CBC9E886DDD89 2009-09-04 [self-signature]
sig! EE8CBC9E886DDD89 2012-08-29 [self-signature]
sig! EE8CBC9E886DDD89 2014-08-31 [self-signature]
sig! EE8CBC9E886DDD89 2018-08-06 [self-signature]
key EE8CBC9E886DDD89:
2 duplicate signatures removed
82 signatures not checked due to missing keys
gpg: key EE8CBC9E886DDD89: "deb.torproject.org archive signing key" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
key EE8CBC9E886DDD89:
82 signatures not checked due to missing keys
OK
*** Updating System ***
Hit:1 http://fuzon.co.uk/meveric all InRelease
Hit:2 http://deb.torproject.org/torproject.org stretch InRelease
Hit:3 http://fuzon.co.uk/meveric stretch InRelease
Ign:4 https://cdn-aws.deb.debian.org/debian stretch InRelease
Hit:5 https://cdn-aws.deb.debian.org/debian stretch-updates InRelease
Hit:6 https://cdn-aws.deb.debian.org/debian-security stretch/updates InRelease
Hit:7 https://cdn-aws.deb.debian.org/debian stretch-backports InRelease
Hit:8 https://cdn-aws.deb.debian.org/debian stretch Release
Hit:10 https://oph.mdrjr.net/meveric all InRelease
Reading package lists... Done
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:6 and /etc/apt/sources.list:8
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:6 and /etc/apt/sources.list:10
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:6 and /etc/apt/sources.list:8
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list:6 and /etc/apt/sources.list:10
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:7
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:9
*** Install Tor ***
Reading package lists... Done
Building dependency tree
Reading state information... Done
tor-arm is already the newest version (1.4.5.0-1.1).
tor is already the newest version (0.3.5.7-1~d90.stretch+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
*** Tor Config ***
*** Installing NYX - TOR monitoring Tool ***
Collecting nyx
Using cached https://files.pythonhosted.org/packages/f4/da/68419425cb0f64f996e2150045c7043c2bb61f77b5928c2156c26a21db88/nyx-2.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-MEJi99/nyx/
*** Activating TOR system service ***
ReadWriteDirectories=-/mnt/hdd/tor
*** Waiting for TOR to boostrap ***
--- Checking 1 ---
1548772231
Jan 29 14:30:31.000 [notice] Bootstrapped 0%: Starting
torIsBootstrapped(0)
If this takes too long --> CTRL+c, reboot and check manually
--- Checking 1 ---
1548772236
Jan 29 14:30:31.000 [notice] Bootstrapped 0%: Starting
Jan 29 14:30:32.000 [notice] Bootstrapped 5%: Connecting to directory server
Jan 29 14:30:32.000 [notice] Bootstrapped 10%: Finishing handshake with directory server
Jan 29 14:30:32.000 [notice] Bootstrapped 15%: Establishing an encrypted directory connection
Jan 29 14:30:32.000 [notice] Bootstrapped 20%: Asking for networkstatus consensus
Jan 29 14:30:32.000 [notice] Bootstrapped 25%: Loading networkstatus consensus
Jan 29 14:30:35.000 [notice] Bootstrapped 40%: Loading authority key certs
torIsBootstrapped(0)
If this takes too long --> CTRL+c, reboot and check manually
--- Checking 1 ---
1548772241
Jan 29 14:30:31.000 [notice] Bootstrapped 0%: Starting
Jan 29 14:30:32.000 [notice] Bootstrapped 5%: Connecting to directory server
Jan 29 14:30:32.000 [notice] Bootstrapped 10%: Finishing handshake with directory server
Jan 29 14:30:32.000 [notice] Bootstrapped 15%: Establishing an encrypted directory connection
Jan 29 14:30:32.000 [notice] Bootstrapped 20%: Asking for networkstatus consensus
Jan 29 14:30:32.000 [notice] Bootstrapped 25%: Loading networkstatus consensus
Jan 29 14:30:35.000 [notice] Bootstrapped 40%: Loading authority key certs
Jan 29 14:30:37.000 [notice] Bootstrapped 45%: Asking for relay descriptors for internal paths
Jan 29 14:30:37.000 [notice] Bootstrapped 50%: Loading relay descriptors for internal paths
torIsBootstrapped(0)
If this takes too long --> CTRL+c, reboot and check manually
--- Checking 1 ---
1548772246
Jan 29 14:30:35.000 [notice] Bootstrapped 40%: Loading authority key certs
Jan 29 14:30:37.000 [notice] Bootstrapped 45%: Asking for relay descriptors for internal paths
Jan 29 14:30:37.000 [notice] Bootstrapped 50%: Loading relay descriptors for internal paths
Jan 29 14:30:42.000 [notice] Bootstrapped 57%: Loading relay descriptors
Jan 29 14:30:42.000 [notice] Bootstrapped 65%: Loading relay descriptors
Jan 29 14:30:42.000 [notice] Bootstrapped 72%: Loading relay descriptors
Jan 29 14:30:42.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Jan 29 14:30:42.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Jan 29 14:30:43.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Jan 29 14:30:43.000 [notice] Bootstrapped 100%: Done
torIsBootstrapped(1)
If this takes too long --> CTRL+c, reboot and check manually
OK - Tor Bootstrap is ready
*** Changing bitcoin Config ***
Only Connect thru TOR
onlynet=onion
Adding some bitcoin onion nodes to connect to
addnode=fno4aakpl6sg6y47.onion
addnode=toguvy5upyuctudx.onion
addnode=ndndword5lpb7eex.onion
addnode=6m2iqgnqjxh7ulyk.onion
addnode=5tuxetn7tar3q5kp.onion
*** bitcoin re-init - Waiting for Onion Address ***
restarting bitcoind ...
--- Checking 2 ---
1548772262
2019-01-29T13:57:22Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-01-29T13:58:22Z torcontrol thread start
2019-01-29T14:30:51Z tor: Thread interrupt
2019-01-29T14:30:51Z torcontrol thread exit
2019-01-29T14:30:54Z Assuming ancestors of block 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 have valid signatures.
2019-01-29T14:30:54Z Default data directory /home/bitcoin/.bitcoin
2019-01-29T14:30:54Z Using data directory /mnt/hdd/bitcoin
2019-01-29T14:30:54Z Using at most 40 automatic connections (1024 file descriptors available)
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
error code: -28
error message:
Loading block index...
Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually
--- Checking 2 ---
1548772267
2019-01-29T13:57:22Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-01-29T13:58:22Z torcontrol thread start
2019-01-29T14:30:51Z tor: Thread interrupt
2019-01-29T14:30:51Z torcontrol thread exit
2019-01-29T14:30:54Z Assuming ancestors of block 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 have valid signatures.
2019-01-29T14:30:54Z Default data directory /home/bitcoin/.bitcoin
2019-01-29T14:30:54Z Using data directory /mnt/hdd/bitcoin
2019-01-29T14:30:54Z Using at most 40 automatic connections (1024 file descriptors available)
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
error code: -28
error message:
Loading block index...
Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually
--- Checking 2 ---
1548772272
2019-01-29T13:57:22Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-01-29T13:58:22Z torcontrol thread start
2019-01-29T14:30:51Z tor: Thread interrupt
2019-01-29T14:30:51Z torcontrol thread exit
2019-01-29T14:30:54Z Assuming ancestors of block 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 have valid signatures.
2019-01-29T14:30:54Z Default data directory /home/bitcoin/.bitcoin
2019-01-29T14:30:54Z Using data directory /mnt/hdd/bitcoin
2019-01-29T14:30:54Z Using at most 40 automatic connections (1024 file descriptors available)
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
error code: -28
error message:
Rewinding blocks...
Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually
--- Checking 2 ---
1548772277
2019-01-29T13:57:22Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-01-29T13:58:22Z torcontrol thread start
2019-01-29T14:30:51Z tor: Thread interrupt
2019-01-29T14:30:51Z torcontrol thread exit
2019-01-29T14:30:54Z Assuming ancestors of block 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 have valid signatures.
2019-01-29T14:30:54Z Default data directory /home/bitcoin/.bitcoin
2019-01-29T14:30:54Z Using data directory /mnt/hdd/bitcoin
2019-01-29T14:30:54Z Using at most 40 automatic connections (1024 file descriptors available)
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
error code: -28
error message:
Verifying blocks...
Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually
--- Checking 2 ---
1548772282
2019-01-29T14:30:51Z tor: Thread interrupt
2019-01-29T14:30:51Z torcontrol thread exit
2019-01-29T14:30:54Z Assuming ancestors of block 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 have valid signatures.
2019-01-29T14:30:54Z Default data directory /home/bitcoin/.bitcoin
2019-01-29T14:30:54Z Using data directory /mnt/hdd/bitcoin
2019-01-29T14:30:54Z Using at most 40 automatic connections (1024 file descriptors available)
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-01-29T14:30:54Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-01-29T14:31:20Z torcontrol thread start
2019-01-29T14:31:20Z tor: Got service ID kxs4wmwoesb3z4e4, advertising service kxs4wmwoesb3z4e4.onion:8333
Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually
Your Chain Network Onion Address is: kxs4wmwoesb3z4e4.onion:8333
*** Setting your Onion Address ***
Your Lightning Tor Onion Address is: mtgob7h2hupq7fqzp3egnayz2xvbam5d24ibm35dmr2jnsxwx7jfqcid.onion:9735
*** Putting LND behind TOR ***
Disable LND again
Removed /etc/systemd/system/multi-user.target.wants/lnd.service.
Writing Public Onion Address to /run/publicip (just in case for TotHiddenServiceV3)
PUBLICIP=mtgob7h2hupq7fqzp3egnayz2xvbam5d24ibm35dmr2jnsxwx7jfqcid.onion
Configure and Changing to lnd.tor.service
sed: can't read ./assets/lnd.tor.service: No such file or directory
sed: can't read ./assets/lnd.tor.service: No such file or directory
cp: cannot stat '/home/admin/assets/lnd.tor.service': No such file or directory
Enable LND again
Created symlink /etc/systemd/system/multi-user.target.wants/lnd.service → /etc/systemd/system/lnd.service.
OK
*** Finshing Setup / REBOOT ***
OK - all should be set
PRESS ENTER ... to REBOOT

10
README.md

@ -1,17 +1,14 @@
[ [Hardware](#hardware-needed-amazon-shopping-list) ] -- [ [Setup](#boot-your-raspiblitz) ] -- [ [Documentation](#documentation) ] -- [ [Development](#further-development-of-raspiblitz) ]
-----
# DroidBlitz with DietPi
# RaspiBlitz on DietPi
see: [install_on_DietPi.md](install_on_DietPi.md) and setup continues from [Documentation](#documentation)
see: [install_on_DietPi.md](install_on_DietPi.md)
![](DietPi/DroidBlitz.jpg)
# RaspiBlitz
Fastest and cheapest way to get your own Lightning Node running - on a RaspberryPi with a nice LCD.
`Version 0.99 (1.0 RC1) with lnd 0.5.1 and bitcoin 0.17.0.1 & litecoin 0.16.3.`
`Version 0.98 (1.0 RC1) with lnd 0.5.1 and bitcoin 0.17.0.1 & litecoin 0.16.3.`
![RaspiBlitz](pictures/raspiblitz.jpg)
@ -112,7 +109,6 @@ So open up a [terminal](https://www.youtube.com/watch?v=5XgBd6rjuDQ) and connect
**Now follow the dialoge in your terminal. This can take some time (prepare some coffee) - but in the end you should have a running Lightning node on your RaspberryPi that you can start to learn and hack on.**
## Documentation
### Setup Process

29
build.sdcard/raspbianStretchDesktop.sh

@ -1,14 +1,18 @@
#!/bin/bash
#########################################################################
# Build your SD card image based on:
# DietPi.com
# RASPBIAN STRETCH WITH DESKTOP (2018-11-13)
# https://www.raspberrypi.org/downloads/raspbian/
# SHA256: a121652937ccde1c2583fe77d1caec407f2cd248327df2901e4716649ac9bc97
#
# or download the image for your ARM based SBC on https://DietPi.com
##########################################################################
# setup fresh SD card with image above - login per SSH and run this script:
##########################################################################
echo ""
echo "*****************************************"
echo "* DROIDLITZ SD CARD IMAGE SETUP v0.1 *"
echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.99 *"
echo "*****************************************"
echo ""
@ -105,6 +109,10 @@ if [ "${baseImage}" = "dietpi" ]; then
sudo apt install -y net-tools
#to display hex codes
sudo apt install -y xxd
# setuptools needed for Nyx
sudo pip install setuptools
fi
# special prepare when Raspbian
@ -446,15 +454,14 @@ sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
# add /sbin to path for all
sudo bash -c "echo 'PATH=\$PATH:/sbin' >> /etc/profile"
# profile path for admin
sudo bash -c "echo '' >> /home/admin/.profile"
sudo bash -c "echo 'GOROOT=/usr/local/go' >> /home/admin/.profile"
sudo bash -c "echo 'PATH=\$PATH:\$GOROOT/bin' >> /home/admin/.profile"
sudo bash -c "echo 'PATH=\$PATH:\$GOROOT/bin:' >> /home/admin/.profile"
sudo bash -c "echo 'GOPATH=/usr/local/gocode' >> /home/admin/.profile"
sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/bin' >> /home/admin/.profile"
# add /sbin to path for admin
sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/sbin' >> /home/admin/.profile"
# bash autostart for admin
sudo bash -c "echo '# shortcut commands' >> /home/admin/.bashrc"
@ -462,7 +469,7 @@ sudo bash -c "echo 'source /home/admin/_commands.sh' >> /home/admin/.bashrc"
sudo bash -c "echo '# automatically start main menu for admin' >> /home/admin/.bashrc"
sudo bash -c "echo './00mainMenu.sh' >> /home/admin/.bashrc"
# bash aoutstart for pi
# bash autostart for pi
# run as exec to dont allow easy physical access by keyboard
# see https://github.com/rootzoll/raspiblitz/issues/54
sudo bash -c 'echo "# automatic start the LCD info loop" >> /home/pi/.bashrc'
@ -470,12 +477,6 @@ sudo bash -c 'echo "SCRIPT=/home/admin/00infoLCD.sh" >> /home/pi/.bashrc'
sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/pi/.bashrc'
sudo bash -c 'echo "exec \$SCRIPT" >> /home/pi/.bashrc'
sudo bash -c 'echo "# automatic start the LCD info loop" >> /home/dietpi/.bashrc'
sudo bash -c 'echo "SCRIPT=/home/admin/00infoLCD.sh" >> /home/dietpi/.bashrc'
sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/dietpi/.bashrc'
sudo bash -c 'echo "exec \$SCRIPT" >> /home/dietpi/.bashrc'
# create /home/admin/setup.sh - which will get executed after reboot by autologin pi user
cat > /home/admin/setup.sh <<EOF
@ -544,7 +545,7 @@ echo "Press ENTER to install LCD and reboot ..."
read key
# give Raspi a default hostname (optional)
sudo raspi-config nonint do_hostname "DroidBlitz"
sudo raspi-config nonint do_hostname "RaspiBlitz"
# *** Display selection ***
dialog --title "Display" --yesno "Are you using the default display available from Amazon?\nSelect 'No' if you are using the Swiss version from play-zone.ch!" 6 80

4
home.admin/00infoBlitz.sh

@ -73,8 +73,8 @@ else
fi
# get network traffic
network_rx=$(/sbin/ifconfig eth0 | grep 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_tx=$(/sbin/ifconfig eth0 | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_rx=$(ifconfig eth0 | grep 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_tx=$(ifconfig eth0 | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
# Bitcoin blockchain
btc_path=$(command -v ${network}-cli)

4
home.admin/50copyHDD.sh

@ -80,10 +80,10 @@ fi
# just if any data transferred ..
if [ ${anyDataAtAll} -eq 1 ]; then
# data was invalkid - ask user to keep?
# data was invalid - ask user to keep?
if [ ${quickCheckOK} -eq 0 ]; then
echo "*********************************************"
echo "There seems to be a invalid transfere."
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

222
home.admin/96addTorService.sh

@ -1,222 +0,0 @@
#!/bin/bash
# Background:
# https://medium.com/@lopp/how-to-run-bitcoin-as-a-tor-hidden-service-on-ubuntu-cff52d543756
# https://bitcoin.stackexchange.com/questions/70069/how-can-i-setup-bitcoin-to-be-anonymous-with-tor
# https://github.com/lightningnetwork/lnd/blob/master/docs/configuring_tor.md
# load network
network=`cat .network`
chain="$(${network}-cli getblockchaininfo | jq -r '.chain')"
# location of TOR config
torrc="/etc/tor/torrc"
# check if TOR was already installed and is funtional
clear
echo ""
echo "*** Check if TOR service is functional ***"
torRunning=$(curl --connect-timeout 10 --socks5-hostname 127.0.0.1:9050 https://check.torproject.org | grep "Congratulations. This browser is configured to use Tor." -c)
if [ ${torRunning} -gt 0 ]; then
clear
echo "You are all good - TOR is already running."
echo ""
exit 0
else
echo "TOR not running ... proceed with switching to TOR."
echo ""
fi
# ask user if to proceed
dialog --title " WARNING " --yesno "At the moment you just can switch TOR on - YOU CANNOT SWITCH BACK. Do you want to proceed?" 8 57
response=$?
case $response in
1) exit 1;
esac
echo "*** Adding Tor Sources to sources.list ***"
echo "deb http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
echo ""
echo "*** Installing dirmngr ***"
sudo apt install dirmngr
echo ""
## lopp: gpg --keyserver keys.gnupg.net --recv 886DDD89
echo "*** Fetching GPG key ***"
gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
echo ""
echo "*** Updating System ***"
sudo apt-get update
echo ""
echo "*** Install Tor ***"
sudo apt install tor tor-arm -y
echo ""
echo "*** Tor Config ***"
sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor
sudo mkdir /mnt/hdd/tor/sys
sudo mkdir /mnt/hdd/tor/web80
sudo mkdir /mnt/hdd/tor/lnd9735
sudo mkdir /mnt/hdd/tor/lndrpc9735
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
### See 'man tor', or https://www.torproject.org/docs/tor-manual.html
DataDirectory /mnt/hdd/tor/sys
PidFile /mnt/hdd/tor/sys/tor.pid
SafeLogging 0
Log notice stdout
Log notice file /mnt/hdd/tor/notice.log
Log info file /mnt/hdd/tor/info.log
RunAsDaemon 1
User bitcoin
PortForwarding 1
ControlPort 9051
SocksPort 9050
CookieAuthFile /mnt/hdd/tor/sys/control_auth_cookie
CookieAuthentication 1
CookieAuthFileGroupReadable 1
# Hidden Service v2 for WEB ADMIN INTERFACE
HiddenServiceDir /mnt/hdd/tor/web80/
HiddenServicePort 80 127.0.0.1:80
# Hidden Service v2 for LND RPC
HiddenServiceDir /mnt/hdd/tor/lndrpc10009/
HiddenServicePort 80 127.0.0.1:10009
# Hidden Service v3 for LND incomming connections (just in case)
# https://trac.torproject.org/projects/tor/wiki/doc/NextGenOnions#Howtosetupyourownprop224service
HiddenServiceDir /mnt/hdd/tor/lnd9735
HiddenServiceVersion 3
HiddenServicePort 9735 127.0.0.1:9735
# NOTE: bitcoind get tor service automatically - see /mnt/hdd/bitcoin for onion key
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 ***"
# install setuptools required by NYX
sudo pip install setuptools
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
echo ""
echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload
sudo systemctl restart tor@default
echo ""
echo "*** Waiting for TOR to boostrap ***"
torIsBootstrapped=0
while [ ${torIsBootstrapped} -eq 0 ]
do
echo "--- Checking 1 ---"
date +%s
sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
echo "torIsBootstrapped(${torIsBootstrapped})"
echo "If this takes too long --> CTRL+c, reboot and check manually"
sleep 5
done
echo "OK - Tor Bootstrap is ready"
echo ""
echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
if [ ${networkIsTor} -eq 0 ]; then
echo "Only Connect thru TOR"
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
if [ "${network}" = "bitcoin" ]; then
echo "Adding some bitcoin onion nodes to connect to"
echo "addnode=fno4aakpl6sg6y47.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=toguvy5upyuctudx.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=ndndword5lpb7eex.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=6m2iqgnqjxh7ulyk.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=5tuxetn7tar3q5kp.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
fi
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${network}/${network}.conf
else
echo "Chain network already configured for TOR"
fi
echo "*** ${network} re-init - Waiting for Onion Address ***"
# restarting bitcoind to start with tor and generare onion.address
echo "restarting ${network}d ..."
sudo systemctl restart ${network}d
sleep 8
onionAddress=""
while [ ${#onionAddress} -eq 0 ]
do
echo "--- Checking 2 ---"
date +%s
testNetAdd=""
if [ "${chain}" = "test" ];then
testNetAdd="/testnet3"
fi
sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10
onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
sleep 5
done
onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9')
echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}"
echo ""
echo "*** Setting your Onion Address ***"
onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
echo ""
# ACTIVATE LND OVER TOR
echo "*** Putting LND behind TOR ***"
echo "Disable LND again"
sudo systemctl disable lnd
echo "Writing Public Onion Address to /run/publicip (just in case for TotHiddenServiceV3)"
echo "PUBLICIP=${onionLND}" | sudo tee /run/publicip
echo "Configure and Changing to lnd.tor.service"
sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.tor.service
sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.tor.service
sudo cp /home/admin/assets/lnd.tor.service /etc/systemd/system/lnd.service
sudo chmod +x /etc/systemd/system/lnd.service
echo "Enable LND again"
sudo systemctl enable lnd
echo "OK"
echo ""
echo "*** Finshing Setup / REBOOT ***"
echo "OK - all should be set"
echo ""
echo "PRESS ENTER ... to REBOOT"
read key
sudo shutdown -r now
exit 0

2
home.admin/assets/lnd.service

@ -10,7 +10,7 @@ After=bitcoind.service
[Service]
EnvironmentFile=
ExecStart=/usr/local/bin/lnd
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}
PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin
Group=bitcoin

2
install_on_DietPi.md

@ -56,7 +56,7 @@ Should end up here on version v6.20.5 or higher:
run the SDcard build script in this format: wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh [BRANCH] [GITHUB-USERNAME]
`wget https://raw.githubusercontent.com/openoms/HardwareNode/OdroidHC1Debug/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh OdroidHC1Debug openoms`
`wget https://raw.githubusercontent.com/openoms/HardwareNode/raspiblitz-dev/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh raspiblitz-dev openoms`
See my example output: [sdcard_build_output](DietPi/sdcard_build_output)

Loading…
Cancel
Save