Skip to main content
POST
eth_getBlockTransactionCountByHash
Ethereum API method that returns the number of transactions in a block specified by block hash. This information can be useful for analytics purposes.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • hash — the block hash of the requested block.

Response

  • quantity — an integer value representing how many transactions are included in the block.

eth_getBlockTransactionCountByHash code examples

Learn more about the ChainstackProvider in ethers.js: ethers ChainstackProvider Documentation.

Use case

eth_getBlockTransactionCountByHash is a useful tool for analyzing transaction volume on the Ethereum blockchain. For instance, a new block is generated on the Ethereum blockchain every 12 seconds, resulting in approximately 300 blocks per hour. Using the ethers.js library, one can inspect the past 300 blocks starting from the latest block and use eth_getBlockTransactionCountByHash to find the number of transactions in each block.
index.js
This example connects to an Ethereum node using the ethers.js library. The retrieveTransactionsCount function gets the current block number, calculates the block number from one hour ago, and uses a for loop to iterate through all blocks in that range. The function then retrieves the hash of each block and the number of transactions in each block and adds it to a total transaction count. The final result, the total number of transactions in the previous hour, is logged to the console. This is a good example of how you can combine different methods.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getBlockTransactionCountByHash
params
string[]

The block hash identifier.

Response

200 - application/json

The block information

jsonrpc
string
id
integer
result
string
Last modified on June 25, 2026