Returns the number of transactions in a block from a block matching the given block hash.
Request Format
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"
],
"id": 1
}
Response Format
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x8"
}
Parameters
- Block Hash (
hash32
): The hash of the block.
Return Value
- Transaction Count (
uint
ornotFound
): Returns the number of transactions in the specified block.
Example
Request
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"
],
"id": 1
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x8"
}
Notes
- Useful for retrieving the number of transactions included in a specific block.
- If the block is not found, the response will return
notFound
.