From 889dc670210e2d3a3134285156c7a3d1ffcbcb4d Mon Sep 17 00:00:00 2001 From: GeneratedUserFJ839 Date: Tue, 16 Dec 2025 12:54:18 +0100 Subject: [PATCH] tools: add http json-rpc reachability check Adds check_http_rpc.sh, a small script that sends a web3_clientVersion request to confirm HTTP RPC reachability. --- scripts/check_http_rpc.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/check_http_rpc.sh diff --git a/scripts/check_http_rpc.sh b/scripts/check_http_rpc.sh new file mode 100644 index 0000000000..b99fd4b3a9 --- /dev/null +++ b/scripts/check_http_rpc.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Simple helper to verify that an HTTP JSON-RPC endpoint is reachable. +# +# Usage: +# ./scripts/check_http_rpc.sh +# RPC_URL=http://10.0.0.5:8545 ./scripts/check_http_rpc.sh + +RPC_URL="${RPC_URL:-http://127.0.0.1:8545}" + +echo "Checking HTTP JSON-RPC endpoint: ${RPC_URL}" +echo + +payload='{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' + +response="$(curl -s -X POST "${RPC_URL}" -H "Content-Type: application/json" -d "${payload}")" + +if [ -z "${response}" ]; then + echo "No response received. Is the node running and HTTP enabled?" + exit 1 +fi + +echo "Raw response:" +echo "${response}" +echo +echo "If this includes a valid client version string, the HTTP JSON-RPC endpoint is working."