Ethereum
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Ethereum
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getTransactionByBlockNumberAndIndex returns the transaction at a given position inside a block, with the block addressed by its height or by a tag like latest, finalized, or pending. It's the sibling of the by-hash lookup, but keyed on number instead of hash, which is what you usually want for scanning forward through Ethereum mainnet (chain ID 1, gas paid in ETH) where heights are simple to iterate. Give it a block number and a zero-based hex index, and the node returns the full transaction object sitting at that slot, the same shape eth_getTransactionByHash produces. Querying by number lets you reach symbolic tags like pending that no fixed hash exists for. The endpoint is https://ethereum.therpc.io/YOUR_API_KEY.
0x0 from each height to study top-of-block placement, the slot MEV researchers care about most.pending block's contents by index to see what a client expects to include next from the mempool before the slot is sealed.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | blockTag | string | 是 | The block containing the transaction. |
| 2 | transactionIndex | string (hex) | 是 | Zero-based position of the transaction within the block. |
| 类型 | 描述 |
|---|---|
| object | null | Same transaction object as eth_getTransactionByHash. Returns null if block or index not found. |
Try it live in the Ethereum playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | Block tag is malformed or transaction index is not a valid hex integer. |
"0x0" for the first transaction, never a decimal 0. Same goes for higher positions — "0xf", not 15.pending block is a client's local guess, not a finalized fact. Its ordering and even which transactions appear differ between geth, erigon, nethermind and besu, so don't treat a pending-tag result as canonical.参数
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"
0x-prefixed hex integer (e.g. "0x0" for the first transaction)