2
0
mirror of https://github.com/lnbook/lnbook synced 2024-11-06 21:20:29 +00:00
lnbook/code/docker/bitcoind/mine.sh

20 lines
637 B
Bash
Raw Normal View History

#!/bin/bash
2020-06-15 14:40:11 +00:00
set -Eeuo pipefail
export address=`cat /bitcoind/keys/demo_address.txt`
echo "================================================"
echo "Balance:" `bitcoin-cli -datadir=/bitcoind getbalance`
echo "================================================"
echo "Mining 101 blocks to unlock some bitcoin"
bitcoin-cli -datadir=/bitcoind generatetoaddress 101 $address
echo "Mining 6 blocks every 10 seconds"
while echo "Balance:" `bitcoin-cli -datadir=/bitcoind getbalance`;
do
bitcoin-cli -datadir=/bitcoind generatetoaddress 6 $address; \
sleep 10; \
done
2020-06-15 14:40:11 +00:00
# If loop is interrupted, stop bitcoind
bitcoin-cli -datadir=/bitcoind stop