TriportRPC

eth_getTransactionByBlockHashAndIndex

Last updated:

eth_getTransactionByBlockHashAndIndex locates a block by its 32-byte hash and returns the single transaction sitting at the supplied zero-based index within that block. The transaction is returned as the standard Ethereum transaction object.

Use it when you already hold a block hash — from a log, a receipt, or an eth_getBlockByHash response — and want to walk that block's transactions one at a time without downloading the full block body. Pair it with eth_getBlockTransactionCountByHash: fetch the count, then iterate 0 … count-1, requesting each transaction by index.

If the block hash is unknown (e.g. an orphaned/uncle block, or a block the node has not yet seen) or the index is out of range for the block, the method returns null instead of an error. Always check for null before reading fields off the result.

Parameters

This method takes no parameters.

Returns

eth_getTransactionByBlockHashAndIndex return value
FieldType
resultobject

Examples

curl https://triport.io/eth \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"eth_getTransactionByBlockHashAndIndex","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_getTransactionByBlockHashAndIndex",
  "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_getTransactionByBlockHashAndIndex","params":[],"jsonrpc":"2.0"},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does eth_getTransactionByBlockHashAndIndex do?
Returns the transaction at a given position inside the block identified by its block hash.
How many credits does eth_getTransactionByBlockHashAndIndex cost?
eth_getTransactionByBlockHashAndIndex costs 1 credit(s) per call on Triport by default.
Is eth_getTransactionByBlockHashAndIndex available over WebSocket?
eth_getTransactionByBlockHashAndIndex is an HTTP JSON-RPC method.