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

# Addresses

> Learn how to create dedicated addresses for your customers to deposit stablecoins

<Note>
  In a nutshell<br />
  Dedicated addresses allow you to create unique blockchain addresses for each customer. These addresses can receive stablecoins across multiple EVM-compatible chains, with deposits automatically swept to your master wallet.
</Note>

<img src="https://mintcdn.com/yiksipay/pFjIfRqPiQ-3l9Ci/images/addresses.png?fit=max&auto=format&n=pFjIfRqPiQ-3l9Ci&q=85&s=203a47f812b8d0089dd01e718fb0198d" alt="Addresses" width="3578" height="2102" data-path="images/addresses.png" />

## Prerequisites

Before generating addresses, ensure you have:

<Steps>
  <Step title="API Key">
    Get your API key from the [Yiksi Pay Dashboard](https://dashboard.yiksipay.com). Navigate to **Developers** to generate one.
  </Step>

  <Step title="Master Wallet Created">
    Create at least one master wallet via the [Create Wallet API](/en/api-reference/wallets/create-wallet) or dashboard. You'll need the `walletId` to generate addresses.
  </Step>

  <Step title="Wallet Funded">
    Fund your master wallet with native tokens (ETH, BNB, MATIC, etc.) to cover gas fees for auto-sweeping operations.
  </Step>

  <Step title="Webhook Configured">
    Set up your webhook URL on the master wallet to receive deposit notifications. See [Webhooks](/en/essentials/webhooks) for setup details.
  </Step>
</Steps>

## How It Works

Dedicated Addresses is a crucial feature on Yiksi Pay that enables you to create unique addresses for your customers. These addresses allow your customers to deposit stablecoins into your fintech app seamlessly.

When you create a dedicated address for a customer, they can use that single address to deposit stablecoins across multiple EVM-compatible blockchains.

For example, if you have Ethereum, Binance Smart Chain, Polygon, and Base master wallets created, each address you generate through any of these master wallets can be used to receive stablecoins on any of the [supported blockchains and assets](/en/essentials/integrations). This ensures that you don't have to worry about your customer sending stablecoins to the wrong blockchain.

Additionally, when stablecoins are deposited into a particular address, the assets are automatically moved to the chain's master wallet address.

<Note>Aside from Tron and Solana, addresses generated from one wallet can be used to deposit stablecoins across other blockchains that have the blockchain parameter `isEvmCompatible: true`.</Note>

## Address Parameters Explained

When creating or updating an address, you can use the following optional parameters to customize its behavior:

| Parameter               | Type               | Default | Description                                                                                                    |
| ----------------------- | ------------------ | ------- | -------------------------------------------------------------------------------------------------------------- |
| `disableAutoSweep`      | Boolean (Optional) | `false` | If set to `true`, automatic sweeping of funds from this address is disabled.                                   |
| `enableGaslessWithdraw` | Boolean (Optional) | `false` | If set to `true`, allows withdrawals without requiring the user to pay gas fees directly.                      |
| `metadata`              | Object (Optional)  | `null`  | Custom metadata you can attach to the address for your own reference or tracking purposes.                     |
| `name`                  | String (Optional)  | `null`  | A human-readable name for the address, useful for identification in your dashboard or logs.                    |
| `showPrivateKey`        | Boolean (Optional) | `false` | If set to `true`, the private key for this address will be returned in the API response. **Use with caution.** |

<Warning>
  The parameters `disableAutoSweep`, `enableGaslessWithdraw`, and `showPrivateKey` will override the corresponding settings in the master wallet configuration for this specific address. This allows for granular control at the address level, regardless of the wallet's default settings.
</Warning>

<Note>
  **Notes:**

  * All these parameters are optional; you only need to include those relevant to your use case.
  * Enabling `showPrivateKey` can expose sensitive information. Only use this in secure, trusted environments.
  * Be cautious with `showPrivateKey` exposing private keys can compromise security.
</Note>

## Create a Dedicated Address

You can generate a dedicated address for your customer using either the [Yiksi Pay dashboard ](https://dashboard.yiksipay.com) or the API, depending on your workflow and integration needs.

### 1. Using the Dashboard

The Yiksi Pay dashboard provides a simple, user-friendly interface for generating new addresses.

<img className="block" src="https://mintcdn.com/yiksipay/pFjIfRqPiQ-3l9Ci/images/generate-address1.png?fit=max&auto=format&n=pFjIfRqPiQ-3l9Ci&q=85&s=9d392affed6f93f04d2cdedff96680bb" alt="Generate address" width="3578" height="2240" data-path="images/generate-address1.png" />

<Note>
  This screenshot demonstrates the process of generating a new address via the Yiksi Pay dashboard. This method is ideal for manual address creation or for teams who prefer a graphical interface.
</Note>

### 2. Using the API

For programmatic or automated address generation, you can use the **Create Dedicated Address API**.\
This is useful for integrating address creation into your own applications or backend systems.

To create a dedicated address for a customer, send a **`POST`** request to our [Create Dedicated Address API](/en/api-reference/addresses/generate-address).

<CodeGroup>
  ```bash address.cmd theme={null}
  curl --request POST \
    --url https://api.yiksipay.com/v1/wallets/{walletId}/addresses \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: <api-key>' \
    --data '{
    "disableAutoSweep": "OPTIONAL_BOOLEAN",
    "enableGaslessWithdraw": "OPTIONAL_BOOLEAN",
    "metadata": "OPTIONAL_METADATA",
    "name": "OPTIONAL_ADDRESS_NAME",
    "showPrivateKey": "OPTIONAL_BOOLEAN"
  }'
  ```

  ```js address.js theme={null}
  const options = {
    method: 'POST',
    headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
    body: '{"metadata":"OPTIONAL_METADATA","name":"OPTIONAL_ADDRESS_NAME"}'
  };

  fetch('https://api.yiksipay.com/v1/wallets/{walletId}/addresses', options)
    .then(response => response.json())
    .then(response => console.log(response))
    .catch(err => console.error(err));
  ```

  ```php address.php theme={null}
  <?php

  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.yiksipay.com/v1/wallets/{walletId}/addresses",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\n  \"metadata\": \"OPTIONAL_METADATA\",\n  \"name\": \"OPTIONAL_ADDRESS_NAME\"\n}",
    CURLOPT_HTTPHEADER => [
      "Content-Type: application/json",
      "x-api-key: <api-key>"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "data": {
    "address": "0xe1037B45b48390285e5067424053fa35c478296b",
    "blockchain": {
      "createdAt": "2024-05-14T11:53:33.095Z",
      "derivationPath": "m/44'/60'/0'/0",
      "id": "85ffc132-3972-4c9e-99a5-5cf0ccb688bf",
      "isActive": true,
      "isEvmCompatible": true,
      "logoUrl": "https://res.cloudinary.com/dkgdc1vnl/image/upload/v1771444998/crypto-assets/ethereum.png",
      "name": "ethereum",
      "slug": "ethereum",
      "symbol": "eth",
      "tokenStandard": "ERC20",
      "updatedAt": "2024-06-14T22:32:11.983Z"
    },
    "configurations": {
      "aml": {
        "message": "Address is not sanctioned",
        "provider": "ofac",
        "status": "success"
      },
      "disableAutoSweep": false,
      "enableGaslessWithdraw": false,
      "showPrivateKey": false
    },
    "createdAt": "2024-10-23T11:13:40.446Z",
    "derivationPath": "m/44'/60'/0'/0/87",
    "id": "0a69c48a-6c6f-422c-bd6a-70de3306a3ac",
    "isActive": true,
    "metadata": {
      "user_id": 1
    },
    "name": "Customer 1",
    "network": "testnet",
    "type": "INTERNAL",
    "updatedAt": "2024-10-23T11:13:40.446Z"
  },
  "message": "Address generated successfully",
  "statusCode": 200
}
```

## Address Whitelisting

This feature allows you to whitelist an external address to be monitored based on the wallet's requirements.

This means that if you manage your own address generation, you can still use Yiksi Pay to monitor deposits made to that address.

### **Body Parameters**

| Key                     | Required | Type    | Description                                                                             |
| ----------------------- | -------- | ------- | --------------------------------------------------------------------------------------- |
| `name`                  | false    | string  | The name of the address.                                                                |
| `address`               | true     | string  | The wallet address.                                                                     |
| `metadata`              | false    | object  | Additional metadata for the address. This will be part of any transaction tied to this. |
| `showPrivateKey`        | false    | boolean | If you want the address private key to be part of the response.                         |
| `disableAutoSweep`      | false    | boolean | Disable automatic sweeping of assets sent to the address into your master wallet.       |
| `enableGaslessWithdraw` | false    | boolean | Enable gasless transactions from this address.                                          |
| `privateKey`            | false    | string  | The private key associated with the address. Required for executing actions securely.   |

<CodeGroup>
  ```bash address.cmd theme={null}
  curl --request POST \
    --url https://api.yiksipay.com/v1/wallets/{walletId}/addresses/whitelist \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: <api-key>' \
    --data '{
    "address": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6",
    "name": "Whitelisted Address",
    "metadata": {"purpose": "external_monitoring", "source": "manual"},
    "showPrivateKey": false,
    "disableAutoSweep": false,
    "enableGaslessWithdraw": true,
    "privateKey": "0x1234567890abcdef..."
  }'
  ```

  ```js address.js theme={null}
  const options = {
    method: 'POST',
    headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
    body: '{"address":"ADDRESS_TO_WHITELIST","metadata":"OPTIONAL_METADATA","name":"OPTIONAL_ADDRESS_NAME"}'
  };

  fetch('https://api.yiksipay.com/v1/wallets/{walletId}/addresses/whitelist', options)
    .then(response => response.json())
    .then(response => console.log(response))
    .catch(err => console.error(err));
  ```

  ```php address.php theme={null}
  <?php

  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.yiksipay.com/v1/wallets/{walletId}/addresses/whitelist",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\n  \"address\": \"ADDRESS_TO_WHITELIST\",\n  \"metadata\": \"OPTIONAL_METADATA\",\n  \"name\": \"OPTIONAL_ADDRESS_NAME\"\n}",
    CURLOPT_HTTPHEADER => [
      "Content-Type: application/json",
      "x-api-key": <api-key>
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "data": {
    "address": "0x3375154fa32Cb434B044E73a2582C4D2E6518AE4",
    "blockchain": {
      "createdAt": "2024-05-27T08:31:14.966Z",
      "derivationPath": "m/44'/60'/0'/0",
      "id": "74733889-4ecd-403e-9840-94e87c043f24",
      "isActive": true,
      "isEvmCompatible": true,
      "logoUrl": "https://res.cloudinary.com/dkgdc1vnl/image/upload/v1771445007/crypto-assets/base.png",
      "name": "base",
      "slug": "base",
      "symbol": "eth",
      "tokenStandard": null,
      "updatedAt": "2024-10-27T07:52:16.115Z"
    },
    "configurations": {
      "aml": {
        "message": "Address is not sanctioned",
        "provider": "ofac",
        "status": "success"
      }
    },
    "createdAt": "2024-11-11T16:57:19.160Z",
    "derivationPath": null,
    "id": "b87901a2-45c1-4d2d-8ee7-205ef0c4ddf1",
    "isActive": true,
    "metadata": null,
    "name": "External address",
    "network": "testnet",
    "type": "EXTERNAL",
    "updatedAt": "2024-11-11T16:57:19.160Z"
  },
  "message": "Address whitelisted successfully",
  "statusCode": 200
}
```

## Testing

<Note>Addresses generated via a testnet master wallet can only receive assets on the testnet.</Note>

Here is a list of places where you can get testnet assets to test with:

* **Ethereum** - Get test USDC here: [Circle](https://faucet.circle.com/)
* **Binance Smart Chain** - Get test USDT here: [Binance](https://www.bnbchain.org/en/testnet-faucet)
* **Polygon** - Get test USDC here: [Circle](https://faucet.circle.com/)
* **Base** - Get test USDC here: [Circle](https://faucet.circle.com/)
* **Tron** - Get test USDT here: [Nileex](https://nileex.io/join/getJoinPage)
* **Solana** - Get test USDC here: [Circle](https://faucet.circle.com)
* **Optimism** - Get test USDC here: [Circle](https://faucet.circle.com)
* **Arbitrum** - Get test USDC here: [Circle](https://faucet.circle.com)
* **Celo** - Get test USDC here: [Circle](https://faucet.circle.com)

<br />

<br />

Happy hacking! ❤️
