ipld-eth-db-validator/scripts/get-block-number.sh

13 lines
347 B
Bash
Raw Normal View History

#!/bin/bash
set -eu
2024-04-23 10:45:12 +00:00
geth_endpoint="${1:-$ETH_HTTP_PATH}"
latest_block_hex=$(curl -s $geth_endpoint -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":42}' | \
2024-07-24 08:38:09 +00:00
python3 -c 'import json, sys; print(int(json.load(sys.stdin)["result"], 16))' \
)
printf "%d" $latest_block_hex