Base
Base
Base
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
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.
| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Sí | The hash of the block to count transactions in. |
| Tipo | Descripción |
|---|---|
| string (hex) | Hex-encoded transaction count. "0x0" means the block is empty. |
Try it live in the Base playground.
| Código | Mensaje | Causa |
|---|---|---|
-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.Parámetros
0x-prefixed 32-byte block hash