Base
Base
Base
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
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.
| # | الاسم | النوع | مطلوب | الوصف |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | نعم | The hash of the block to count transactions in. |
| النوع | الوصف |
|---|---|
| string (hex) | Hex-encoded transaction count. "0x0" means the block is empty. |
Try it live in the Base playground.
| الكود | الرسالة | السبب |
|---|---|---|
-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.المعاملات
0x-prefixed 32-byte block hash