Files
proxmox/scripts/diagnose-rpc-response.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

70 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Diagnose raw HTTP response from public RPC endpoints (to debug E2E failures).
# Usage: ./scripts/diagnose-rpc-response.sh
# Run from a host that can reach 76.53.10.36 (same as E2E).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
log_section() { echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n${CYAN}$1${NC}\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"; }
RPC_TIMEOUT=${RPC_TIMEOUT:-15}
BODY_MAX=600
urls=(
"https://rpc-http-pub.d-bis.org"
"https://rpc.d-bis.org"
"https://rpc.public-0138.defi-oracle.io"
"https://rpc.defi-oracle.io"
)
log_section "RPC response diagnostic (eth_blockNumber)"
echo "Timeout: ${RPC_TIMEOUT}s. Showing HTTP code and first ${BODY_MAX} chars of body."
echo ""
for url in "${urls[@]}"; do
echo -e "${CYAN}--- $url ---${NC}"
out=$(curl -s -w "\n%{http_code}" -m "$RPC_TIMEOUT" -X POST "$url" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' 2>/dev/null) || true
body=$(echo "$out" | head -n -1)
code=$(echo "$out" | tail -n 1)
if [ -z "$code" ]; then
code="(timeout or no response)"
fi
echo "HTTP code: $code"
if [ -n "$body" ]; then
echo "Body (first ${BODY_MAX} chars):"
echo "$body" | head -c "$BODY_MAX"
echo ""
if echo "$body" | jq -e '.result' >/dev/null 2>&1; then
echo -e "${GREEN}[✓] Valid JSON with .result${NC}"
else
echo -e "${YELLOW}[?] No .result or invalid JSON (may be HTML/502)${NC}"
fi
else
echo -e "${RED}(empty body)${NC}"
fi
echo ""
done
log_section "Direct backend (LAN only)"
echo "If this host can reach 192.168.11.221 (Besu RPC), testing direct eth_blockNumber:"
direct=$(curl -s -m 5 -X POST "http://192.168.11.221:8545" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' 2>/dev/null) || direct="(unreachable or timeout)"
if echo "$direct" | jq -e '.result' >/dev/null 2>&1; then
echo -e "${GREEN}192.168.11.221:8545 — OK: $direct${NC}"
else
echo "192.168.11.221:8545 — $direct"
fi
echo ""
echo "If public URLs fail but 192.168.11.221 works: NPMplus proxy hosts (rpc-http-pub.d-bis.org → 192.168.11.221:8545) may be wrong or NPMplus cannot reach 192.168.11.221."
echo "If both fail: Besu (VMID 2201) may be down or not listening on 8545."