POST
/
efb0a5eccd2caa5135eb54eba6f7f300
curl --request POST \
  --url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "id": 1,
  "params": [
    "0x6ecf0b4"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}

Optimism API method that retrieves the number of transactions in a block, identified by its number. This method allows for understanding the transaction volume within a specific block without needing to load the entire block’s data.

Get you own node endpoint today

Start 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

  • blockNumber — the number of the block for which the transaction count is being queried, encoded as a hexadecimal string.

Response

  • result — the number of transactions in the specified block, encoded as a hexadecimal string. This includes all transactions that were part of the block at the time it was mined.

Use case

The eth_getBlockTransactionCountByNumber method is useful for applications that monitor blockchain activity, such as wallets, block explorers, or analytics platforms. It can help these applications quickly gauge the level of activity within specific blocks or over a range of blocks.

Body

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

Response

200 - application/json
The transaction count of the block by number
jsonrpc
string
id
integer
result
string