curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x2b10ad54fb64a69f0cf0395eda2b97d6dfb853a184a31cb6da53d5a360789331"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}
curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x2b10ad54fb64a69f0cf0395eda2b97d6dfb853a184a31cb6da53d5a360789331"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}
hash
— the block hash of the requested block.quantity
— an integer value representing how many transactions are included in the block.eth_getBlockTransactionCountByHash
code examplesconst { Web3 } = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getTransactionsCount(blockHash) {
const count = await web3.eth.getBlockTransactionCount(blockHash)
console.log(count);
}
getTransactionsCount('0x98ea4f9e6f68b193971fb693fbc1949c6df6d59647bbb99ab67557a6781ed4fe')
eth_getBlockTransactionCountByHash
is a useful tool for analyzing the Polygon zkEVM blockchain transaction volume. On average, a new block is generated on the Polygon zkEVM mainnet every 3 seconds, resulting in approximately 1,200 blocks per hour. Using a Web3 library, one can inspect the past 1,200 blocks starting from the latest block, retrieve the hash of each block, and use eth_getBlockTransactionCountByHash
to find the number of transactions in each block.The block information
The response is of type object
.