ipld-eth-db-validator/scripts/get-block-number.sh
2024-04-25 19:39:27 +08:00

12 lines
280 B
Bash
Executable File

#!/bin/bash
set -eu
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}' | \
jq -r .result)
printf "%d" $latest_block_hex