Skip to content

eth_getBlockTransactionCountByNumber ​

served · same as reth

Returns the number of transactions in a block.

When to use ​

Use it to find how many transactions a block has without the block itself.

Example ​

bash
curl -s -X POST -H 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockTransactionCountByNumber", "params": ["0x18facad"]}' \
  http://127.0.0.1:8547
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "0x18facad"
  ]
}

Response ​

Live mainnet, block 26193069, 2026-10-14. Checked against reth 2.7: equal.

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xed"
}

Full response

Parameters ​

NameTypeRequiredMeaning
blockblock number in hex, or a tag, see Block parameteryesThe block.

Returns ​

The count as a hex number, or null when the block is above the head. A block below the first block of the node gives the error 4444.

Compared with reth ​

The live example above gives the same answer on Cinder and on reth 2.7.

eth_getBlockByNumber.

Schema (OpenRPC) ​

The official specification: eth_getBlockTransactionCountByNumber in ethereum/execution-apis.

Parameter Block: Block number or Block tag
json
{
  "oneOf": [
    {
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "Block number",
      "type": "string"
    },
    {
      "description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error",
      "enum": [
        "earliest",
        "finalized",
        "safe",
        "latest",
        "pending"
      ],
      "title": "Block tag",
      "type": "string"
    }
  ],
  "title": "Block number or tag"
}
Result: Not Found (null) or Transaction count
json
{
  "oneOf": [
    {
      "title": "Not Found (null)",
      "type": "null"
    },
    {
      "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
      "title": "Transaction count",
      "type": "string"
    }
  ]
}