2020-06-11 02:46:55 +00:00
|
|
|
#!/bin/bash
|
2020-06-15 14:40:11 +00:00
|
|
|
set -Eeuo pipefail
|
2020-06-11 02:46:55 +00:00
|
|
|
|
2020-06-15 14:40:11 +00:00
|
|
|
echo Starting bitcoind...
|
2020-06-11 02:46:55 +00:00
|
|
|
bitcoind -datadir=/bitcoind -daemon
|
2021-08-25 19:15:48 +00:00
|
|
|
until bitcoin-cli -datadir=/bitcoind -rpcwait getblockchaininfo > /dev/null 2>&1
|
2020-06-15 14:40:11 +00:00
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo bitcoind started
|
2020-06-11 02:46:55 +00:00
|
|
|
export address=`cat /bitcoind/keys/demo_address.txt`
|
|
|
|
export privkey=`cat /bitcoind/keys/demo_privkey.txt`
|
|
|
|
echo "================================================"
|
|
|
|
echo "Importing demo private key"
|
|
|
|
echo "Bitcoin address: " ${address}
|
|
|
|
echo "Private key: " ${privkey}
|
|
|
|
echo "================================================"
|
2021-08-25 19:16:20 +00:00
|
|
|
# If restarting the wallet already exists, so don't fail if it does,
|
|
|
|
# just load the existing wallet:
|
|
|
|
bitcoin-cli -datadir=/bitcoind createwallet regtest || bitcoin-cli -datadir=/bitcoind loadwallet regtest
|
|
|
|
bitcoin-cli -datadir=/bitcoind importprivkey $privkey || true
|
2020-06-15 14:40:11 +00:00
|
|
|
|
|
|
|
# Executing CMD
|
|
|
|
echo "$@"
|
|
|
|
exec "$@"
|