web3.eth.getBlockTransactionCount

优质
小牛编辑
125浏览
2023-12-01

web3.eth.getBlockTransactionCount(hashStringOrBlockNumber [, callback])

返回指定区块的交易数量。

参数:

  • Number|String -(可选)如果未传递参数,默认使用web3.eth.defaultBlock定义的块,否则使用指定区块。
  • Function - 回调函数,用于支持异步的方式执行[async]。

返回值:

Nubmer - 给定区块的交易数量。

示例:

var number = web3.eth.getBlockTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1");
console.log(number); // 1