starknet_getBlockTransactionCount - Get Block Transaction Count
Get the number of transactions in a Starknet block by block ID. Useful for block analysis, throughput monitoring, and indexing pipelines.
Returns the number of transactions in a specific Starknet block. The block can be identified by hash, number, or the "latest" / "pending" tags.
Overview
This method provides a lightweight way to query block activity without fetching full block data. It is commonly used in monitoring dashboards, indexing pipelines, and throughput analysis tools. Starknet processes batches of transactions into blocks that are then proven and submitted to Ethereum L1, so transaction count per block is a useful metric for understanding network load.
Starknet blocks can contain various transaction types including INVOKE, DECLARE, DEPLOY_ACCOUNT, and L1_HANDLER transactions. This method counts all transaction types in the block.
Errors
| Code | Message | Description |
|---|---|---|
| 24 | Block not found | The specified block hash or number does not exist |
Examples
Use Cases
- Throughput Monitoring - Track Starknet network activity and transaction volume over time
- Block Explorer - Display transaction counts in block list views without fetching full block data
- Indexing Pipelines - Pre-allocate resources or decide batch sizes based on block transaction counts
- Network Health - Detect anomalous blocks (empty or unusually large) for alerting
- Analytics Dashboards - Calculate average transactions per block for network performance metrics
Related Methods
- starknet_getBlockWithTxs - Get block with full transaction objects
- starknet_getBlockWithTxHashes - Get block with transaction hashes only
- starknet_blockNumber - Get the latest block number
- starknet_getBlockWithReceipts - Get block with transaction receipts
- starknet_blockHashAndNumber - Get latest block hash and number
starknet_estimateMessageFee - Estimate L1-to-L2 Message Fee
Estimate the L2 fee for processing a message sent from Ethereum L1 to Starknet L2. Essential for cross-layer communication and bridge integrations.
starknet_getBlockWithReceipts - Get block I...
Get block information with full transactions and receipts given the block id