#!/bin/bash # # Bitcoin Core Setup Script for Archipelago # Sets up Bitcoin Core in a Podman container # set -e echo "" echo "╔═══════════════════════════════════════════════════════════╗" echo "║ ₿ BITCOIN CORE SETUP ║" echo "╚═══════════════════════════════════════════════════════════╝" echo "" # Check if running as root if [ "$EUID" -eq 0 ]; then echo "⚠️ Running as root. For rootless Podman, run as regular user." fi # Check for Podman if ! command -v podman >/dev/null 2>&1; then echo "📦 Installing Podman..." sudo apt-get update sudo apt-get install -y podman podman-compose fi # Create data directory BITCOIN_DATA="${HOME}/.bitcoin" mkdir -p "$BITCOIN_DATA" echo "📍 Bitcoin data directory: $BITCOIN_DATA" echo "" # Ask for configuration echo "Bitcoin Core Configuration:" echo "" read -p "Enable pruning? (saves disk space) [y/N]: " PRUNE read -p "Enable txindex? (required for some apps) [y/N]: " TXINDEX read -p "RPC username [bitcoin]: " RPC_USER RPC_USER=${RPC_USER:-bitcoin} read -p "RPC password [randomly generated]: " RPC_PASS if [ -z "$RPC_PASS" ]; then RPC_PASS=$(openssl rand -hex 16) echo " Generated RPC password: $RPC_PASS" fi # Create bitcoin.conf cat > "$BITCOIN_DATA/bitcoin.conf" <> "$BITCOIN_DATA/bitcoin.conf" echo " Pruning enabled (550MB)" fi if [[ "$TXINDEX" =~ ^[Yy]$ ]]; then echo "txindex=1" >> "$BITCOIN_DATA/bitcoin.conf" echo " Transaction index enabled" fi echo "" echo "📋 Created bitcoin.conf" echo "" # Pull Bitcoin Core image echo "🐳 Pulling Bitcoin Core container image..." podman pull docker.io/lncm/bitcoind:v27.0 # Create systemd user service for Bitcoin Core mkdir -p ~/.config/systemd/user cat > ~/.config/systemd/user/bitcoind.service <