Files
proxmox/scripts/archive/consolidated/fix/fix-thirdweb-peer-connectivity.sh.bak
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

112 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Fix ThirdWeb nodes peer connectivity (increase from 2 to 5-7 peers)
# Usage: ./fix-thirdweb-peer-connectivity.sh [proxmox-host]
set -e
PROXMOX_HOST="${1:-pve2}"
THIRDWEB_VMIDS=(2400 2401 2402)
echo "=========================================="
echo "Fix ThirdWeb Nodes Peer Connectivity"
echo "=========================================="
echo "Target: Increase peer count from 2 to 5-7"
echo "=========================================="
echo ""
# Function to execute command on Proxmox host
exec_proxmox() {
if command -v pct &>/dev/null; then
eval "$@"
else
ssh root@$PROXMOX_HOST "$@"
fi
}
# Check each ThirdWeb node
for VMID in "${THIRDWEB_VMIDS[@]}"; do
IP="192.168.11.24$((VMID - 2400))"
echo "=== VMID $VMID ($IP) ==="
# Get current peer count
PEER_RESPONSE=$(exec_proxmox "curl -s -X POST -H 'Content-Type: application/json' --data '{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":1}' http://$IP:8545 2>/dev/null" || echo "")
if [ -n "$PEER_RESPONSE" ]; then
PEER_HEX=$(echo "$PEER_RESPONSE" | grep -o '"result":"[^"]*"' | cut -d'"' -f4)
if [ -n "$PEER_HEX" ]; then
PEER_NUM=$(printf "%d" $PEER_HEX 2>/dev/null || echo "0")
else
PEER_NUM="N/A"
fi
else
PEER_NUM="N/A"
fi
echo "Current peer count: $PEER_NUM"
# Check static-nodes.json
echo "Checking static-nodes.json..."
STATIC_NODES=$(exec_proxmox "pct exec $VMID -- cat /var/lib/besu/static-nodes.json 2>/dev/null || pct exec $VMID -- cat /genesis/static-nodes.json 2>/dev/null || echo 'not found'" || echo "not found")
if [ "$STATIC_NODES" = "not found" ]; then
echo "⚠️ static-nodes.json not found"
else
NODE_COUNT=$(echo "$STATIC_NODES" | jq '. | length' 2>/dev/null || echo "0")
echo "Nodes in static-nodes.json: $NODE_COUNT"
if [ "$NODE_COUNT" -lt 10 ]; then
echo "⚠️ Only $NODE_COUNT nodes in static-nodes.json (should have 15)"
echo " Need to update static-nodes.json with all network nodes"
fi
fi
# Check discovery setting
echo "Checking discovery setting..."
DISCOVERY=$(exec_proxmox "pct exec $VMID -- grep -h 'discovery-enabled' /etc/besu/*.toml 2>/dev/null | head -1" || echo "")
if echo "$DISCOVERY" | grep -q "false"; then
echo "⚠️ Discovery is DISABLED"
echo " Should be enabled for RPC nodes to discover peers"
elif echo "$DISCOVERY" | grep -q "true"; then
echo "✅ Discovery is enabled"
else
echo "⚠️ Discovery setting not found"
fi
# Check permissions-nodes.toml
echo "Checking permissions-nodes.toml..."
PERM_NODES=$(exec_proxmox "pct exec $VMID -- cat /etc/besu/permissions-nodes.toml 2>/dev/null || pct exec $VMID -- cat /permissions/permissions-nodes.toml 2>/dev/null || echo 'not found'" || echo "not found")
if [ "$PERM_NODES" = "not found" ]; then
echo "⚠️ permissions-nodes.toml not found"
else
PERM_COUNT=$(echo "$PERM_NODES" | grep -c "nodes-allowlist" || echo "0")
echo "Permissions nodes configured: $PERM_COUNT"
fi
echo ""
done
echo "=========================================="
echo "Recommendations"
echo "=========================================="
echo ""
echo "1. Verify static-nodes.json contains all 15 nodes:"
echo " - 5 Validators (1000-1004)"
echo " - 4 Sentries (1500-1503)"
echo " - 6 RPC nodes (2101, 2201, 2303-2308)"
echo " - 3 ThirdWeb nodes (2400, 2401, 2402)"
echo ""
echo "2. Ensure discovery-enabled=true in config files"
echo ""
echo "3. Restart Besu services after updates"
echo ""
echo "4. Verify network connectivity (port 30303 open)"
echo ""
echo "Expected peer count after fix: 5-7 peers (current: 2 peers)"
echo ""
echo "To fix, run:"
echo " ./scripts/deploy-node-lists-to-all-nodes.sh"
echo " (This will sync static-nodes.json and permissions-nodes.toml to all nodes)"
echo ""