Ethereum
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Ethereum
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
eth_getTransactionByBlockHashAndIndex fetches a single transaction by where it sits, not by what it is. You name a block by its hash and a zero-based position within that block, and Ethereum mainnet (chain ID 1, fees denominated in ETH) returns the full transaction object at that slot. The order matters here: a validator fixes the transaction ordering when it seals the block, and that order is exactly what this index walks. It's the same transaction object you'd get from eth_getTransactionByHash, just addressed positionally. Querying by block hash rather than number means you're pinned to one specific block even across a reorg. Send the call to https://ethereum.therpc.io/YOUR_API_KEY.
0x0 until you hit null, when you already have the block hash but not the individual tx hashes.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Sim | The hash of the block containing the transaction. |
| 2 | transactionIndex | string (hex) | Sim | Zero-based position of the transaction within the block. |
| Tipo | Descrição |
|---|---|
| object | null | Same transaction object as eth_getTransactionByHash. Returns null if block or index not found. |
Try it live in the Ethereum playground.
| Código | Mensagem | Causa |
|---|---|---|
-32602 | Invalid params | Block hash or transaction index is malformed. |
"0x0", the eleventh is "0xa" — passing a bare 0 or a decimal 10 will misfire.null, not an error. Pair this with eth_getBlockTransactionCountByNumber, or just treat null as your stop condition when enumerating.Parâmetros
0x-prefixed 32-byte block hash
0x-prefixed hex integer (e.g. "0x0" for the first transaction)