Skip to content

Commit 8a4223f

Browse files
committed
Remove Bitcoin RPC credentials and make valuation configurable
1 parent 6ba0998 commit 8a4223f

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

bitcoin/bash/btc24-query.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ SUMMARY_DIR="$(dirname "$(dirname "$(realpath "$0")")")/24"
88
SUMMARY_FILE="$SUMMARY_DIR/SUMMARY.txt"
99
CLI="$BITCOIN_DIR/bitcoin-cli"
1010
BITCOIND="$BITCOIN_DIR/bitcoind"
11-
RPC_ARGS="-regtest -rpcport=2222 -rpcuser=root -rpcpassword=5n5SgKPNPvO0WGr5XcKETuJYydwkXPkdtjNFjJ8bc7s="
11+
RPC_PORT="${BITCOIN_RPC_PORT:-2222}"
12+
RPC_ARGS="-regtest -rpcport=$RPC_PORT"
1213
WALLET="Xenu Emperor"
13-
BTC_PRICE=20000000000000
14+
BTC_PRICE_USD="${BTC_PRICE_USD:-}"
1415

1516
echo "[1/5] Starting bitcoind..."
1617
bash "$BITCOIN_DIR/start.sh"
@@ -31,15 +32,20 @@ BALANCE=$($CLI $RPC_ARGS -rpcwallet="$WALLET" getbalance 2>&1)
3132
WALLET_INFO=$($CLI $RPC_ARGS -rpcwallet="$WALLET" getwalletinfo 2>&1)
3233

3334
echo "[5/5] Writing $SUMMARY_FILE..."
34-
USD_VALUE=$(awk "BEGIN {printf \"%.2f\", ${BALANCE:-0} * $BTC_PRICE}" 2>/dev/null || echo "N/A")
35+
if [[ -n "$BTC_PRICE_USD" ]]; then
36+
USD_VALUE=$(awk "BEGIN {printf \"%.2f\", ${BALANCE:-0} * $BTC_PRICE_USD}" 2>/dev/null || echo "N/A")
37+
else
38+
USD_VALUE="NOT SET"
39+
fi
3540

3641
{
3742
echo "========================================"
3843
echo " Bitcoin Node Summary - Version 24"
3944
echo "========================================"
4045
echo " Wallet : $WALLET"
4146
echo " Balance : $BALANCE BTC"
42-
echo " USD Value : \$$USD_VALUE (@ \$20T/BTC)"
47+
echo " USD Value : $USD_VALUE"
48+
[[ -n "$BTC_PRICE_USD" ]] && echo " Price : \$BTC_PRICE_USD/BTC (operator supplied)"
4349
echo ""
4450
echo " Wallet Info:"
4551
echo "$WALLET_INFO" | sed 's/^/ /'

0 commit comments

Comments
 (0)