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
|
#!/bin/bash
|
||||||
|
|
||||||
SEPOLIA_RPC=(
|
SEPOLIA_RPC=(
|
||||||
"https://sepolia.drpc.org"
|
"https://ethereum-sepolia.rpc.thyme.sh/public"
|
||||||
"https://sepolia.gateway.tenderly.co"
|
"https://gateway.tenderly.co/public/sepolia"
|
||||||
"https://api.zan.top/eth-sepolia"
|
"https://ethereum-sepolia-rpc.publicnode.com"
|
||||||
"https://rpc.sepolia.ethpandaops.io"
|
"https://sepolia.gateway.tenderly.co"
|
||||||
"https://ethereum-sepolia-rpc.publicnode.com"
|
"https://eth-sepolia-testnet.api.pocket.network"
|
||||||
"https://1rpc.io/sepolia"
|
"https://api.blockvectra.com/v1/eth_sepolia/public"
|
||||||
"https://0xrpc.io/sep"
|
"https://sepolia.rpc.sentio.xyz"
|
||||||
"https://eth-sepolia.api.onfinality.io/public"
|
"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=(
|
MORDOR_RPC=(
|
||||||
@ -23,6 +31,8 @@ HOODI_RPC=(
|
|||||||
"https://rpc.sentio.xyz/hoodi"
|
"https://rpc.sentio.xyz/hoodi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
MORDOR_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
||||||
|
SEPOLIA_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
||||||
HOODI_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
HOODI_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
@ -49,7 +59,7 @@ spinner() {
|
|||||||
|
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
|
while [ "$(ps a | awk '{print $1}' | grep -w $pid)" ]; do
|
||||||
local temp=${spinstr#?}
|
local temp=${spinstr#?}
|
||||||
printf "\r [%c] Checking %s... " "$spinstr" "$net_name"
|
printf "\r [%c] Checking %s... " "$spinstr" "$net_name"
|
||||||
local spinstr=$temp${spinstr%"$temp"}
|
local spinstr=$temp${spinstr%"$temp"}
|
||||||
@ -122,21 +132,26 @@ check_network() {
|
|||||||
|
|
||||||
(
|
(
|
||||||
for endpoint in "${rpcs[@]}"; do
|
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")
|
res_b=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 \
|
||||||
hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
|
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' "$endpoint")
|
||||||
[[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR"
|
hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
|
||||||
|
[[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR"
|
||||||
|
|
||||||
root="N/A"
|
sleep 1
|
||||||
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"
|
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
|
done
|
||||||
|
wait
|
||||||
) > "$tmp_file" &
|
) > "$tmp_file" &
|
||||||
|
|
||||||
local worker_pid=$!
|
local worker_pid=$!
|
||||||
@ -173,28 +188,28 @@ SELECTOR="d4be7935"
|
|||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--help) show_help ;;
|
--help) show_help ;;
|
||||||
--chain) CHOSEN_CHAIN="$2"; shift 2 ;;
|
--chain) CHOSEN_CHAIN="$2"; shift 2 ;;
|
||||||
--output) BASE_OUT_DIR="$2"; shift 2 ;;
|
--output) BASE_OUT_DIR="$2"; shift 2 ;;
|
||||||
--rpcs) CUSTOM_RPCS="$2"; shift 2 ;;
|
--rpcs) CUSTOM_RPCS="$2"; shift 2 ;;
|
||||||
*) echo "Unknown option: $1. Use --help for usage."; exit 1 ;;
|
*) echo "Unknown option: $1. Use --help for usage."; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$BASE_OUT_DIR" ]]; then
|
if [[ -n "$BASE_OUT_DIR" ]]; then
|
||||||
OUT_DIR="${BASE_OUT_DIR}"
|
OUT_DIR="${BASE_OUT_DIR}/$(date +%s)"
|
||||||
mkdir -p "$OUT_DIR"
|
mkdir -p "$OUT_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$CUSTOM_RPCS" ]]; then
|
if [[ -n "$CUSTOM_RPCS" ]]; then
|
||||||
IFS=',' read -r -a USER_RPC_ARRAY <<< "$CUSTOM_RPCS"
|
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
|
else
|
||||||
if [ "$CHOSEN_CHAIN" == "sepolia" ]; then
|
if [[ "$CHOSEN_CHAIN" == "sepolia" ]]; then
|
||||||
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${HOODI_RPC[@]}"
|
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${SEPOLIA_RPC[@]}"
|
||||||
elif [ "$CHOSEN_CHAIN" == "mordor" ]; then
|
elif [[ "$CHOSEN_CHAIN" == "mordor" ]]; then
|
||||||
check_network "Mordor" "$MORDOR_GATEKEEPER" "${HOODI_RPC[@]}"
|
check_network "Mordor" "$MORDOR_GATEKEEPER" "${MORDOR_RPC[@]}"
|
||||||
elif [ "$CHOSEN_CHAIN" == "hoodi" ]; then
|
elif [[ "$CHOSEN_CHAIN" == "hoodi" ]]; then
|
||||||
check_network "Hoodi" "$HOODI_GATEKEEPER" "${HOODI_RPC[@]}"
|
check_network "Hoodi" "$HOODI_GATEKEEPER" "${HOODI_RPC[@]}"
|
||||||
else
|
else
|
||||||
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${SEPOLIA_RPC[@]}"
|
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${SEPOLIA_RPC[@]}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user