Optimism
Optimism
Optimism
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
eth_getBlockTransactionCountByHash returns just the number of transactions in the OP Mainnet block identified by a given 32-byte hash, as a hex string. It is a cheap (1 CU) way to gauge how full a block is without downloading the whole block body. OP Mainnet is an OP Stack rollup that pays gas in ETH and seals a block roughly every 2 seconds. Send the block hash to https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa).
| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Ja | The hash of the block to count transactions in. |
| Typ | Beschreibung |
|---|---|
| string (hex) | Hex-encoded transaction count. "0x0" means the block is empty. |
Try it live in the Optimism playground.
| Code | Meldung | Ursache |
|---|---|---|
-32602 | Invalid params | Block hash is malformed or not 32 bytes. |
null rather than "0x0" — null-check before passing the result to parseInt(value, 16).eth_getBlockTransactionCountByNumber instead.Parameter
0x-prefixed 32-byte block hash