57 lines
1.2 KiB
Bash
57 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
# This shouldn't be in the Dockerfile or containers built from the same image
|
|
# will have the same credentials.
|
|
if [ ! -e "$HOME/.bitcoin/bitcoin.conf" ]; then
|
|
mkdir -p $HOME/.bitcoin
|
|
|
|
echo "Creating bitcoin.conf"
|
|
|
|
# Seed a random password for JSON RPC server
|
|
cat <<EOF > $HOME/.bitcoin/bitcoin.conf
|
|
# network
|
|
mainnet=${MAINNET:-1}
|
|
testnet=${TESTNET:-0}
|
|
regtest=${REGTEST:-0}
|
|
|
|
# server
|
|
server=${SERVER:-1}
|
|
listen=${LISTEN:-1}
|
|
listenonion=${LISTENONION:-0}
|
|
daemon=${DAEMON:-0}
|
|
txindex=${TXINDEX=-1}
|
|
prune=${PRUNE=-0}
|
|
disablewallet=${DISABLEWALLET:-1}
|
|
printtoconsole=${PRINTTOCONSOLE:-1}
|
|
|
|
# rpc
|
|
rpcuser=${RPCUSER:-bitcoinrpc}
|
|
rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`}
|
|
#rpcconnect=${RPCCONNECT:-127.0.0.1}
|
|
#rpcport=${RPCPORT:-8332}
|
|
#rpcauth=${RPCAUTH:-xxx}
|
|
|
|
# performance
|
|
dbcache=${DBCACHE=-2000}
|
|
maxconnections=${MAXCONNECTIONS=-40}
|
|
maxuploadtarget=${MAXUPLOADTARGET=-5000}
|
|
|
|
# tor
|
|
#proxy=${PROXY:-127.0.0.1:9050}
|
|
#seednode=${SEEDNODE1:-nkf5e6b7pl4jfd4a.onion}
|
|
#seednode=${SEEDNODE2:-xqzfakpeuvrobvpj.onion}
|
|
#seednode=${SEEDNODE3:-tsyvzsqwa2kkf6b2.onion}
|
|
|
|
# validation
|
|
reindex-chainstate=${REINDEXCHAINSTATE=-0}
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cat $HOME/.bitcoin/bitcoin.conf
|
|
|
|
echo "Initialization completed successfully"
|