Base
Base
Base
Free tier covers personal projects. Pay-as-you-go scales without a card.
eth_getBlockTransactionCountByHash returns how many transactions are in the block identified by a given 32-byte hash. Base is Coinbase's OP Stack rollup that uses ETH for gas and produces a block about every 2 seconds, and this is the cheapest way to gauge how full one of those L2 blocks is. Send the block hash to https://base.therpc.io/YOUR_API_KEY (chain ID 8453) and the node replies with a hex count — "0x0" for an empty block — without transferring the full block body.
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Yes | The hash of the block to count transactions in. |
| Type | Description |
|---|---|
| string (hex) | Hex-encoded transaction count. "0x0" means the block is empty. |
Try it live in the Base playground.
| Code | Message | Cause |
|---|---|---|
-32602 | Invalid params | Block hash is malformed or not 32 bytes. |
null when the node has never seen the hash — null-check before you parseInt the result, otherwise you'll get NaN.eth_getBlockTransactionCountByNumber instead and skip the hash lookup.Parameters
0x-prefixed 32-byte block hash