Skip to main content
With Privy, you can pregenerate self-custodial Ethereum and Solana embedded wallets for existing users, or create a new user with other login methods, like an email address or phone number, without requiring the user to login. You can even send assets to the wallet before the user logs in to your app for the first time. Once the user associated with the account logs in, they will be able to access the pregenerated wallet and any assets sent to them.

Pregenerating wallets for new users

  • NodeJS
  • NodeJS (server-auth)
  • Java
  • REST API
To pregenerate embedded wallets for a given user, use the create method on the users() interface of the Privy client.

Usage

const user = await privy.users().create({
    linked_accounts: [
        {
        type: 'email',
        address: '[email protected]',
        },
    ],
    custom_metadata: {
        username: 'name',
        isVerified: true,
        age: 23,
    },
    wallets: [
        {
            chain_type: 'ethereum',
            create_smart_wallet: true,
            additional_signers: [
                {
                    signer_id: '<signer-id>',
                    // Policies specific to this signer
                   override_policy_ids: ['<policy-id>']
                }
            ],
            // Policies for all transactions on the wallet, no matter the signer
            policy_ids: ['<policy-id>']
        },
        {
            chainType: 'solana',
            additional_signers: [
                {
                    signer_id: '<signer-id>',
                    override_policy_ids: ['<policy-id>']
                }
            ],
            policy_ids: []
        }
    ]
});

Params and Returns

Check out the API reference for more details.

Creating wallets for existing users

  • NodeJS
  • NodeJS (server-auth)
  • REST API
To create embedded wallets for an existing user, use the pregenerateWallets method from the users() interface of the Privy client.

Usage

const user = await privy.users().pregenerateWallets('did:privy:clddy332f002tyqpq3b3lv327', {
    wallets: [
        {
            chain_type: 'ethereum',
            create_smart_wallet: true,
        },
        {
            chain_type: 'solana',
        }
    ]
});
Check out the API reference for more details.
I