eth_getTransactionByHash
https://api.triport.ioReturns the transaction object for a given transaction hash, or `null` if the transaction is unknown or still pending.
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.
txHashstringrequired0x-prefixed hex (66 characters total).Response
When the transaction is unknown or has not yet been seen:
{
"jsonrpc": "2.0",
"id": 1,
"result": null
}hashstringnoncestring0x-hex.blockHashstring | nullnull while pending.blockNumberstring | null0x-hex; null while pending.transactionIndexstring | null0x-hex; null while pending.fromstringtostring | nullnull for contract-creation transactions.valuestring0x-hex.gasstring0x-hex.gasPricestring0x-hex.inputstring0x-hex.Errors
Triport returns standard JSON-RPC error envelopes. The codes most relevant to this method:
| Code | Meaning | When it happens |
|---|---|---|
-32001 | trial_expired | The API key's trial period has ended; upgrade to a paid tier to continue. |
-32003 | rate_limited | The 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/blockNumberofnullmeans the transaction is still in the mempool. Poll until those fields populate to detect inclusion, then calleth_getTransactionReceiptfor the execution status, effective gas used, and emitted logs. - All numeric fields (
nonce,value,gas,gasPrice,blockNumber,transactionIndex) are quantity-encoded0x-hex strings, not JSON numbers. - To fetch a transaction by its position instead of its hash, use
eth_getTransactionByBlockHashAndIndexoreth_getTransactionByBlockNumberAndIndex. - This method is shared with the
eth_read_rpccategory, so it draws from the same per-tier RPS budget as the other Ethereum read methods.