Optimism
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Optimism
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
eth_getTransactionByBlockHashAndIndex returns a single transaction from OP Mainnet by pinning it to a block hash and a zero-based position within that block. It is handy when you have already pulled a block and want the transaction at a known slot without a separate hash lookup. OP Mainnet is an OP Stack optimistic rollup (Bedrock) settling to Ethereum L1, with gas paid in ETH and a block roughly every two seconds, so positions within a block are stable once the block is referenced by hash. Send the request to https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa).
0x0 upward.| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Ja | The hash of the block containing the transaction. |
| 2 | transactionIndex | string (hex) | Ja | Zero-based position of the transaction within the block. |
| Typ | Beschreibung |
|---|---|
| object | null | Same transaction object as eth_getTransactionByHash. Returns null if block or index not found. |
Try it live in the Optimism playground.
| Code | Meldung | Ursache |
|---|---|---|
-32602 | Invalid params | Block hash or transaction index is malformed. |
"0x0" for the first transaction, not the integer 0.null rather than an error, so null-check before reading fields.Parameter
0x-prefixed 32-byte block hash
0x-prefixed hex integer (e.g. "0x0" for the first transaction)