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

12 lines
262 B
Bash
Raw Normal View History

#!/bin/bash
set -eu
geth_endpoint="$1"
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