TriportRPC

eth_getTransactionByHash

POSThttps://api.triport.io

Returns the transaction object for a given transaction hash, or `null` if the transaction is unknown or still pending.

Ethereumfree — 10 RPS (free) / 20 RPS (basic) / 100 RPS (pro) / 250 RPS (business)

eth_getTransactionByHash looks up a single transaction by its 32-byte hash and returns the full transaction object. Use it to confirm that a transaction you broadcast (for example via eth_sendRawTransaction) was accepted by the network, to read back its calldata and value, or to find which block it landed in.

The method resolves both mined and pending transactions. If the hash has been seen in the mempool but not yet included in a block, the blockHash, blockNumber, and transactionIndex fields are returned as null while the rest of the object is populated. If the hash is completely unknown to the node — never broadcast, dropped, or replaced — the result is null.

A null result is not an error: the JSON-RPC envelope still returns HTTP 200 with "result": null. To read execution outcome (status, gas used, logs) you need eth_getTransactionReceipt, which is only available once the transaction is mined.

Parameters

The params array takes a single positional element.

txHashstringrequired
32-byte transaction hash, 0x-prefixed hex (66 characters total).

Response

When the transaction is unknown or has not yet been seen:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}
hashstring
32-byte hash of the transaction.
noncestring
Number of transactions made by the sender prior to this one, as 0x-hex.
blockHashstring | null
Hash of the block this transaction was included in; null while pending.
blockNumberstring | null
Block number this transaction was included in, as 0x-hex; null while pending.
transactionIndexstring | null
Index of the transaction within its block, as 0x-hex; null while pending.
fromstring
20-byte address of the sender.
tostring | null
20-byte address of the receiver; null for contract-creation transactions.
valuestring
Value transferred in wei, as 0x-hex.
gasstring
Gas supplied by the sender, as 0x-hex.
gasPricestring
Gas price provided by the sender in wei, as 0x-hex.
inputstring
The calldata sent with the transaction, as 0x-hex.

Errors

Triport returns standard JSON-RPC error envelopes. The codes most relevant to this method:

CodeMeaningWhen it happens
-32001trial_expiredThe API key's trial period has ended; upgrade to a paid tier to continue.
-32003rate_limitedThe per-tier RPS limit was exceeded. The data block carries limit_rps, retry_after_sec, and upgrade_url.

A malformed or wrong-length txHash is rejected as an invalid-params error before the lookup runs. See the shared errors reference for the full error envelope and the complete code list.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "eth_getTransactionByHash",
    params: [
      "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
    ],
  }),
});


const { result } = await res.json();
if (result === null) {
  console.log("transaction unknown or pending");
} else {
  console.log(`included in block ${result.blockNumber}`);
}

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const tx = await client.eth.getTransactionByHash(
  "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
);


if (tx === null) {
  console.log("transaction unknown or pending");
} else {
  console.log(tx.from, "→", tx.to, tx.value);
}

Python (triport-sdk)

import os
from triport import Triport


client = Triport(api_key=os.environ["TRIPORT_API_KEY"])


tx = client.eth.get_transaction_by_hash(
    "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
)


if tx is None:
    print("transaction unknown or pending")
else:
    print(tx["from"], "->", tx["to"], tx["value"])

Notes

  • A blockHash / blockNumber of null means the transaction is still in the mempool. Poll until those fields populate to detect inclusion, then call eth_getTransactionReceipt for the execution status, effective gas used, and emitted logs.
  • All numeric fields (nonce, value, gas, gasPrice, blockNumber, transactionIndex) are quantity-encoded 0x-hex strings, not JSON numbers.
  • To fetch a transaction by its position instead of its hash, use eth_getTransactionByBlockHashAndIndex or eth_getTransactionByBlockNumberAndIndex.
  • This method is shared with the eth_read_rpc category, so it draws from the same per-tier RPS budget as the other Ethereum read methods.