Skip to content

Instantly share code, notes, and snippets.

@SuperCipher
Last active January 25, 2022 05:59
Show Gist options
  • Save SuperCipher/5d5d01cacb557b2d6cfd7481fba6b4f2 to your computer and use it in GitHub Desktop.
Save SuperCipher/5d5d01cacb557b2d6cfd7481fba6b4f2 to your computer and use it in GitHub Desktop.
Eth JSON RPC status

Get current block:

curl '172.21.0.3:8545' -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'

result

 { "id":83, "jsonrpc": "2.0", "result": "0x4b7"  }

or

curl '172.21.0.3:8545' -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'

Result

{ "id":1, "jsonrpc": "2.0", "result": { startingBlock: '0x384', currentBlock: '0x386', highestBlock: '0x454' } }

Or when not syncing

{ "id":1, "jsonrpc": "2.0", "result": false }

Get number of txs in mempool:

curl --data '{"method":"txpool_status","id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST '172.21.0.3:8545'

result

{"jsonrpc":"2.0","id":1,"result":{"pending":"0x0","queued":"0x0"}}

Balance galance of a known good account

curl --location --request POST 'https://main-light.eth.linkpool.io' \
--header 'Content-Type: application/json' \
--data-raw '{
        "jsonrpc":"2.0",
        "method":"eth_getBalance",
        "params":[
                "0x62168f743A1eA7eD583eB7F5Fb35e2409f409361",
                "latest"
        ],
        "id":1
}'
{"jsonrpc":"2.0","id":1,"result":"0x382c0adc13151b0"}

result

{"jsonrpc":"2.0","id":1,"result":"0x382c0adc13151b0"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment