Pregenerating wallets
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
To pregenerate embedded wallets for a given user, use the importUser
method from PrivyClient
.
Usage
Params
An array of linked accounts to associate with the user.
(Optional) Whether to create an Ethereum wallet for the user.
(Optional) Whether to create a Solana wallet for the user.
(Optional) Whether to create an Ethereum smart wallet for the user.
(Optional) Custom metadata to associate with the user.
Returns
To pregenerate embedded wallets for a given user, use the importUser
method from PrivyClient
.
Usage
Params
An array of linked accounts to associate with the user.
(Optional) Whether to create an Ethereum wallet for the user.
(Optional) Whether to create a Solana wallet for the user.
(Optional) Whether to create an Ethereum smart wallet for the user.
(Optional) Custom metadata to associate with the user.
Returns
To pregenerate embedded wallets for a given user, make a POST request to https://auth.privy.io/api/v1/users
.
Usage
Below is a sample cURL command for generating a new wallet for a user with Privy:
A successful response will include the new user object along with their user ID and embedded wallet address, like below:
Parameters
An array of linked accounts to associate with the user.
(Optional) Whether to create an Ethereum wallet for the user.
(Optional) Whether to create a Solana wallet for the user.
(Optional) Whether to create an Ethereum smart wallet for the user.
(Optional) Custom metadata to associate with the user.
Pregenerating wallets for existing users
To create embedded wallets for an existing user, use the createWallets
method from PrivyClient
.
Usage
Params
The Privy user ID to create wallets for.
(Optional) Whether to create an Ethereum wallet for the user.
(Optional) Whether to create a Solana wallet for the user.
(Optional) Whether to create an Ethereum smart wallet for the user.
(Optional) The number of Ethereum wallets to pregenerate for the user. Defaults to 1
.
Returns
To create embedded wallets for an existing user, use the createWallets
method from PrivyClient
.
Usage
Params
The Privy user ID to create wallets for.
(Optional) Whether to create an Ethereum wallet for the user.
(Optional) Whether to create a Solana wallet for the user.
(Optional) Whether to create an Ethereum smart wallet for the user.
(Optional) The number of Ethereum wallets to pregenerate for the user. Defaults to 1
.
Returns
To pregenerate embedded wallets for a given user, make a POST request to https://auth.privy.io/api/v1/apps/<your-app-id>/users/wallet
.
Usage
Below is a sample cURL command for generating a new wallet for a user with Privy:
A successful response will include the new user object along with their user ID and embedded wallet address, like below:
Parameters
The Privy user ID to create wallets for.
(Optional) Whether to create an Ethereum wallet for the user.
(Optional) Whether to create a Solana wallet for the user.
(Optional) Whether to create an Ethereum smart wallet for the user.
(Optional) The number of Ethereum wallets to pregenerate for the user. Defaults to 1
.