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

> ## Agent Instructions
> Before reading these docs, install the relevant Circle Skill to get pre-loaded context — skills are LLM-optimized and cover architecture decisions, correct flows, and common pitfalls. In Claude Code: run /plugin marketplace add circlefin/skills then /plugin install circle-skills@circle. With Vercel Skills CLI: run npx skills add circlefin/skills. Available skills: use-usdc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-usdc/SKILL.md (balances, transfers, approvals on EVM and Solana); EURC has no skill — see https://developers.circle.com/stablecoins/what-is-eurc.md; bridge-stablecoin https://github.com/circlefin/skills/blob/master/plugins/circle/skills/bridge-stablecoin/SKILL.md (crosschain transfers via CCTP, USDC, EURC, and third-party assets); use-arc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-arc/SKILL.md (Arc chain config, contract deployment, USDC bridging — Arc docs: https://docs.arc.io/llms.txt); use-circle-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-circle-wallets/SKILL.md (choose wallet type); use-developer-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-developer-controlled-wallets/SKILL.md (custodial wallets for payouts and treasury); use-user-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-user-controlled-wallets/SKILL.md (embedded wallets with Web2 login); use-modular-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-modular-wallets/SKILL.md (smart contract wallets with passkeys and ERC-4337); use-gateway https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-gateway/SKILL.md (unified USDC balance, nanopayments); use-smart-contract-platform https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-smart-contract-platform/SKILL.md (deploy, interact, monitor contracts). Pair any skill with the Circle MCP server for live SDK signatures, contract addresses, and chain IDs: {"mcpServers":{"circle":{"url":"https://api.circle.com/v1/codegen/mcp"}}}.
> Read the product overview first. Each product has an overview explaining when and why to use it. Read it before quickstarts.
> Pick the right wallet type. Developer-controlled (you hold keys), user-controlled (end user holds keys via PIN/social login), or modular (smart contract wallets with passkeys). See https://developers.circle.com/wallets.md.
> Use CCTP V2 for crosschain transfers. CCTP natively transfers USDC and EURC via burn-and-mint, and supports permissionless wrapping of third-party assets via lock-and-mint. V1 is legacy; always use V2 unless V1 is specified or the chain requires it (Noble, Sui, and Aptos still require V1). Migration guide: https://developers.circle.com/cctp/migration-from-v1-to-v2.md.
> Use Bridge Kit for frontend bridging. Wraps CCTP with a simpler SDK for user-facing apps. Use CCTP directly for backend transfers.
> Gas Station vs Paymaster. Gas Station sponsors gas for Circle Wallet transactions. Paymaster lets users pay gas in USDC. Different use cases — read both overviews.
> Gateway Nanopayments for sub-cent payments. Gasless USDC micropayments down to $0.000001 via x402 and batched settlement. For pay-per-request APIs, AI agent payments, streaming.
> Look up USDC addresses per chain. Never hardcode — use https://developers.circle.com/stablecoins/usdc-contract-addresses.md.
> Prefer SDKs over raw API calls. Node.js and Python SDKs handle auth, retries, and errors.
> API key required. Bearer token in Authorization header. Testnet and mainnet use separate keys and may use different base URLs depending on the product.
> Set up webhooks when available. Most operations are async. Webhooks deliver transaction confirmations and state changes.
> When calling list endpoints, paginate using pageSize and pageAfter until no nextPageAfter cursor is returned—stopping at the first page silently misses records.
> Building an AI agent? Start with the Agent Stack—Circle CLI, agent wallets, and nanopayments built for autonomous use cases: https://developers.circle.com/agent-stack.md.

# How-to: Pre-create wallets and assign on demand

> Create a pool of unassigned wallets in advance and assign them to new users on demand as they sign up.

Create a pool of developer-controlled wallets before users arrive so wallets are
ready to assign instantly. When a new user signs up, assign an available wallet
by updating its `name` and `refId` fields. This approach reduces sign-up latency
because wallet creation happens ahead of time rather than during registration.

<Warning>
  **Cost consideration for Externally Owned Account (EOA) wallets**

  Creating EOA wallets on mainnet incurs a minor expense per wallet. To optimize
  costs, forecast user demand and batch-create wallets accordingly. For example,
  prepare enough wallets to cover the expected demand for the next 30 days to
  avoid unnecessary expenses.
</Warning>

## Prerequisites

Before you begin, ensure that you've:

* Created a
  [Circle Developer Account and an API key](/w3s/circle-developer-account).
* Generated and registered an entity secret using the
  [Circle Console](https://console.circle.com/wallets/dev/configurator/entity-secret)
  or the
  [SDK](/wallets/dev-controlled/register-entity-secret#create-an-entity-secret-using-the-sdk).
* Created a wallet set. If you haven't, complete the
  [Create a dev-controlled wallet](/wallets/dev-controlled/create-your-first-wallet)
  quickstart first.
* Installed [Node.js 22+](https://nodejs.org/) or
  [Python 3.11+](https://www.python.org/).
* Installed the applicable server-side SDK for your language:

  <Tabs>
    <Tab title="Node.js">
      Use the following commands to install the SDK. You can
      [view the package information on the npm site](https://www.npmjs.com/package/@circle-fin/developer-controlled-wallets).

      <CodeGroup>
        ```shell npm theme={null}
        npm install @circle-fin/developer-controlled-wallets --save
        ```

        ```shell yarn theme={null}
        yarn add @circle-fin/developer-controlled-wallets
        ```
      </CodeGroup>

      For more information, visit the
      [Node.js SDK](/sdks/developer-controlled-wallets-nodejs-sdk).
    </Tab>

    <Tab title="Python">
      Use the following command to install the SDK with
      [pip](https://pypi.org/project/pip/):

      ```shell theme={null}
      pip install circle-developer-controlled-wallets
      ```

      For more information, visit the
      [Python SDK](/sdks/developer-controlled-wallets-python-sdk).
    </Tab>
  </Tabs>

## Step 1. Create a pool of unassigned wallets

Call the create wallets endpoint with a `count` value but without `metadata`.
Omitting `metadata` creates wallets that have no `name` or `refId`, leaving them
available for assignment later.

<Note>
  You can create up to 200 wallets per request. If you need more, make additional
  requests until you reach the required total.
</Note>

<CodeGroup>
  ```ts Node.js SDK theme={null}
  import { initiateDeveloperControlledWalletsClient } from "@circle-fin/developer-controlled-wallets";

  const client = initiateDeveloperControlledWalletsClient({
    apiKey: process.env.CIRCLE_API_KEY!,
    entitySecret: process.env.CIRCLE_ENTITY_SECRET!,
  });

  const response = await client.createWallets({
    walletSetId: "your-wallet-set-id",
    blockchains: ["ARC-TESTNET"],
    count: 50,
    accountType: "SCA",
  });

  console.log(response.data?.wallets);
  ```

  ```python Python SDK theme={null}
  import os
  from circle.web3 import developer_controlled_wallets

  client = developer_controlled_wallets.DeveloperControlledWalletsClient(
      api_key=os.getenv("CIRCLE_API_KEY"),
      entity_secret=os.getenv("CIRCLE_ENTITY_SECRET"),
  )

  response = client.create_wallets(
      wallet_set_id="your-wallet-set-id",
      blockchains=["ARC-TESTNET"],
      count=50,
      account_type="SCA",
  )

  print(response.data.wallets)
  ```
</CodeGroup>

The response contains the newly created wallets. The `name` and `refId` fields
are omitted because no `metadata` was provided:

```json Response theme={null}
{
  "data": {
    "wallets": [
      {
        "id": "66b67097-307e-5b46-a1d5-0b1577d67fd4",
        "state": "LIVE",
        "walletSetId": "018b42d2-cc38-7a1e-a47a-5927d2c97f16",
        "custodyType": "DEVELOPER",
        "address": "0xe55628c98f5d81daaa79b72899b38a3535d10990",
        "blockchain": "ARC-TESTNET",
        "accountType": "SCA",
        "updateDate": "2024-01-22T22:57:20Z",
        "createDate": "2024-01-22T22:57:20Z"
      },
      {
        "id": "cda61d8d-7d46-5a39-a8a6-6b4a3d6fdac3",
        "state": "LIVE",
        "walletSetId": "018b42d2-cc38-7a1e-a47a-5927d2c97f16",
        "custodyType": "DEVELOPER",
        "address": "0x29b27e792b8b854e48e85ab4f456cf5a9f1579fb",
        "blockchain": "ARC-TESTNET",
        "accountType": "SCA",
        "updateDate": "2024-01-22T22:57:20Z",
        "createDate": "2024-01-22T22:57:20Z"
      }
    ]
  }
}
```

## Step 2. Store wallet IDs

Persist the returned wallet IDs in your system and mark each one as
**unassigned**. The storage mechanism is application-specific—you might use a
database table, a key-value store, or any other persistence layer your
application already uses.

Track each wallet's assignment status so that when a new user signs up, your
application can quickly select an unassigned wallet and avoid double-assigning
the same wallet to multiple users. A simple boolean flag or status column (for
example, `assigned: false`) works for most implementations.

## Step 3. Assign a wallet to a new user

When a user registers, select an unassigned wallet from the pool and call the
update wallet endpoint to set its `name` and `refId`. The `refId` field is
designed for linking wallets to entities in your own system, such as a user ID.

This endpoint does not require `entitySecretCiphertext`, so no entity secret
encryption is needed for this call.

<CodeGroup>
  ```ts Node.js SDK theme={null}
  const walletId: string = "66b67097-307e-5b46-a1d5-0b1577d67fd4";
  const userId: string = "d4f2c8a1-9b3e-4f7d-a6e5-1c8b9d0e3f2a";

  const updated = await client.updateWallet({
    id: walletId,
    name: "User Wallet",
    refId: userId,
  });

  console.log(updated.data?.wallet);
  ```

  ```python Python SDK theme={null}
  wallet_id = "66b67097-307e-5b46-a1d5-0b1577d67fd4"
  user_id = "d4f2c8a1-9b3e-4f7d-a6e5-1c8b9d0e3f2a"

  updated = client.update_wallet(
      id=wallet_id,
      name="User Wallet",
      ref_id=user_id,
  )

  print(updated.data.wallet)
  ```
</CodeGroup>

The response confirms the wallet now has the assigned `name` and `refId`:

```json Response theme={null}
{
  "data": {
    "wallet": {
      "id": "66b67097-307e-5b46-a1d5-0b1577d67fd4",
      "state": "LIVE",
      "walletSetId": "018b42d2-cc38-7a1e-a47a-5927d2c97f16",
      "custodyType": "DEVELOPER",
      "refId": "d4f2c8a1-9b3e-4f7d-a6e5-1c8b9d0e3f2a",
      "name": "User Wallet",
      "address": "0xe55628c98f5d81daaa79b72899b38a3535d10990",
      "blockchain": "ARC-TESTNET",
      "accountType": "SCA",
      "updateDate": "2024-01-22T23:15:42Z",
      "createDate": "2024-01-22T22:57:20Z"
    }
  }
}
```

After the update succeeds, mark the wallet as **assigned** in your own system so
it is no longer available in the unassigned pool.

## Step 4. Verify the assignment

Call the list wallets endpoint filtered by `refId` to confirm the wallet is
correctly assigned to the user.

<CodeGroup>
  ```ts Node.js SDK theme={null}
  const userId: string = "d4f2c8a1-9b3e-4f7d-a6e5-1c8b9d0e3f2a";

  const wallets = await client.listWallets({
    refId: userId,
  });

  console.log(wallets.data?.wallets);
  ```

  ```python Python SDK theme={null}
  user_id = "d4f2c8a1-9b3e-4f7d-a6e5-1c8b9d0e3f2a"

  wallets = client.list_wallets(
      ref_id=user_id,
  )

  print(wallets.data.wallets)
  ```
</CodeGroup>

The response returns only wallets matching the specified `refId`:

```json Response theme={null}
{
  "data": {
    "wallets": [
      {
        "id": "66b67097-307e-5b46-a1d5-0b1577d67fd4",
        "state": "LIVE",
        "walletSetId": "018b42d2-cc38-7a1e-a47a-5927d2c97f16",
        "custodyType": "DEVELOPER",
        "refId": "d4f2c8a1-9b3e-4f7d-a6e5-1c8b9d0e3f2a",
        "name": "User Wallet",
        "address": "0xe55628c98f5d81daaa79b72899b38a3535d10990",
        "blockchain": "ARC-TESTNET",
        "accountType": "SCA",
        "updateDate": "2024-01-22T23:15:42Z",
        "createDate": "2024-01-22T22:57:20Z"
      }
    ]
  }
}
```
