# transferTokens

## Description

The `transferTokens` function allows users to transfer tokens from one account to another on the Casper blockchain network.

## Parameters

| Parameter    | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| `RPC_API`    | string | The RPC endpoint of the Casper network    |
| `privateKey` | string | The private key of the sender's account   |
| `to`         | string | The public key of the recipient's account |
| `amount`     | number | The amount of tokens to transfer          |

## Response

| Name     | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| `txHash` | string | The hash of the transaction on the Casper network |

## Example Request and Response

### Prerequisites

Before making requests with NO.AI SDK, you must have it installed.

You can install NO.AI SDK using either **`npm`** or **`yarn`**. Use the following commands to install NO.AI SDK:

```sh
npm install @nest25/casper-lib
OR
yarn add @nest25/casper-lib
```

### Request&#x20;

Here is an example of how to make a `transferTokens` request using the NO.AI SDK:

```javascript
// import Nest25 Casper library
const { Casper } = require('@nest25/casper-lib');
// create a new Casper instance
const casper = new Casper();

const privateKey = 'your-private-key';
const RPC_API = 'https://rpc.testnet.casperlabs.io/rpc';

async function main() {
  const to = '013a156a50fc6284ba436aedeaf96b55ac1a0c57ee9f8a46bf1c6518afe9b2f56c';
  const amount = 25 * 10 ** 9;
  // send CSPR tokens
  const txHash = await casper.transferTokens(RPC_API, privateKey, to, amount);
  console.log({ txHash });
}
// call main function
main();
```

### Response

```sh
{
        txHash: '6a72b901b92bbb6490da1d49ecc912d06c3358f17184f6213d04434dc8f451a4'
}
```

## Use Cases

* **Token Transfers:** The function can be used to transfer tokens from one account to another on the Casper blockchain network.
* **DApp Development:** The function can be used by developers to integrate token transfers into their decentralized applications built on the Casper blockchain network.
