eth_getBlockTransactionCountByNumber RPC Method

Counts the transactions in a block identified by its number or tag.

Parameters#

stringrequired

Block number (hex) or tag: latest, safe, finalized, pending.

Result#

string | null - Transaction count for the block, hex-encoded.

Code sample#

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "latest"
  ],
  "id": 1
}

Response#

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xa"
}
Try It