Browse Source

Merge branch 'master' into num_peers

#146
piezzo 6 years ago
committed by GitHub
parent
commit
7a4dc351d9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      README.md
  2. 18
      build.sdcard/raspbianStretchDesktop.sh
  3. 22
      home.admin/00infoBlitz.sh
  4. 4
      home.admin/50downloadHDD.sh
  5. 6
      home.admin/50torrentHDD.sh
  6. 163
      home.admin/AAunlockLND.py
  7. 2
      home.admin/BBfundWallet.sh
  8. 9538
      home.admin/assets/raspiblitz-bitcoin-2018-10-06.torrent

12
README.md

@ -22,14 +22,14 @@ Fastest and cheapest way to get your own Lightning Node running - on a Raspberry
*The RaspiBlitz software is build and tested for the following Hardware set that you can buy cheap on Amazon.de:*
* RaspBerry Pi 3 (31,99 EUR) https://www.amazon.de/dp/B01CD5VC92
* Micro SD-Card 16GB (7,11 EUR) https://www.amazon.de/dp/B0162YQEIE
* Power >=3A (9,29 EUR) https://www.amazon.de/dp/B01E75SB2C
* 1TB Hard Drive (49,99 EUR) https://www.amazon.de/dp/B00KWHJY7Q
* RaspBerry Pi 3 (34,99 EUR) https://www.amazon.de/dp/B07BDR5PDW
* Micro SD-Card 16GB (7,99 EUR) https://www.amazon.de/gp/product/B073K14CVB/
* Power >=3A (9,99 EUR) https://www.amazon.de/gp/product/B078567K85
* 1TB Hard Drive (44,98 EUR) https://www.amazon.de/dp/B07997KKSK?th=1
* Case (9,36 EUR) https://www.amazon.de/dp/B0173GQF8Y
* LCD-Display (19,58 EUR) https://www.amazon.de/dp/B01JRUH0CY
* LCD-Display (16,88 EUR) https://www.amazon.de/gp/product/B06X191RX7
**Total Price: 127,31 EUR** (thats under 150 USD)
**Total Price: 124,19 EUR** (thats under 150 USD)
Amazon shopping lists for different countries:
[ [USA](shoppinglist_usa.md) ] [ [UK](shoppinglist_uk.md) ] [ [FR](shoppinglist_fr.md) ] [ [China](shoppinglist_cn.md) ]

18
build.sdcard/raspbianStretchDesktop.sh

@ -10,7 +10,7 @@
echo ""
echo "***************************************"
echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.93*"
echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.94*"
echo "***************************************"
echo ""
@ -117,13 +117,13 @@ sudo -u admin mkdir /home/admin/download
cd /home/admin/download
# download resources
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/test.rc4/bitcoin-${bitcoinVersion}rc4-arm-linux-gnueabihf.tar.gz
if [ ! -f "./bitcoin-${bitcoinVersion}rc4-arm-linux-gnueabihf.tar.gz" ]
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/bitcoin-${bitcoinVersion}-arm-linux-gnueabihf.tar.gz
if [ ! -f "./bitcoin-${bitcoinVersion}-arm-linux-gnueabihf.tar.gz" ]
then
echo "!!! FAIL !!! Download BITCOIN BINARY not success."
exit 1
fi
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/test.rc4/SHA256SUMS.asc
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc
if [ ! -f "./SHA256SUMS.asc" ]
then
echo "!!! FAIL !!! Download SHA256SUMS.asc not success."
@ -164,7 +164,7 @@ if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
fi
# install
sudo -u admin tar -xvf bitcoin-${bitcoinVersion}rc4-arm-linux-gnueabihf.tar.gz
sudo -u admin tar -xvf bitcoin-${bitcoinVersion}-arm-linux-gnueabihf.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-${bitcoinVersion}/bin/*
sleep 3
installed=$(sudo -u admin bitcoind --version | grep "${bitcoinVersion}" -c)
@ -244,16 +244,16 @@ echo "*** LND ***"
##### Build from Source
# To quickly catch up get latest patches if needed
repo="github.com/lightningnetwork/lnd"
commit="25145acc46cc5d18e4e348eed097300b1391d2a7"
commit="61e867741926bcb318432a6344b80161fabd1455"
# BUILDING LND FROM SOURCE
echo "*** Installing Go ***"
wget https://storage.googleapis.com/golang/go1.10.linux-armv6l.tar.gz
if [ ! -f "./go1.10.linux-armv6l.tar.gz" ]
wget https://storage.googleapis.com/golang/go1.11.linux-armv6l.tar.gz
if [ ! -f "./go1.11.linux-armv6l.tar.gz" ]
then
echo "!!! FAIL !!! Download not success."
exit 1
fi
sudo tar -C /usr/local -xzf go1.10.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.11.linux-armv6l.tar.gz
sudo rm *.gz
sudo mkdir /usr/local/gocode
sudo chmod 777 /usr/local/gocode

22
home.admin/00infoBlitz.sh

@ -115,24 +115,10 @@ if [ -n ${btc_path} ]; then
fi
# get IP address & port
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
public_ip=$(curl -s http://v4.ipv6-test.com/api/myip.php)
public_port=$(cat ${bitcoin_dir}/${network}.conf 2>/dev/null | grep port= | awk -F"=" '{print $2}')
if [ "${public_port}" = "" ]; then
if [ "${network}" = "litecoin" ]; then
if [ "${chain}" = "test" ]; then
public_port=19333
else
public_port=9333
fi
else
if [ "${chain}" = "test" ]; then
public_port=18333
else
public_port=8333
fi
fi
fi
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
# CHAIN NETWORK
public_addr="??"
@ -172,7 +158,7 @@ ln_baseInfo="-"
ln_channelInfo="\n"
ln_external=""
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c unlock)
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
if [ "$wallet_unlocked" -gt 0 ] ; then
alias_color="${color_red}"
ln_alias="Wallet Locked"
@ -186,7 +172,7 @@ else
if [ ${#ln_getInfo} -eq 0 ]; then
ln_baseInfo="${color_red} Not Started | Not Ready Yet"
else
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep "(height" | tail -n1 | awk '{print $10} {print $11} {print $12}' | tr -dc '0-9')
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep "(height" | tail -n1 | awk '{print $10} {print $11} {print $12}' | tr -dc '0-9')
total=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.blocks')
ln_baseInfo="${color_red} waiting for chain sync"
if [ ${#item} -gt 0 ]; then

4
home.admin/50downloadHDD.sh

@ -4,8 +4,8 @@ echo ""
# *** 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://f00f278f:download@w0189aba.kasserver.com/"
bitcoinSize=222000000 # 225096419-tolerance
bitcoinUrl="ftp://f00f39c4:download@w0189aba.kasserver.com/"
bitcoinSize=253000000 # 253827180-tolerance
# *** LITECOIN ***
litecoinList="" # url to list with other sources

6
home.admin/50torrentHDD.sh

@ -4,9 +4,9 @@ echo ""
# --> TODO: Check https://getbitcoinblockchain.com/
# *** BITCOIN Torrent ***
bitcoinTorrent="raspiblitz-bitcoin-2018-07-16"
bitcoinTorrentsize=231230404
bitcoinTorrent="raspiblitz-bitcoin-2018-10-06"
bitcoinTorrentsize=259000000
# *** LITECOIN Torrent ***
litecoinTorrent="raspiblitz-litecoin-2018-07-29"
litecoinTorrentsize=10240000

163
home.admin/AAunlockLND.py

@ -0,0 +1,163 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import os
import signal
import subprocess
import sys
from optparse import OptionParser
try: # make sure that (unsupported) Python2 can fail gracefully
import configparser
except ImportError:
pass
if sys.version_info < (3, 5, 0):
print("Python2 not supported! Please run with Python3.5+")
sys.exit(1)
def sigint_handler(signum, frame):
print('CTRL+C pressed - exiting!')
sys.exit(0)
def _read_pwd(password_file):
# read and convert password from file
p = subprocess.run("sudo cat {}".format(password_file),
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=False, shell=True, timeout=None)
if not p.returncode == 0:
print("unable to read password from: {}".format(password_file))
sys.exit(1)
passwd_bytes = p.stdout.split(b"\n")[0]
passwd_b64 = base64.encodebytes(passwd_bytes).decode('utf-8').split("\n")[0]
return passwd_b64
def _read_macaroon(lnd_macaroon_file):
# read and convert macaroon from file
p = subprocess.run("sudo xxd -ps -u -c 1000 {}".format(lnd_macaroon_file),
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True, shell=True, timeout=None)
macaroon_hex_dump = p.stdout.split("\n")[0]
return macaroon_hex_dump
def check_locked(password_file, lnd_cert_file, lnd_macaroon_file, host="localhost", port="8080", verbose=False):
# check locked
if verbose:
print("Checking for lock")
passwd_b64 = _read_pwd(password_file)
macaroon_hex_dump = _read_macaroon(lnd_macaroon_file)
cmds = ["curl", "-s",
"-H", "'Grpc-Metadata-macaroon: {}'".format(macaroon_hex_dump),
"--cacert", "{}".format(lnd_cert_file),
"-d", "{{\"wallet_password\": \"{}\"}}".format(passwd_b64),
"https://{}:{}/v1/getinfo".format(host, port)]
p = subprocess.run(cmds,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True, shell=False, timeout=None)
if not p.returncode == 0:
print("\033[91mSomething went wrong!\033[00m \033[93mIs lnd running? Wrong credentials?\033[00m")
# print("Returncode: {}".format(p.returncode))
# print("Stderr: {}".format(p.stderr))
sys.exit(1)
if p.stdout == "Not Found\n":
return True
else:
return False
def unlock(password_file, lnd_cert_file, lnd_macaroon_file, host="localhost", port="8080", verbose=False):
if verbose:
print("Trying to unlock")
passwd_b64 = _read_pwd(password_file)
macaroon_hex_dump = _read_macaroon(lnd_macaroon_file)
# unlock lnd by calling curl
cmds = ["curl", "-s",
"-H", "'Grpc-Metadata-macaroon: {}'".format(macaroon_hex_dump),
"--cacert", "{}".format(lnd_cert_file),
"-d", "{{\"wallet_password\": \"{}\"}}".format(passwd_b64),
"https://{}:{}/v1/unlockwallet".format(host, port)]
p = subprocess.run(cmds,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True, shell=False, timeout=None)
if p.returncode == 0:
return True
else:
if verbose:
print("\033[91mSomething went wrong!\033[00m \033[93mIs lnd running? Wrong credentials?\033[00m")
# print("Returncode: {}".format(p.returncode))
# print("Stderr: {}".format(p.stderr))
return False
def main():
signal.signal(signal.SIGINT, sigint_handler)
usage = "usage: %prog [Options]"
parser = OptionParser(usage=usage, version="%prog {}".format("0.1"))
parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
help="Print more output")
parser.add_option("-H", dest="host", type="string", default="localhost",
help="Host (default: localhost)")
parser.add_option("-P", dest="port", type="string", default="8080",
help="Port (default: 8080)")
parser.add_option("-p", dest="password_file", type="string", default="pwd",
help="File containing *cleartext* password (default: pwd)")
parser.add_option("-c", dest="cert", type="string",
help="TLS certificate file (e.g. ~/.lnd/tls.cert)"),
parser.add_option("-m", dest="macaroon", type="string",
help="Macaroon file (e.g. readonly.macaroon)")
options, args = parser.parse_args()
password_file = os.path.abspath(options.password_file)
if not os.path.exists(password_file):
print("Password file does not exist - exiting: {}".format(password_file))
sys.exit(1)
if options.cert:
lnd_cert_file = options.cert
else:
lnd_cert_file = "/home/bitcoin/.lnd/tls.cert"
if options.macaroon:
lnd_macaroon_file = options.macaroon
else:
lnd_macaroon_file = "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/readonly.macaroon"
if options.verbose:
print("Password File: \033[93m{}\033[00m".format(password_file))
print("TLS CERT File: \033[93m{}\033[00m".format(lnd_cert_file))
print("Macaroon File: \033[93m{}\033[00m".format(lnd_macaroon_file))
print("URL: \033[93mhttps://{}:{}\033[00m".format(options.host, options.port))
if check_locked(password_file, lnd_cert_file, lnd_macaroon_file,
host=options.host, port=options.port, verbose=options.verbose):
if options.verbose:
print("\033[93m{}\033[00m".format("Locked"))
else:
print("\033[92m{}\033[00m".format("Not Locked"))
sys.exit(1)
if unlock(password_file, lnd_cert_file, lnd_macaroon_file,
host=options.host, port=options.port, verbose=options.verbose):
print("\033[92m{}\033[00m".format("Successfully unlocked."))
else:
print("\033[91m{}\033[00m".format("Failed to unlock."))
if __name__ == "__main__":
main()

2
home.admin/BBfundWallet.sh

@ -57,7 +57,7 @@ echo "TODO"
echo "******************************"
echo "Send ${coininfo} to address --> ${address}"
if [ "$chain" = "test" ]; then
echo "get some testnet coins from https://testnet.manu.backend.hamburg/faucet"
echo "get some testnet coins from https://testnet-faucet.mempool.co"
fi
echo "Whats next? --> Wait for confirmations. You can use lnbalance for main menu or info on LCD to check if funds have arrived."
echo ""

9538
home.admin/assets/raspiblitz-bitcoin-2018-10-06.torrent

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save