TriportRPC

eth_getTransactionByBlockNumberAndIndex

Polygon / https://triport.io/polygon

Minimum tier: Free

Polygon method guide

Last updated:

eth_getTransactionByBlockNumberAndIndex returns one transaction identified by two coordinates: the block (given as a hex-encoded block number or one of the tags latest, earliest, pending, safe, finalized) and the transaction's zero-based index within that block. Both parameters are passed as 0x-prefixed hex strings.

Reach for it when you already know a transaction's slot in a block — for example while iterating a Polygon block transaction-by-transaction, or when you have an index from a prior eth_getBlockByNumber call and want only that one body rather than the whole block. This is the by-number counterpart of eth_getTransactionByBlockHashAndIndex; use that sibling when you hold the block hash instead, or eth_getTransactionByHash when you already have the transaction's own hash.

Polygon runs Bor consensus with a ~2.1 s block time, so a typical block carries roughly 50–150 transactions. If the block does not exist, or the index is out of range for that block, result is null rather than an error — check for null before reading fields.

Parameters

This method takes no parameters.

Returns

eth_getTransactionByBlockNumberAndIndex return value
FieldType
resultobject

Examples

curl https://triport.io/polygon \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByBlockNumberAndIndex","params":[]}'
const res = await fetch("https://triport.io/polygon", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": []
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/polygon",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByBlockNumberAndIndex","params":[]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Polygon.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_getTransactionByBlockNumberAndIndex do?
Returns a single Polygon transaction selected by its block (number or tag) and its zero-based position within that block.
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.