docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled

- 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>
This commit is contained in:
defiQUG
2026-02-12 15:46:57 -08:00
parent cc8dcaf356
commit fbda1b4beb
5114 changed files with 498901 additions and 4567 deletions

View File

@@ -1,5 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
# Error handling utilities
# err_exit is defined in load-project-env.sh when sourced; fallback here for standalone use
err_exit() { echo "ERROR: $1" >&2; exit 1; }
handle_rpc_error() {
local error="$1"

23
scripts/lib/ip-config.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Shared IP Configuration Module
# Source this file to load centralized IP addresses
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/ip-config.sh"
# Get script directory and project root
if [ -z "${SCRIPT_DIR:-}" ]; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
fi
# Load IP configuration
CONFIG_FILE="${PROJECT_ROOT}/config/ip-addresses.conf"
if [ -f "$CONFIG_FILE" ]; then
source "$CONFIG_FILE" 2>/dev/null || true
else
# Fallback values if config not found
PROXMOX_HOST_ML110="${PROXMOX_HOST_ML110:-192.168.11.10}"
PROXMOX_HOST_R630_01="${PROXMOX_HOST_R630_01:-192.168.11.11}"
PROXMOX_HOST_R630_02="${PROXMOX_HOST_R630_02:-192.168.11.12}"
IP_BLOCKSCOUT="${IP_BLOCKSCOUT:-192.168.11.140}"
NETWORK_GATEWAY="${NETWORK_GATEWAY:-192.168.11.1}"
fi

23
scripts/lib/ip-config.sh.bak Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Shared IP Configuration Module
# Source this file to load centralized IP addresses
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/ip-config.sh"
# Get script directory and project root
if [ -z "${SCRIPT_DIR:-}" ]; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
fi
# Load IP configuration
CONFIG_FILE="${PROJECT_ROOT}/config/ip-addresses.conf"
if [ -f "$CONFIG_FILE" ]; then
source "$CONFIG_FILE" 2>/dev/null || true
else
# Fallback values if config not found
PROXMOX_HOST_ML110="${PROXMOX_HOST_ML110:-192.168.11.10}"
PROXMOX_HOST_R630_01="${PROXMOX_HOST_R630_01:-192.168.11.11}"
PROXMOX_HOST_R630_02="${PROXMOX_HOST_R630_02:-192.168.11.12}"
IP_BLOCKSCOUT="${IP_BLOCKSCOUT:-192.168.11.140}"
NETWORK_GATEWAY="${NETWORK_GATEWAY:-192.168.11.1}"
fi

View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Load project environment: .env, config, and secrets
# No hardcoded IPs or secrets - all from config and .env
#
# Usage: source "${SCRIPT_DIR}/lib/load-project-env.sh"
#
# Env precedence (first wins): 1) .env 2) config/ip-addresses.conf 3) smom-dbis-138/.env 4) dbis_core config
# Version: 2026-01-31
[[ -n "${PROJECT_ROOT:-}" ]] || PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
export PROJECT_ROOT
# err_exit: print message and exit (use when load-project-env is sourced)
err_exit() { echo "ERROR: $1" >&2; exit 1; }
# Path validation
[[ -d "$PROJECT_ROOT" ]] || err_exit "PROJECT_ROOT not a directory: $PROJECT_ROOT"
[[ -f "${PROJECT_ROOT}/config/ip-addresses.conf" ]] || echo "WARN: config/ip-addresses.conf not found; using defaults" >&2
# 1. Root .env (Cloudflare, Proxmox, etc.)
[[ -f "${PROJECT_ROOT}/.env" ]] && set -a && source "${PROJECT_ROOT}/.env" 2>/dev/null && set +a
# 2. IP/config from centralized config
[[ -f "${PROJECT_ROOT}/config/ip-addresses.conf" ]] && source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# 3. smom-dbis-138 .env (PRIVATE_KEY, bridge addrs, RPC)
[[ -f "${PROJECT_ROOT}/smom-dbis-138/.env" ]] && set -a && source "${PROJECT_ROOT}/smom-dbis-138/.env" 2>/dev/null && set +a
# 4. dbis_core config if present
[[ -f "${PROJECT_ROOT}/dbis_core/config/dbis-core-proxmox.conf" ]] && source "${PROJECT_ROOT}/dbis_core/config/dbis-core-proxmox.conf" 2>/dev/null || true
# Ensure hosts have fallbacks (from config or defaults)
PROXMOX_HOST_R630_01="${PROXMOX_HOST_R630_01:-${PROXMOX_R630_01:-192.168.11.11}}"
PROXMOX_HOST_R630_02="${PROXMOX_HOST_R630_02:-${PROXMOX_R630_02:-192.168.11.12}}"
PROXMOX_HOST_ML110="${PROXMOX_HOST_ML110:-${PROXMOX_ML110:-192.168.11.10}}"
# Derived vars (from config; fallbacks for missing config)
export RPC_CORE_1="${RPC_CORE_1:-192.168.11.211}"
export RPC_URL_138="${RPC_URL_138:-http://${RPC_CORE_1}:8545}"
export CHAIN138_RPC="${CHAIN138_RPC_URL:-$RPC_URL_138}"
export SMOM_DIR="${SMOM_DBIS_138_DIR:-${PROJECT_ROOT}/smom-dbis-138}"
export DBIS_CORE_DIR="${DBIS_CORE_DIR:-${PROJECT_ROOT}/dbis_core}"
# VMID -> Proxmox host (for pct/qm operations)
# Covers: DBIS (101xx), RPC (2101, 2201, 2301, etc.), Blockscout (5000), CCIP (5400-5476), NPMplus (10233, 10234)
get_host_for_vmid() {
local vmid="$1"
case "$vmid" in
10130|10150|10151|106|107|108|10000|10001|10020|10100|10101|10120|10233|10235) echo "${PROXMOX_HOST_R630_01}";;
2101) echo "${PROXMOX_HOST_R630_01}";;
5000|7810|2201|2303|2401|6200|6201|10234|10237|5800) echo "${PROXMOX_HOST_R630_02}";;
2301|2400|1504|2503|2504|2505) echo "${PROXMOX_HOST_ML110}";;
5400|5401|5402|5403|5410|5411|5412|5413|5414|5415|5416|5417|5418|5419|5420|5421|5422|5423|5424|5425|5440|5441|5442|5443|5444|5445|5446|5447|5448|5449|5450|5451|5452|5453|5454|5455|5470|5471|5472|5473|5474|5475|5476) echo "${PROXMOX_HOST_R630_02}";;
*) echo "${PROXMOX_HOST_R630_01:-${PROXMOX_R630_02}}";;
esac
}

30
scripts/lib/logging.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Shared Logging Module
# Provides consistent logging functions across all scripts
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/logging.sh"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
NC='\033[0m' # No Color
# Logging functions
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
log_error() { echo -e "${RED}[✗]${NC} $1"; }
log_debug() { [ "${DEBUG:-0}" = "1" ] && echo -e "${CYAN}[DEBUG]${NC} $1" || true; }
log_section() { echo -e "${MAGENTA}════════════════════════════════════════${NC}"; }
# Section header
log_header() {
echo ""
log_section
log_info "$1"
log_section
echo ""
}

56
scripts/lib/proxmox-api.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Shared Proxmox API Module
# Provides common Proxmox API helper functions
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/proxmox-api.sh"
# Source dependencies
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/ip-config.sh" 2>/dev/null || true
source "$SCRIPT_DIR/logging.sh" 2>/dev/null || true
# Proxmox API functions
proxmox_api_call() {
local method="${1:-GET}"
local endpoint="${2:-}"
local data="${3:-}"
local host="${4:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if [ -z "$endpoint" ]; then
log_error "Proxmox API endpoint required"
return 1
fi
# Use token or password authentication
if [ -n "${PROXMOX_TOKEN:-}" ]; then
curl -s -X "$method" \
-H "Authorization: PVEAPIToken=$PROXMOX_TOKEN" \
-H "Content-Type: application/json" \
${data:+-d "$data"} \
"https://$host:8006/api2/json$endpoint"
else
log_warn "Proxmox token not configured, API calls may fail"
return 1
fi
}
# Check container status
check_container_status() {
local vmid="${1:-}"
local host="${2:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if [ -z "$vmid" ]; then
log_error "VMID required"
return 1
fi
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" \
"pct status $vmid 2>/dev/null | awk '{print \$2}'" || echo "unknown"
}
# List containers on host
list_containers() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" \
"pct list" 2>/dev/null || echo ""
}

56
scripts/lib/proxmox-api.sh.bak Executable file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Shared Proxmox API Module
# Provides common Proxmox API helper functions
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/proxmox-api.sh"
# Source dependencies
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/ip-config.sh" 2>/dev/null || true
source "$SCRIPT_DIR/logging.sh" 2>/dev/null || true
# Proxmox API functions
proxmox_api_call() {
local method="${1:-GET}"
local endpoint="${2:-}"
local data="${3:-}"
local host="${4:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if [ -z "$endpoint" ]; then
log_error "Proxmox API endpoint required"
return 1
fi
# Use token or password authentication
if [ -n "${PROXMOX_TOKEN:-}" ]; then
curl -s -X "$method" \
-H "Authorization: PVEAPIToken=$PROXMOX_TOKEN" \
-H "Content-Type: application/json" \
${data:+-d "$data"} \
"https://$host:8006/api2/json$endpoint"
else
log_warn "Proxmox token not configured, API calls may fail"
return 1
fi
}
# Check container status
check_container_status() {
local vmid="${1:-}"
local host="${2:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if [ -z "$vmid" ]; then
log_error "VMID required"
return 1
fi
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" \
"pct status $vmid 2>/dev/null | awk '{print \$2}'" || echo "unknown"
}
# List containers on host
list_containers() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" \
"pct list" 2>/dev/null || echo ""
}

52
scripts/lib/ssh-helpers.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Shared SSH Helper Module
# Provides common SSH utility functions
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/ssh-helpers.sh"
# Source dependencies
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/ip-config.sh" 2>/dev/null || true
source "$SCRIPT_DIR/logging.sh" 2>/dev/null || true
# SSH user: when using SSH + pct, root is not needed (use a user with pct permissions)
PROXMOX_SSH_USER="${PROXMOX_SSH_USER:-$USER}"
# SSH helper functions
ssh_proxmox() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
local command="${2:-}"
if [ -z "$command" ]; then
log_error "SSH command required"
return 1
fi
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "${PROXMOX_SSH_USER}@$host" "$command"
}
ssh_container() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
local vmid="${2:-}"
local command="${3:-}"
if [ -z "$vmid" ] || [ -z "$command" ]; then
log_error "VMID and command required"
return 1
fi
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "${PROXMOX_SSH_USER}@$host" \
"pct exec $vmid -- $command"
}
# Test SSH connectivity
test_ssh_connection() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "${PROXMOX_SSH_USER}@$host" "echo 'SSH OK'" >/dev/null 2>&1; then
log_success "SSH connection to $host: OK"
return 0
else
log_error "SSH connection to $host: FAILED"
return 1
fi
}

49
scripts/lib/ssh-helpers.sh.bak Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Shared SSH Helper Module
# Provides common SSH utility functions
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/ssh-helpers.sh"
# Source dependencies
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/ip-config.sh" 2>/dev/null || true
source "$SCRIPT_DIR/logging.sh" 2>/dev/null || true
# SSH helper functions
ssh_proxmox() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
local command="${2:-}"
if [ -z "$command" ]; then
log_error "SSH command required"
return 1
fi
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@"$host" "$command"
}
ssh_container() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
local vmid="${2:-}"
local command="${3:-}"
if [ -z "$vmid" ] || [ -z "$command" ]; then
log_error "VMID and command required"
return 1
fi
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@"$host" \
"pct exec $vmid -- $command"
}
# Test SSH connectivity
test_ssh_connection() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" "echo 'SSH OK'" >/dev/null 2>&1; then
log_success "SSH connection to $host: OK"
return 0
else
log_error "SSH connection to $host: FAILED"
return 1
fi
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
# Transaction logging utilities
LOG_DIR="${LOG_DIR:-/home/intlc/projects/proxmox/logs}"

View File

@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Shared VMID → IP mapping for Chain 138 / Proxmox
# Exports: VMID_VALIDATORS, VMID_SENTRIES, VMID_RPC, VMID_CURRENT_NODES,
# RPC_NODES, VALIDATOR_NODES, SENTRY_NODES, CURRENT_NODES, RPC_URL_138_DEFAULT
# Usage: source "${PROJECT_ROOT}/scripts/lib/vmid-ip-maps.sh"
# Resolve paths if not set
[[ -z "${PROJECT_ROOT:-}" ]] && PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
[[ -f "${PROJECT_ROOT}/config/ip-addresses.conf" ]] && source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# Validators (1000-1004)
declare -gA VMID_VALIDATORS=(
["1000"]="${IP_VALIDATOR_0:-192.168.11.100}"
["1001"]="${IP_VALIDATOR_1:-192.168.11.101}"
["1002"]="${IP_VALIDATOR_2:-192.168.11.102}"
["1003"]="${IP_VALIDATOR_3:-192.168.11.103}"
["1004"]="${IP_VALIDATOR_4:-192.168.11.104}"
)
# Sentries (1500-1503)
declare -gA VMID_SENTRIES=(
["1500"]="${IP_BESU_RPC_0:-192.168.11.150}"
["1501"]="${IP_BESU_RPC_1:-192.168.11.151}"
["1502"]="${IP_BESU_RPC_2:-192.168.11.152}"
["1503"]="${IP_BESU_RPC_3:-192.168.11.153}"
)
# RPC nodes (current active)
# 2101: admin/deployment; 2201: bridge, monitoring, public-facing (8545 HTTP, 8546 WS) — FIXED PERMANENT
declare -gA VMID_RPC=(
["2101"]="${RPC_CORE_1:-192.168.11.211}"
["2201"]="${RPC_PUBLIC_1:-192.168.11.221}"
["2400"]="${RPC_THIRDWEB_PRIMARY:-192.168.11.240}"
["2401"]="${RPC_THIRDWEB_1:-192.168.11.241}"
["2402"]="${RPC_THIRDWEB_2:-192.168.11.242}"
["2500"]="${RPC_ALLTRA_1:-192.168.11.250}"
["2501"]="${RPC_ALI_1:-192.168.11.251}"
["2502"]="${RPC_ALI_2:-192.168.11.252}"
["2503"]="${RPC_ALI_1_ALT:-192.168.11.253}"
["2504"]="${RPC_ALI_2_ALT:-192.168.11.254}"
["2505"]="${IP_VAULT_PHOENIX_2:-192.168.11.201}"
["2506"]="${IP_SERVICE_202:-192.168.11.202}"
["2507"]="${IP_SERVICE_203:-192.168.11.203}"
["2508"]="${IP_SERVICE_204:-192.168.11.204}"
)
# Combined current nodes (validators + sentries + rpc)
declare -gA VMID_CURRENT_NODES=()
for k in "${!VMID_VALIDATORS[@]}"; do VMID_CURRENT_NODES["$k"]="${VMID_VALIDATORS[$k]}"; done
for k in "${!VMID_SENTRIES[@]}"; do VMID_CURRENT_NODES["$k"]="${VMID_SENTRIES[$k]}"; done
for k in "${!VMID_RPC[@]}"; do VMID_CURRENT_NODES["$k"]="${VMID_RPC[$k]}"; done
# Aliases for backward compatibility
declare -gA RPC_NODES=()
declare -gA VALIDATOR_NODES=()
declare -gA SENTRY_NODES=()
declare -gA CURRENT_NODES=()
for k in "${!VMID_RPC[@]}"; do RPC_NODES["$k"]="${VMID_RPC[$k]}"; done
for k in "${!VMID_VALIDATORS[@]}"; do VALIDATOR_NODES["$k"]="${VMID_VALIDATORS[$k]}"; done
for k in "${!VMID_SENTRIES[@]}"; do SENTRY_NODES["$k"]="${VMID_SENTRIES[$k]}"; done
for k in "${!VMID_CURRENT_NODES[@]}"; do CURRENT_NODES["$k"]="${VMID_CURRENT_NODES[$k]}"; done
# Default RPC URL (admin: RPC_URL_138; public/bridge: RPC_URL_138_PUBLIC)
RPC_URL_138_DEFAULT="${RPC_URL_138:-http://${RPC_CORE_1:-192.168.11.211}:8545}"
RPC_URL_138_PUBLIC_DEFAULT="${RPC_URL_138_PUBLIC:-http://${RPC_PUBLIC_1:-192.168.11.221}:8545}"
WS_URL_138_PUBLIC_DEFAULT="${WS_URL_138_PUBLIC:-ws://${RPC_PUBLIC_1:-192.168.11.221}:8546}"