Skip to content

eth_getBlockTransactionCountByNumber


Returns the number of transactions in a block specified by a block number, as a hex string.

Parameters

Block Number

The block number can be:

  • A hex number in a string: eg. "0x800"
  • A block hash as a string eg. "0xf77e76c25038b0be1fbd12a4f3e404173802bf0c9a9e62deef7949201d59ebfb
  • "earliest" for the earliest block
  • "latest" for the latest block
  • "safe" for the block that the node's high quorum certificate points to
  • "finalized" for the latest finalized block.
  • "pending" is the block that is about to be created.

Result

A count as a hex string, or null if the block with this hash is not known to this node.

Example Request

curl -d '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "eth_getBlockTransactionCountByNumber",
    "params": [ "0x82" ]}' -H "Content-Type: application/json" -X POST "https://api.zq2-prototestnet.zilliqa.com/"

Example response

{"jsonrpc":"2.0","result":"0x1","id":"1"}

Arguments

Parameter Type Required Description
id string Required "1"
jsonrpc string Required "2.0"
method string Required "eth_getBlockByHash"
params array Required [ block_number ] (*)

(*) Note that, although the Ethereum API docs claim that the block number parameter is optional, it is mandatory in at least erigon and geth, and also in zq2.