> ## Documentation Index
> Fetch the complete documentation index at: https://developers.fireblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://developers.fireblocks.com/feedback

```json
{
  "path": "/docs/fetching-transaction-receipt",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Fetching Transaction Receipt

> This guide outlines the procedure for retrieving a transaction receipt via the  endpoint, utilizing the  function in the Fireblocks SDK.

By employing the `getTransactionReceipt` function of the Fireblocks SDK, you can obtain the receipt of any transaction that has been confirmed by the blockchain. This function takes in the `baseAssetId` (indicating the blockchain) and the `txHash` (indicating the transaction hash). It manages the process of querying the blockchain and returning the transaction receipt.

<Info>
  ### Note:

  This functionality is exclusively available for EVM (Ethereum Virtual Machine) compatible chains.
</Info>

## Prerequisites

Before fetching a transaction receipt, ensure you have the following information:

1. **Base Asset ID**: The `baseAssetId` of the blockchain where the transaction was executed (e.g., ETH for Ethereum). This is the Fireblocks ID of the blockchain's gas token. (To obtain the asset ID, refer to this [assetId list](https://support.fireblocks.io/hc/en-us/articles/8993656344092-Supported-blockchain-networks)).
2. **Transaction Hash**: The `txHash` of the transaction for which you wish to fetch the receipt. This is the unique identifier of the transaction on the blockchain and is a hex string (i.e. prefixed with 0x). You can obtain the transaction hash from the transaction details or the blockchain explorer.

## Example: Fetching a Transaction Receipt

Below is an example of how to fetch a transaction receipt using the Fireblocks SDK:

### 1. Initialize the Fireblocks SDK

First, import the Fireblocks SDK and initialize it with your Fireblocks API key and private key:

<CodeGroup>
  ```bash bash theme={"system"}
  import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';

  const privateKey = '...'; // Your Fireblocks API private key
  const apiKey = '...'; // Your Fireblocks API key

  const fireblocksSdk = new Fireblocks({
  	apiKey,
  	basePath: BasePath.US, // Use BasePath.EU for the EU region
  	secretKey: privateKey,
  });
  ```
</CodeGroup>

### 2. Fetch the Transaction Receipt

To fetch the transaction receipt, utilize the `getTransactionReceipt` function of the Contract Interactions Controller:

<CodeGroup>
  ```bash bash theme={"system"}
  const baseAssetId = 'ETH'; // The base asset ID for Ethereum
  const txHash = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'; // The transaction hash

  const receipt = await fireblocks.getTransactionReceipt(baseAssetId, txHash);

  console.log(receipt);
  ```
</CodeGroup>

The response will be a transaction receipt object containing details about the transaction, such as the status, gas used, logs, and more.

<Info>
  ### Note:

  For further information about the transaction receipt object, refer to the [Endpoint Model](#endpoint-model) section.
</Info>

## Endpoint Model

### Transaction Receipt

The transaction receipt response object includes the following fields:

* `status`: The status of the transaction (e.g., success or failure).
* `gasUsed`: The amount of gas consumed by the transaction.
* `logs`: The logs generated by the transaction (if any).
* `transactionHash`: The hash of the transaction.
* `blockHash`: The hash of the block containing the transaction.
* `blockNumber`: The number of the block containing the transaction.
* `contractAddress`: The address of the contract created (if any).
* `cumulativeGasUsed`: The cumulative gas used by the transaction.
* `from`: The address of the sender.
* `to`: The address of the receiver.
* `effectiveGasPrice`: The actual price per unit of gas paid.
* `type`: The type of the transaction.
* `logs`: The logs generated by the transaction (if any).
* `logsBloom`: The bloom filter for the logs of the transaction.
* `transactionIndex`: The index of the transaction in the block.

<Info>
  ### Note:

  The `logs` field contains an array of log objects, each representing a log generated by the transaction. Each log object includes the following fields:

  * `address`: The address of the contract that generated the log.
  * `topics`: An array of topics associated with the log.
  * `data`: The data contained in the log.
  * `blockNumber`: The number of the block containing the log.
  * `transactionHash`: The hash of the transaction that generated the log.
  * `transactionIndex`: The index of the transaction in the block.
  * `blockHash`: The hash of the block containing the log.
  * `logIndex`: The index of the log in the block.
  * `removed`: Indicates whether the log was removed.
</Info>

<Info>
  ### Note:

  Some fields may be empty in the response if the transaction has not been executed or if the blockchain does not support them.
</Info>
