Optimism
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Optimism
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
eth_getTransactionByBlockNumberAndIndex returns one transaction from OP Mainnet by its zero-based position inside a block addressed by number or by a tag such as latest or pending. It is the number-based companion to the block-hash variant, ideal for sequential scans where you already track heights. 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. Send the request to https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa).
pending block by its position to inspect what the sequencer has queued next.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | blockTag | string | Sí | The block containing the transaction. |
| 2 | transactionIndex | string (hex) | Sí | Zero-based position of the transaction within the block. |
| Tipo | Descripción |
|---|---|
| object | null | Same transaction object as eth_getTransactionByHash. Returns null if block or index not found. |
Try it live in the Optimism playground.
| Código | Mensaje | Causa |
|---|---|---|
-32602 | Invalid params | Block tag is malformed or transaction index is not a valid hex integer. |
"0x0", not the integer 0, for the first transaction.pending tag's behavior (which transactions appear and in what order) depends on the OP Mainnet sequencer and the node client, so results from pending are not stable between calls.Parámetros
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"
0x-prefixed hex integer (e.g. "0x0" for the first transaction)