eth_getTransactionByBlockNumberAndIndex
Last updated:
eth_getTransactionByBlockNumberAndIndex returns a single transaction object
selected by two coordinates: the block (by number or block tag) and the
transaction's zero-based index within that block. Both the block number and the
index are 0x-prefixed hexadecimal strings.
Use it when you already know a transaction's position in a block — for example
when iterating a block's transactions one at a time, when you have the index
from a prior eth_getBlockByNumber call, or when reconstructing a block body
without fetching every transaction at once. If you have the block hash rather
than its number, use the sibling method
eth_getTransactionByBlockHashAndIndex. If you have the transaction hash
directly, use eth_getTransactionByHash.
If the block does not exist, or the index is out of range for that block, the
result is null rather than an error.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://triport.io/eth \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"id":1,"method":"eth_getTransactionByBlockNumberAndIndex","params":[],"jsonrpc":"2.0"}'const res = await fetch("https://triport.io/eth", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"id": 1,
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/eth",
headers={"Authorization": "Bearer <api-key>"},
json={"id":1,"method":"eth_getTransactionByBlockNumberAndIndex","params":[],"jsonrpc":"2.0"},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getTransactionByBlockNumberAndIndex do?
- Returns the transaction at a given position within the block identified by its number or a block tag.
- How many credits does eth_getTransactionByBlockNumberAndIndex cost?
- eth_getTransactionByBlockNumberAndIndex costs 1 credit(s) per call on Triport by default.
- Is eth_getTransactionByBlockNumberAndIndex available over WebSocket?
- eth_getTransactionByBlockNumberAndIndex is an HTTP JSON-RPC method.