TriportRPC

eth_getTransactionByHash

Last updated:

`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`](./eth_getTransactionReceipt.md), which is only available once the transaction is mined.

Parameters

This method takes no parameters.

Returns

eth_getTransactionByHash return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByHash","params":[]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "eth_getTransactionByHash",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_getTransactionByHash","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_getTransactionByHash do?
Returns the transaction object for a given transaction hash, or `null` if the transaction is unknown or still pending.
How many credits does eth_getTransactionByHash cost?
eth_getTransactionByHash costs 1 credit(s) per call on Triport by default.
Is eth_getTransactionByHash available over WebSocket?
eth_getTransactionByHash is an HTTP JSON-RPC method.