curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}blockHash — the hash of the blockresult — the number of transactions in the block encoded as hexadecimaleth_getBlockTransactionCountByHash code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const getTransactionCount = async (blockHash) => {
const count = await provider.send("eth_getBlockTransactionCountByHash", [blockHash]);
console.log(`Block ${blockHash}`);
console.log(`Transaction count: ${parseInt(count, 16)}`);
};
getTransactionCount("0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e");
Was this page helpful?