Skip to main content

Overview

Pre-generate embedded wallets for your users before they sign in, enabling you to fund accounts with assets upfront for a seamless first-time experience.

Why pre-generate wallets?

  • Pre-load assets: Fund wallets with loyalty points, gas, or welcome NFTs before users sign in
  • Zero-friction onboarding: Users see a ready-to-use wallet on first login instead of an empty account
  • Targeted campaigns: Prepare wallets for specific users (by email or phone) before launching marketing campaigns

Prerequisites

Before pre-generating wallets, ensure you have:

Usage

Use the CDP SDK to create an end user with a specific authentication method. Once created, you can fund the wallet address before the user ever signs in.
The authentication methods currently supported are email and sms. See Authentication Methods for more details.

Creating an end user

The createEndUser method creates a new end user with an associated wallet. You specify the authentication method (email or SMS) that the user will use to sign in later.
  • TypeScript
  • Python
import { CdpClient } from "@coinbase/cdp-sdk";
import "dotenv/config";

const cdp = new CdpClient();

try {
  // Create an end user with an email authentication method and an EVM account.
  const endUser = await cdp.endUser.createEndUser({
    authenticationMethods: [
      { type: "email", email: "[email protected]" }
    ],
    evmAccount: { createSmartAccount: false }
  });

  console.log("Created end user:", endUser);

  // The end user's wallet address is now available.
  // You can fund this address before the user signs in.
  console.log("Wallet address:", endUser.evmAccounts?.[0]);
} catch (error) {
  console.error("Error creating end user:", error);
}