# Transaction Example

This example demonstrates how to use the `@crypto.com/developer-platform-client`  **Transaction** **module** to interact with blockchain transactions.

<figure><img src="/files/uWNKG9J8VD1h0MO4zHMQ" alt=""><figcaption></figcaption></figure>

### Installation

#### 1. Clone the repository

```sh
git clone https://github.com/crypto-com/developer-platform-sdk-examples.git
```

#### 2. Install dependencies

```sh
cd developer-platform-sdk-examples/sdk-examples/categories/transaction
npm install
```

### Environment Variables

This example uses a client-side SDK and may require an API key. You can initialize the SDK inside your app (`src/app/Transaction/index.tsx`) code like so:

```typescript
import { Client } from "@crypto.com/developer-platform-client";

Client.init({
  apiKey: "your-crypto.com-developer-platform-api-key",
});
```

{% hint style="info" %}
For Crypto.com Developer Platform API Key, [click here to learn how to obtain your Crypto.com Developer Platform API key](/crypto.com-developer-platform/developer-platform-dashboard.md).
{% endhint %}

{% hint style="info" %}
**Note:** Never expose real or production API keys in a public or client-side app.
{% endhint %}

### Features

This example showcases the following **Transaction** **module** functions:

* **getTransactionByHash**: Fetch a transaction by its hash
* **getTransactionStatus**: Check transaction status by hash

*Other functions provided by the `@crypto.com/developer-platform-client`*  ***Transaction module** can also be integrated into the app:*

* **getTransactionsByAddress**: Fetch transactions for a specific wallet address
* **getTransactionCount**: Get transaction count for a wallet
* **getGasPrice**: Fetch current gas price
* **getFeeData**: Get current fee data
* **estimateGas**: Estimate gas for a transaction

### Usage

To run the app in development mode:

```sh
npm run dev
```

Open your browser and navigate to the provided local URL (typically `http://localhost:5173`).

The application provides a user interface to test Transaction module functions. You can:

* Enter transaction hashes to fetch detailed transaction information
* Check the current status of any transaction
* View formatted JSON responses with transaction data

### Build

To generate a production-ready build:

```sh
npm run build
```

To preview the build:

```sh
npm run preview
```

### Development

* `npm run dev` - Start development server
* `npm run build` - Build for production
* `npm run lint` - Run ESLint
* `npm run preview` - Preview production build

### API Key Requirements

Some functions may require valid API credentials. Make sure to provide valid credentials when testing blockchain transaction features.

### Demo Video

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FktUMyU5bBece2vVjrTg7%2Fuploads%2FArD2YqJgRURcl88qY2dv%2FTransactionExampleDemo.mp4?alt=media&token=89cc0f84-930e-49c9-a301-ae814a592b94>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-agent-sdk-docs.crypto.com/crypto.com-developer-platform/developer-platform-client-sdk-examples/transaction-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
