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

Defined in the Ethereum JSON-RPC Specification

Returns the number of transactions in a block by block number.

Parameters

blockParameter
string
required

Integer block number, or the string “latest”, “earliest” or “pending”.

Returns

result
string

The number of transactions in this block as a hexadecimal string.

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

Error Handling

CodeMessageDescription
-32602Invalid block parameterThe provided block parameter is invalid
4100Requested method not supportedThe method is not supported by the wallet

This method returns the count of transactions in a specific block identified by its number.