Creating a Wallet

Creating a Wallet

How agent wallets are provisioned, and how to generate CAIDs securely.

Runtime

Wallets are created automatically when you call nomiqon.agents.create(). Under the hood, Nomiqon derives a Solana address from the agent's CAID public key and provisions an associated SPL Token account for the USDC mint.

Automatic provisioning (recommended)

typescriptnomiqon.com
import { Nomiqon } from "@nomiqon/sdk";

const nomiqon = new Nomiqon({ apiKey: process.env.NOMIQON_API_KEY! });

const agent = await nomiqon.agents.create({
  name: "data-pipeline-agent",
  policy: { dailyCap: "5.00" },
});

console.log(agent.wallet.address);   // Solana public key
console.log(agent.wallet.balance);   // "0.000000" USDC (unfunded)
console.log(agent.wallet.mint);      // EPjFWdd5... (USDC SPL mint)

Bring-your-own keypair (advanced)

For scenarios where your infrastructure already manages Ed25519 keypairs (HSMs, KMS-backed wallets), you can register an existing public key as the agent's CAID.

typescriptnomiqon.com
import { Keypair } from "@solana/web3.js";

// Generate in your secure environment — never send the secret key to Nomiqon
const keypair = Keypair.generate();

const agent = await nomiqon.agents.create({
  name: "hsm-backed-agent",
  caid: {
    publicKey: keypair.publicKey.toBase58(),   // Only the public key is sent
  },
  policy: { dailyCap: "25.00" },
});
Warning
A wallet must be funded with USDC before any spend can be approved. An agent with a zero balance will receive 402 insufficient_balance on the first spend attempt.

Wallet lifecycle states

provisionedAccount created on Solana, balance zero.
fundedUSDC balance > 0; agent can spend up to policy limits.
low_balanceBalance < 10% of the active daily cap. Triggers a webhook event.
depletedBalance = 0. All spend requests will be rejected.
frozenManually frozen by the account owner; no spends allowed.
Creating a Wallet — Nomiqon Docs