#!/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 < $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 # # Environmental Variable Name List # # MAINNET # TESTNET # REGTEST # SERVER # LISTEN # LISTENONION # DAEMON # TXINDEX # PRUNE # DISABLEWALLET # PRINTCONSOLE # RPCUSER # RPCPASSWORD # RPCCONNECT # RPCPORT # RPCAUTH # DBCACHE # MAXCONNECTIONS # MAXUPLOADTARGET # PROXY # SEEDNODE1 # SEEDNODE2 # SEEDNODE3 # REINDEXCHAINSTATE # 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 cat $HOME/.bitcoin/bitcoin.conf echo "Initialization completed successfully"