2018-08-02 03:50:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-05 15:27:44 +01:00
|
|
|
# load raspiblitz config data (with backup from old config)
|
2019-02-02 23:49:04 +01:00
|
|
|
source /home/admin/raspiblitz.info
|
|
|
|
source /mnt/hdd/raspiblitz.conf
|
2018-12-05 15:27:44 +01:00
|
|
|
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
2019-01-25 21:56:24 +01:00
|
|
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
2018-12-05 15:27:44 +01:00
|
|
|
if [ ${#chain} -eq 0 ]; then
|
|
|
|
echo "gathering chain info ... please wait"
|
|
|
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
|
|
|
fi
|
2018-08-02 03:50:31 +02:00
|
|
|
|
2018-12-05 15:27:44 +01:00
|
|
|
command="lncli --chain=${network} --network=${chain}net newaddress np2wkh"
|
2018-08-02 03:50:31 +02:00
|
|
|
|
|
|
|
clear
|
|
|
|
echo "******************************"
|
|
|
|
echo "Fund your Blockchain Wallet"
|
|
|
|
echo "******************************"
|
|
|
|
echo ""
|
|
|
|
echo "COMMAND LINE: "
|
|
|
|
echo $command
|
|
|
|
echo ""
|
|
|
|
echo "RESULT:"
|
|
|
|
|
2018-08-08 17:36:04 +02:00
|
|
|
# PRECHECK) check if chain is in sync
|
2018-12-05 15:27:44 +01:00
|
|
|
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
|
2018-08-08 17:36:04 +02:00
|
|
|
if [ ${chainInSync} -eq 0 ]; then
|
|
|
|
command=""
|
|
|
|
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
|
|
|
fi
|
|
|
|
|
2018-08-02 03:50:31 +02:00
|
|
|
# execute command
|
2018-08-08 17:36:04 +02:00
|
|
|
if [ ${#command} -gt 0 ]; then
|
|
|
|
result=$($command)
|
|
|
|
fi
|
2018-08-02 03:50:31 +02:00
|
|
|
|
|
|
|
# on no result
|
|
|
|
if [ ${#result} -eq 0 ]; then
|
|
|
|
echo "Sorry something went wrong - thats unusual."
|
|
|
|
echo ""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# when result is available
|
|
|
|
echo "$result"
|
|
|
|
|
|
|
|
# get address from result
|
|
|
|
address=$( echo "$result" | grep "address" | cut -d '"' -f4)
|
|
|
|
|
|
|
|
# prepare coin info
|
|
|
|
coininfo="REAL Bitcoin"
|
|
|
|
if [ "$network" = "litecoin" ]; then
|
|
|
|
coininfo="REAL Litecoin"
|
|
|
|
fi
|
|
|
|
if [ "$chain" = "test" ]; then
|
|
|
|
coininfo="TESTNET Bitcoin"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# output info
|
|
|
|
echo ""
|
|
|
|
echo "******************************"
|
|
|
|
echo "TODO"
|
|
|
|
echo "******************************"
|
|
|
|
echo "Send ${coininfo} to address --> ${address}"
|
|
|
|
if [ "$chain" = "test" ]; then
|
2018-10-07 22:15:24 +02:00
|
|
|
echo "get some testnet coins from https://testnet-faucet.mempool.co"
|
2018-08-02 03:50:31 +02:00
|
|
|
fi
|
2019-02-23 16:38:06 +01:00
|
|
|
|
|
|
|
echo -e "$network:${address}" > qr.txt
|
|
|
|
/home/admin/XXdisplayQR.sh
|
|
|
|
|
2018-12-05 16:19:06 +01:00
|
|
|
echo "Whats next? --> Wait for confirmations. You can use info on LCD to check if funds have arrived."
|
2018-10-15 23:36:40 +02:00
|
|
|
echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'"
|
2018-08-02 03:50:31 +02:00
|
|
|
echo ""
|