> For the complete documentation index, see [llms.txt](https://ai-agent-sdk-docs.crypto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-agent-sdk-docs.crypto.com/crypto.com-developer-platform/developer-platform-client-sdk-examples/transaction-example.md).

# 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>" %}
