For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_getBlockTransactionCountByHash - Mantle

Example code for the eth_getBlockTransactionCountByHash JSON-RPC method. Complete guide on how to use eth_getBlockTransactionCountByHash JSON-RPC in GetBlock Web3 documentation.

This method returns the number of transactions in a block specified by block hash on the Mantle network.

Parameters

Parameter
Type
Description

blockHash

string

32-byte block hash

Request examples

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

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "eth_getBlockTransactionCountByHash",
    "params": ["0x9b14d73f45c836bfb0e1f59453c39fe8cddab45a0f78670dc6190e5c85b65a8e"],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));

Response

response.json
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x7b"
}

Response Parameters

Field
Type
Description

jsonrpc

string

JSON-RPC protocol version ("2.0")

id

string

Request identifier matching the request

result

string

Number of transactions in block (hex)

Use Case

The eth_getBlockTransactionCountByHash method is essential for:

  • Block transaction statistics

  • Block explorer functionality

  • Network activity monitoring

  • Data validation

  • Performance analysis

  • Block size estimation

Error Handling

Status Code / Error
Cause

403

Forbidden — Missing or invalid ACCESS-TOKEN

-32602

Invalid params — Invalid block hash format

Web3 Integration

Last updated

Was this helpful?