L0vdL0vd

eth_getBlockTransactionCountByHash

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

归档 · 可查询任意历史区块

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByHash","params":["0xc7a2fd354a9a1512636dad41b44e618905f5e8d2500f08c515c3bbbdf5261f6a"]}'

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xae"
}
参数与您的端点

参数

blockHashstring必填
32-byte block hash.

返回值

string Transaction count, hex.

适用场景

Count the transactions in a block identified by hash.

如何解读结果

Hex integer, or null if the block is unknown.

提示

  • Use the hash variant when you work from stored block hashes to stay correct across reorgs.

相关方法