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, 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://triport.io/eth \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"eth_getTransactionByHash","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_getTransactionByHash",
  "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_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.