Avalanche
Avalanche
Avalanche
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getBlockTransactionCountByHash returns the number of transactions in the Avalanche C-Chain block identified by a given 32-byte hash. It is a lightweight (1 CU) lookup — you learn how full a block is without pulling its full body or any transaction data. On the C-Chain, where gas is paid in AVAX and blocks finalize in roughly one to two seconds, this is handy for gauging activity cheaply. Send the hash to https://avalanche.therpc.io/YOUR_API_KEY (chain ID 43114); the count comes back as a hex string like "0x0" for an empty block.
| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | 是 | The hash of the block to count transactions in. |
| 类型 | 描述 |
|---|---|
| string (hex) | Hex-encoded transaction count. "0x0" means the block is empty. |
Try it live in the Avalanche playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | Block hash is malformed or not 32 bytes. |
null, not "0x0" — null-check before running parseInt, or you will misread a missing block as an empty one.eth_getBlockTransactionCountByNumber instead.参数
0x-prefixed 32-byte block hash