Skip to main content
EVM

eth_getBlockTransactionCountByNumber

Summary: Get number of transactions by block number

This request returns the number of transactions from the block matching the given block number.

Parameters

block
oneOf

Block number or string tag.

Block number
string

Block number in hexadecimal.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Block tag
enum

See the default block parameter.

  • 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.
  • 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.

Enum:
"earliest"
"finalized"
"latest"
"pending"

Returns

eth_getBlockTransactionCountByNumberResponse
oneOf

null

Not Found (null).

string

Hex-encoded unsigned integer.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Customize request
Parameter
Value
0x4fde9d
oneOf

Request

curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x4fde9d"],
"id": 1
}'

Example response

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