Skip to main content

Usage

// Default CHIPI wallet (session keys, passkey support)
const newWallet = await serverClient.createWallet({
  params: {
    encryptKey: "user-secure-pin",
    externalUserId: "your-user-id-123",
    chain: "STARKNET",
  },
});

// READY wallet (Argent X compatible, no session keys)
const readyWallet = await serverClient.createWallet({
  params: {
    encryptKey: "user-secure-pin",
    externalUserId: "your-user-id-456",
    chain: "STARKNET",
    walletType: "READY",
  },
});

// Custom account implementation (advanced)
const customWallet = await serverClient.createWallet({
  params: {
    encryptKey: "user-secure-pin",
    externalUserId: "your-user-id-789",
    chain: "STARKNET",
    classHash: "0x0484bbd2404b3c7264bea271f7267d6d4004821ac7787a9eed7f472e79ef40d1",
  },
});

Parameters

ParameterTypeRequiredDescription
encryptKeystringYesUser-defined code or password to encrypt the wallet’s private key
externalUserIdstringYesYour application’s unique identifier for the user
chainstringYesBlockchain network. Currently only "STARKNET"
walletTypestringNo"CHIPI" (default) or "READY". CHIPI supports session keys and passkeys. READY is Argent X compatible.
classHashstringNoCustom StarkNet class hash for the wallet contract. Overrides the default for the wallet type. Must be declared on mainnet and implement SNIP-9. See Custom Wallet Types.
usePasskeybooleanNoUse WebAuthn passkey for encryption instead of PIN

Return Value

Returns a Promise that resolves to an object containing:
  • publicKey: The wallet’s StarkNet address
  • encryptedPrivateKey: The encrypted private key (store securely)
  • walletType: The wallet type that was created
  • classHash: The class hash used for deployment

Example Implementation

import { ChipiServerSDK } from "@chipi-stack/backend";

const serverClient = new ChipiServerSDK({
  apiPublicKey: process.env.CHIPI_PUBLIC_KEY!,
  apiSecretKey: process.env.CHIPI_SECRET_KEY!,
});

async function createUserWallet(userId: string, userPin: string) {
  const newWallet = await serverClient.createWallet({
    params: {
      encryptKey: userPin,
      externalUserId: userId,
      chain: "STARKNET",
    },
  });

  console.log("Wallet created:", newWallet.publicKey);

  // Store wallet data in your database
  await saveWalletToDatabase({
    userId,
    publicKey: newWallet.publicKey,
    encryptedPrivateKey: newWallet.encryptedPrivateKey,
  });

  return newWallet;
}
Wallet creation is free! Gas fees are sponsored by the Chipi paymaster for all wallet types.

Wallet Types

TypeAccountSession KeysPasskeysUse Case
CHIPIOpenZeppelin + SNIP-9YesYesDefault. Best for most apps.
READYArgent X v0.4.0NoNoArgent X ecosystem compatibility
CustomAny SNIP-9 accountDependsDependsAdvanced: bring your own account