b0xxer af6443a5eb * doc requirements
* more docs
* changed btc_init to include more features and set txindex to 1
* masked rpm-ostree-countme timer
2024-02-12 07:01:09 -06:00

117 lines
2.6 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
#
# Environmental Variable Name List
#
# MAINNET
# TESTNET
# REGTEST
# MEMPOOLFULLRBF
# MAXMEMPOOL
# MEMPOOLEXPIRY
# PERSISTMEMPOOL
# MAXORPHANTX
# BANTIME
# SERVER
# LISTEN
# LISTENONION
# DAEMON
# TXINDEX
# PRUNE
# DISABLEWALLET
# PRINTCONSOLE
# WHITELIST
# RPCUSER
# RPCPASSWORD
# RPCCONNECT
# RPCPORT
# RPCAUTH
# DBCACHE
# MAXCONNECTIONS
# MAXUPLOADTARGET
# PROXY
# SEEDNODE1
# SEEDNODE2
# SEEDNODE3
# REINDEXCHAINSTATE
# network
# Choose what network to connect to (mutually exclusive choice)
mainnet=${MAINNET:-1}
testnet=${TESTNET:-0}
regtest=${REGTEST:-0}
# Allow all transactions to be replaced by RBF by default
mempoolfullrbf=${MEMPOOLFULLRBF:-1}
# Max size in MB for mempool memory reserve
maxmempool=${MAXMEMPOOL:-256}
# Max time in hours before old mempool items expire
mempoolexpiry=${MEMPOOLEXPIRY:-336}
blockfilterindex=${BLOCKFILTERINDEX:-1}
# Save mempool to disk on shutdown
persistmempool=${PERSISTMEMPOOL:-1}
# Max num of orphan tx to be kept
maxorphantx=${MAXORPHANTX:-50}
# Time in mins to ban bad peers
bantime=${BANTIME:-86400}
# 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`}
rpccookiefile=.cookie
#rpcconnect=${RPCCONNECT:-127.0.0.1}
#rpcport=${RPCPORT:-8332}
#rpcauth=${RPCAUTH:-xxx}
whitelist=${WHITELIST:-127.0.0.1}
# performance
#Max cache size of db in mb
dbcache=${DBCACHE:-2000}
maxconnections=${MAXCONNECTIONS:-75}
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"