69 lines
1.9 KiB
Bash
69 lines
1.9 KiB
Bash
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
mkdir -p $HOME/.bitcoin
|
|
|
|
if [ -f "$HOME/.bitcoin/bitcoin.conf" ];
|
|
then
|
|
echo "Backing up bitcoin.conf"
|
|
TMPEXT=$(date +%Y.%m.%d.%H.%M.%S)
|
|
mv $HOME/.bitcoin/bitcoin.conf $HOME/.bitcoin/bitcoin.conf.bak.$TMPEXT
|
|
fi
|
|
|
|
echo "Creating bitcoin.conf"
|
|
|
|
# Seed a random password for JSON RPC server
|
|
cat <<EOF > $HOME/.bitcoin/bitcoin.conf
|
|
#
|
|
#Do not modify this file as it is autogenerated.
|
|
#You can either (a) Modify this template "btc_init" in build or
|
|
# (b) You can pass a variable name as env variable during container launch
|
|
# The variable names are printed to right of each item
|
|
#
|
|
|
|
|
|
# network
|
|
mainnet=${MAINNET:-1} # MAINNET
|
|
testnet=${TESTNET:-0} # TESTNET
|
|
regtest=${REGTEST:-0} # REGTEST
|
|
|
|
# server
|
|
server=${SERVER:-1} # SERVER
|
|
listen=${LISTEN:-1} # LISTEN
|
|
listenonion=${LISTENONION:-0} # LISTENONION
|
|
daemon=${DAEMON:-0} # DAEMON
|
|
txindex=${TXINDEX=-1} # TXINDEX
|
|
prune=${PRUNE=-0} # PRUNE
|
|
disablewallet=${DISABLEWALLET:-1} # DISABLEWALLET
|
|
printtoconsole=${PRINTTOCONSOLE:-1} # PRINTCONSOLE
|
|
|
|
# rpc
|
|
rpcuser=${RPCUSER:-bitcoinrpc} # RPCUSER
|
|
rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`} # RPCPASSWORD
|
|
#rpcconnect=${RPCCONNECT:-127.0.0.1} # RPCCONNECT
|
|
#rpcport=${RPCPORT:-8332} # RPCPORT
|
|
#rpcauth=${RPCAUTH:-xxx} # RPCPORT
|
|
|
|
# performance
|
|
dbcache=${DBCACHE=-2000} # DBCACHE
|
|
maxconnections=${MAXCONNECTIONS=-40} # MAXCONNECTIONS
|
|
maxuploadtarget=${MAXUPLOADTARGET=-5000} # MAXUPLOADTARGET
|
|
|
|
# tor
|
|
#proxy=${PROXY:-127.0.0.1:9050} # PROXY
|
|
#seednode=${SEEDNODE1:-nkf5e6b7pl4jfd4a.onion} # SEEDNODE1
|
|
#seednode=${SEEDNODE2:-xqzfakpeuvrobvpj.onion} # SEEDNODE2
|
|
#seednode=${SEEDNODE3:-tsyvzsqwa2kkf6b2.onion} # SEEDNODE3
|
|
|
|
# validation
|
|
reindex-chainstate=${REINDEXCHAINSTATE=-0} # REINDEXCHAINSTATE
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cat $HOME/.bitcoin/bitcoin.conf
|
|
|
|
echo "Initialization completed successfully"
|