Add:gen-bitcoin.conf script
This commit is contained in:
parent
17d0d032d7
commit
dbc4e523ab
@ -0,0 +1,63 @@
|
|||||||
|
SIGNETCHALLENGE=${SIGNETCHALLENGE:-$(cat ~/.bitcoin/SIGNETCHALLENGE.txt)}
|
||||||
|
|
||||||
|
RPCAUTH=$(/usr/local/bin/rpcauth.py $RPCUSER $RPCPASSWORD | tr -d '\n')
|
||||||
|
echo "signet=1"
|
||||||
|
|
||||||
|
if [[ "$COOKIEFILE" == "true" ]]; then
|
||||||
|
echo "rpccookiefile=/root/.bitcoin/.cookie
|
||||||
|
rpcauth=$RPCAUTH"
|
||||||
|
else
|
||||||
|
echo "rpcauth=$RPCAUTH
|
||||||
|
rpcuser=$RPCUSER
|
||||||
|
rpcpassword=$RPCPASSWORD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "txindex=1
|
||||||
|
blockfilterindex=1
|
||||||
|
peerblockfilters=1
|
||||||
|
coinstatsindex=1
|
||||||
|
dnsseed=0
|
||||||
|
persistmempool=1
|
||||||
|
uacomment=$UACOMMENT"
|
||||||
|
|
||||||
|
if [[ "$EXTERNAL_IP" != "" ]]; then
|
||||||
|
echo $EXTERNAL_IP | tr ',' '\n' | while read ip; do
|
||||||
|
echo "externalip=$ip"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[signet]
|
||||||
|
daemon=1
|
||||||
|
listen=1
|
||||||
|
server=1
|
||||||
|
discover=1
|
||||||
|
signetchallenge=$SIGNETCHALLENGE
|
||||||
|
zmqpubrawblock=$ZMQPUBRAWBLOCK
|
||||||
|
zmqpubrawtx=$ZMQPUBRAWTX
|
||||||
|
zmqpubhashblock=$ZMQPUBHASHBLOCK
|
||||||
|
rpcbind=$RPCBIND
|
||||||
|
rpcallowip=$RPCALLOWIP
|
||||||
|
whitelist=$WHITELIST
|
||||||
|
fallbackfee=0.0002"
|
||||||
|
|
||||||
|
if [[ "$ADDNODE" != "" ]]; then
|
||||||
|
echo $ADDNODE | tr ',' '\n' | while read node; do
|
||||||
|
echo "addnode=$node"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$I2PSAM" != "" ]]; then
|
||||||
|
echo "i2psam=$I2PSAM"
|
||||||
|
fi
|
||||||
|
if [[ "$ONIONPROXY" != "" ]]; then
|
||||||
|
echo "onion=$ONIONPROXY" # unless have static IP won't resolve the control port as domain
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$TORPASSWORD" != "" ]]; then
|
||||||
|
echo "torpassword=$TORPASSWORD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$TORCONTROL" != "" ]]; then
|
||||||
|
echo "torcontrol=$TORCONTROL"
|
||||||
|
fi
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
DATADIR=${DATADIR:-"regtest-temp"}
|
||||||
|
BITCOINCLI=${BITCOINCLI:-"bitcoin-cli -regtest -datadir=$DATADIR "}
|
||||||
|
BITCOIND=${BITCOIND:-"bitcoind -datadir=$DATADIR -regtest -daemon "}
|
||||||
|
|
||||||
|
write_files() {
|
||||||
|
# echo "ADDR=" $ADDR
|
||||||
|
echo "PRIVKEY=" $PRIVKEY
|
||||||
|
# echo "PUBKEY=" $PUBKEY
|
||||||
|
echo "SIGNETCHALLENGE=" $SIGNETCHALLENGE
|
||||||
|
# echo $ADDR > ~/.bitcoin/ADDR.txt
|
||||||
|
echo $PRIVKEY >~/.bitcoin/PRIVKEY.txt
|
||||||
|
# echo $PUBKEY > ~/.bitcoin/PUBKEY.txt
|
||||||
|
echo $SIGNETCHALLENGE >~/.bitcoin/SIGNETCHALLENGE.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$MINERENABLED" == "1" && ("$SIGNETCHALLENGE" == "" || "$PRIVKEY" == "") ]]; then
|
||||||
|
echo "Generating new signetchallange and privkey."
|
||||||
|
#clean if exists
|
||||||
|
rm -rf $DATADIR
|
||||||
|
#make it fresh
|
||||||
|
mkdir $DATADIR
|
||||||
|
#kill any daemon running stuff
|
||||||
|
pkill bitcoind
|
||||||
|
#minimal config file (hardcode bitcoin:bitcoin for rpc)
|
||||||
|
echo "
|
||||||
|
regtest=1
|
||||||
|
server=1
|
||||||
|
rpcauth=bitcoin:c8c8b9740a470454255b7a38d4f38a52\$e8530d1c739a3bb0ec6e9513290def11651afbfd2b979f38c16ec2cf76cf348a
|
||||||
|
rpcuser=bitcoin
|
||||||
|
rpcpassword=bitcoin
|
||||||
|
" >$DATADIR/bitcoin.conf
|
||||||
|
#start daemon
|
||||||
|
$BITCOIND -wallet="temp"
|
||||||
|
#wait a bit for startup
|
||||||
|
sleep 5s
|
||||||
|
#create wallet
|
||||||
|
# todo, redo to work with descriptors
|
||||||
|
$BITCOINCLI -named createwallet wallet_name="tmp" descriptors=false
|
||||||
|
#export future signet seeding key data
|
||||||
|
ADDR=$($BITCOINCLI getnewaddress)
|
||||||
|
PRIVKEY=$($BITCOINCLI dumpprivkey $ADDR)
|
||||||
|
PUBKEY=$($BITCOINCLI getaddressinfo $ADDR | jq .pubkey | tr -d '""')
|
||||||
|
#don't need regtest anymore
|
||||||
|
$BITCOINCLI stop
|
||||||
|
SIGNETCHALLENGE=$(echo '5121'$PUBKEY'51ae')
|
||||||
|
|
||||||
|
#cleanup
|
||||||
|
rm -rf $DATADIR
|
||||||
|
else
|
||||||
|
echo "Imported signetchallange and privkey being used."
|
||||||
|
fi
|
||||||
|
|
||||||
|
write_files
|
||||||
Loading…
x
Reference in New Issue
Block a user