eth_getBlockTransactionCountByHash
Retrieve the count of transactions in an Ethereum block using its hash. Supports multiple networks like mainnet and sepolia.
Instructions
Get the number of transactions in a block identified by its hash.
Args:
blockHash (string): 32-byte block hash (66 chars with 0x prefix).
network (string, optional): Ethereum network to query. Defaults to 'mainnet'.
Returns:
Hexadecimal string representing transaction count (e.g., '0x10' for 16 transactions). Returns null if block not found.
Examples:
"Count txs in block": { "blockHash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238" }
"Query Sepolia block": { "blockHash": "0x...", "network": "sepolia" }
Errors:
InvalidParams: When blockHash format is invalid (not 66 char hex).
InternalError: When Infura API is unavailable or returns an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockHash | Yes | The 32-byte block hash to query. | |
| network | No | The Ethereum network to query, e.g., 'mainnet' or 'sepolia'. | mainnet |
| response_format | No | Output format: 'json' for structured data, 'markdown' for human-readable. | json |