Transactions API
Get Transaction by Hash

Get Transaction by Hash

Overview

The Get Transaction by Hash endpoint obtains a single transaction's data by specifying its txHash (transaction hash) as a required path parameter. The data includes such fields as block_hash, block_timestamp, block_number, origin, to, fee, nonce, sig_r/sig_s/sig_v, status, tx_type, and information regarding gas.

Querying via Postman

If you prefer querying via Postman, the description of PARSIQ Endpoints for Get Transaction by Hash (opens in a new tab) might come in handy. There you will find examples and responses for good and bad requests as well as parameter definitions and their example values.

Usage

In this example, we receive data on the transaction with the hash 0x643c2d6d2b84164cd5acd6ecbaeb2ef86c50713df4afcc3822851fb4c34435d9.

import * as Parsiq from '@parsiq/parsiq.js';
 
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
 
const transaction = await client.transactions.getByHash(
    `0x643c2d6d2b84164cd5acd6ecbaeb2ef86c50713df4afcc3822851fb4c34435d9`
);
 
console.log(transaction)

Output:

{
  hash: '0x643c2d6d2b84164cd5acd6ecbaeb2ef86c50713df4afcc3822851fb4c34435d9',
  block_hash: '0xa3c2fb8a07acc6827fe60e1a0f7f629d18fbf21ccd0f128f8f0db1844c61839f',
  block_timestamp: 1686547007,
  index: 87,
  block_number: 17461846,
  data: {
    origin: '0xd22c15113090219f5d027fa8e0a7cab0539c5473',
    to: '0x7a250d5630b4cf539739df2c5dacb4c659f2488d',
    fee: '5785882404110060',
    nonce: 3,
    sig_r: '0x4e0d9b7b2a55a07ec8db419672158a04dd96fc432810c5b75d821eccb7dd5431',
    sig_s: '0x3b10541eca20d0a8c2f2ef769a079bba4ead1569a6c5bff3c1331eb7e082fc55',
    sig_v: '0x',
    status: true,
    tx_type: 2,
    gas_used: 397052,
    gas_limit: 598202,
    gas_price: '14572102405',
    gas_fee_cap: '18892245044',
    gas_tip_cap: '100000000',
    txn_fee_savings: '1715321275100228'
  },
  gas_range: [ 7716513, 8113565 ]
}

Parameters

Path params
chainId
string
REQUIRED
version
string
REQUIRED
txHash
string
REQUIRED
Query params
estimate_cu
boolean