raspiblitz/home.admin/config.scripts/network.txindex.sh
openoms bf480bd721
add BTC-RPC-Explorer and update RTL (#867)
Separated the NodeJS install script.
Update RTL to v0.5.4 and added automatic Hidden Service setup if Tor Active
 * add install script for BTC-RPC-Explorer
  * sets up a Hidden Service automatically
  * supports Electrs to look up addresses if installed
 * added a small script to enable txindex (needed for BTC-RPC-Explorer)

Detailed changes:
* nodeJS: add separate install script
* RTL: add Tor support and update
* BTC-RPC-Explorer: add install script
* btc-rpc-explorer: add script to activate txindex
* RTL: restart service if already installed
* RTL: opt out of data collection, start if installed
* rtl,btc-rpc-exp: Tor to forward to port 80
* btc-rpc-exp: add to SERVICES menu
2019-11-24 13:12:55 +00:00

40 lines
No EOL
1 KiB
Bash

#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch txindex on or off"
echo "network.txindex.sh [on|off]"
exit 1
fi
source /mnt/hdd/bitcoin/bitcoin.conf
# add default value to bitcoin.conf if needed
if [ ${#txindex} -eq 0 ]; then
echo "txindex=0" >> /mnt/hdd/bitcoin/bitcoin.conf
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
if [ ${txindex} == 0 ]; then
sudo sed -i "s/^txindex=.*/txindex=1/g" /mnt/hdd/bitcoin/bitcoin.conf
echo "switching txindex=1 and restarting bitcoind"
sudo systemctl restart bitcoind
echo "The indexing takes ~7h on an RPi4 with SSD"
echo "monitor with: sudo tail -n 20 -f /mnt/hdd/bitcoin/debug.log"
exit 0
else
echo "txindex is already active"
exit 0
fi
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo sed -i "s/^txindex=.*/txindex=0/g" /mnt/hdd/bitcoin/bitcoin.conf
sudo systemctl restart bitcoind
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1