add Sepolia RPC endpoints and minor improvements
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
5e4267fdde
commit
74f5c49997
@ -1,14 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
SEPOLIA_RPC=(
|
||||
"https://sepolia.drpc.org"
|
||||
"https://sepolia.gateway.tenderly.co"
|
||||
"https://api.zan.top/eth-sepolia"
|
||||
"https://rpc.sepolia.ethpandaops.io"
|
||||
"https://ethereum-sepolia-rpc.publicnode.com"
|
||||
"https://1rpc.io/sepolia"
|
||||
"https://0xrpc.io/sep"
|
||||
"https://eth-sepolia.api.onfinality.io/public"
|
||||
"https://ethereum-sepolia.rpc.thyme.sh/public"
|
||||
"https://gateway.tenderly.co/public/sepolia"
|
||||
"https://ethereum-sepolia-rpc.publicnode.com"
|
||||
"https://sepolia.gateway.tenderly.co"
|
||||
"https://eth-sepolia-testnet.api.pocket.network"
|
||||
"https://api.blockvectra.com/v1/eth_sepolia/public"
|
||||
"https://sepolia.rpc.sentio.xyz"
|
||||
"https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public"
|
||||
"https://public.1rpc.io/sepolia"
|
||||
"https://0xrpc.io/sep"
|
||||
|
||||
# "https://lb.routeme.sh/rpc/evm/11155111"
|
||||
# "https://api.zan.top/eth-sepolia"
|
||||
# "https://ethereum-sepolia.gateway.tatum.io"
|
||||
# "https://rpc.owlracle.info/sepolia/70d38ce1826c4a60bb2a8e05a6c8b20f"
|
||||
# "https://eth-sepolia.api.onfinality.io/public"
|
||||
)
|
||||
|
||||
MORDOR_RPC=(
|
||||
@ -23,6 +31,8 @@ HOODI_RPC=(
|
||||
"https://rpc.sentio.xyz/hoodi"
|
||||
)
|
||||
|
||||
MORDOR_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
||||
SEPOLIA_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
||||
HOODI_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
||||
|
||||
show_help() {
|
||||
@ -49,7 +59,7 @@ spinner() {
|
||||
|
||||
tput civis
|
||||
|
||||
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
|
||||
while [ "$(ps a | awk '{print $1}' | grep -w $pid)" ]; do
|
||||
local temp=${spinstr#?}
|
||||
printf "\r [%c] Checking %s... " "$spinstr" "$net_name"
|
||||
local spinstr=$temp${spinstr%"$temp"}
|
||||
@ -122,21 +132,26 @@ check_network() {
|
||||
|
||||
(
|
||||
for endpoint in "${rpcs[@]}"; do
|
||||
res_b=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 \
|
||||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' "$endpoint")
|
||||
hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
|
||||
[[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR"
|
||||
(
|
||||
res_b=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 \
|
||||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' "$endpoint")
|
||||
hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
|
||||
[[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR"
|
||||
|
||||
root="N/A"
|
||||
if [[ -n "$blk" && "$blk" != "ERROR" ]]; then
|
||||
calldata=$(build_calldata "$SELECTOR" "$blk")
|
||||
payload=$(printf '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"%s","data":"%s"},"latest"],"id":1}' "$gatekeeper" "$calldata")
|
||||
res_c=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 --data "$payload" "$endpoint")
|
||||
root=$(decode_get_root "$res_c")
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
echo "$endpoint|$blk|$root"
|
||||
root="N/A"
|
||||
if [[ -n "$blk" && "$blk" != "ERROR" ]]; then
|
||||
calldata=$(build_calldata "$SELECTOR" "$blk")
|
||||
payload=$(printf '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"%s","data":"%s"},"latest"],"id":1}' "$gatekeeper" "$calldata")
|
||||
res_c=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 --data "$payload" "$endpoint")
|
||||
root=$(decode_get_root "$res_c")
|
||||
fi
|
||||
|
||||
echo "$endpoint|$blk|$root"
|
||||
) &
|
||||
done
|
||||
wait
|
||||
) > "$tmp_file" &
|
||||
|
||||
local worker_pid=$!
|
||||
@ -173,28 +188,28 @@ SELECTOR="d4be7935"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--help) show_help ;;
|
||||
--help) show_help ;;
|
||||
--chain) CHOSEN_CHAIN="$2"; shift 2 ;;
|
||||
--output) BASE_OUT_DIR="$2"; shift 2 ;;
|
||||
--rpcs) CUSTOM_RPCS="$2"; shift 2 ;;
|
||||
--output) BASE_OUT_DIR="$2"; shift 2 ;;
|
||||
--rpcs) CUSTOM_RPCS="$2"; shift 2 ;;
|
||||
*) echo "Unknown option: $1. Use --help for usage."; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "$BASE_OUT_DIR" ]]; then
|
||||
OUT_DIR="${BASE_OUT_DIR}"
|
||||
OUT_DIR="${BASE_OUT_DIR}/$(date +%s)"
|
||||
mkdir -p "$OUT_DIR"
|
||||
fi
|
||||
|
||||
if [[ -n "$CUSTOM_RPCS" ]]; then
|
||||
IFS=',' read -r -a USER_RPC_ARRAY <<< "$CUSTOM_RPCS"
|
||||
check_network "Custom" "${USER_RPC_ARRAY[@]}"
|
||||
check_network "Custom" "${CUSTOM_GATEKEEPER:-$HOODI_GATEKEEPER}" "${USER_RPC_ARRAY[@]}"
|
||||
else
|
||||
if [ "$CHOSEN_CHAIN" == "sepolia" ]; then
|
||||
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${HOODI_RPC[@]}"
|
||||
elif [ "$CHOSEN_CHAIN" == "mordor" ]; then
|
||||
check_network "Mordor" "$MORDOR_GATEKEEPER" "${HOODI_RPC[@]}"
|
||||
elif [ "$CHOSEN_CHAIN" == "hoodi" ]; then
|
||||
if [[ "$CHOSEN_CHAIN" == "sepolia" ]]; then
|
||||
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${SEPOLIA_RPC[@]}"
|
||||
elif [[ "$CHOSEN_CHAIN" == "mordor" ]]; then
|
||||
check_network "Mordor" "$MORDOR_GATEKEEPER" "${MORDOR_RPC[@]}"
|
||||
elif [[ "$CHOSEN_CHAIN" == "hoodi" ]]; then
|
||||
check_network "Hoodi" "$HOODI_GATEKEEPER" "${HOODI_RPC[@]}"
|
||||
else
|
||||
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${SEPOLIA_RPC[@]}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user