Skip to content

getTransaction

Returns information about a transaction by hash.

Usage

example.ts
import { publicClient } from "./client";

const transaction = await publicClient.getTransaction({
  hash: "0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d",
});
{
hash: "0xe54a939d7ecbc39610fc7c9b29f67943a04219e7a5235d412260d81721ca7d68",
nonce: 0,
blockHash: "0xf6cec5af1ee95f56038fc30589bcfeb4b960075c3c76b8a0eaa6d36e8e623b50",
transactionIndex: 0,
from: "cfx:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0sfbnjm2",
to: "cfx:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0sfbnjm2",
...
}

Returns

Transaction

The transaction information.

Parameters

hash (required)

Get information about a transaction by hash.

const transaction = await publicClient.getTransaction({
  hash: "0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d", 
});

JSON-RPC Method

cfx_getTransactionByHash