eth_getBlockTransactionCountByNumber - HyperEVM

Example code for the eth_getBlockTransactionCountByNumber JSON RPC method. Сomplete guide on how to use eth_getBlockTransactionCountByNumber GetBlock JSON RPC in GetBlock Web3 documentation.

This method returns the number of transactions in a block matching the given block number.

Parameters

Parameter
Type
Required
Description

blockNumber

string

Yes

Block number (hex) or "latest", "earliest", "pending".

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockTransactionCountByNumber",
    "params": ["latest"],
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x5"
}

Response Parameters

Field
Type
Description

result

string

Transaction count in the block (hex).

Use Case

The eth_getBlockTransactionCountByNumber method is essential for:

  • Block explorer statistics

  • Transaction throughput analysis

  • Network activity monitoring

  • Block verification

Error Handling

Error Code
Message
Cause

-32602

Invalid params

Invalid block number format.

-32603

Internal error

Block not found.

Web3 Integration

Last updated

Was this helpful?