Files
proxmox/scripts/besu/collect-enodes-and-ips.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

88 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# Collect Enodes and IP Addresses for Specific VMIDs
# Queries running nodes for enodes and extracts IPs from config
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
log_section() { echo -e "\n${CYAN}=== $1 ===${NC}"; }
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.10}"
RPC_PORT=8545
# VMIDs to query
declare -a VMIDS=(
"2101:besu-rpc-core-1"
"2201:besu-rpc-public-1"
"2301:besu-rpc-private-1"
"2303:besu-rpc-ali-0x8a"
"2304:besu-rpc-ali-0x1"
"2305:besu-rpc-luis-0x8a"
"2306:besu-rpc-luis-0x1"
"2307:besu-rpc-putu-0x8a"
"2308:besu-rpc-putu-0x1"
"2400:thirdweb-rpc-1"
"2401:besu-rpc-thirdweb-0x8a-1"
"2402:besu-rpc-thirdweb-0x8a-2"
"2403:besu-rpc-thirdweb-0x8a-3"
)
log_section "Collecting Enodes and IPs"
echo ""
printf "%-8s %-15s %-35s %-80s\n" "VMID" "IP Address" "Hostname" "Enode"
echo "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────"
for entry in "${VMIDS[@]}"; do
IFS=':' read -r vmid hostname <<< "$entry"
# Get IP from container config
ip=$(ssh -o ConnectTimeout=2 root@"$PROXMOX_HOST" "pct config $vmid 2>/dev/null | grep -oP 'ip=\K[^,]+' | head -1 | cut -d'/' -f1" 2>/dev/null || echo "N/A")
# Get status
status=$(ssh -o ConnectTimeout=2 root@"$PROXMOX_HOST" "pct status $vmid 2>/dev/null | awk '{print \$2}'" 2>/dev/null || echo "unknown")
enode="N/A"
if [ "$status" = "running" ] && [ "$ip" != "N/A" ]; then
# Try to get enode via admin_nodeInfo
rpc_url="http://${ip}:${RPC_PORT}"
enode=$(cast rpc admin_nodeInfo "$rpc_url" 2>/dev/null | jq -r '.enode' 2>/dev/null || echo "N/A")
if [ "$enode" = "null" ] || [ -z "$enode" ]; then
enode="N/A (RPC failed)"
fi
elif [ "$status" != "running" ]; then
enode="N/A (stopped)"
else
enode="N/A (no IP)"
fi
printf "%-8s %-15s %-35s %-80s\n" "$vmid" "$ip" "$hostname" "$enode"
done
echo ""