Create a wallet
Privy enables you to programmatically create wallets embedded within your application. When you create a wallet, you can specify its owner
, which defines who controls the wallet.
- To create a user wallet, specify a user ID as an owner of the wallet. This ensures only the authenticated user has access to their wallet. All client-side SDKs create user wallets by default and automatically set the wallet owner as the authenticated user.
- Or, you can specify an authorization key as an
owner
on a wallet. The holder of the authorization key, typically your application backend, controls the wallet. You must use a server-side SDK to create wallets owned by an authorization key.
The React SDK supports automatically creating embedded wallets for your users when they log in to your app. View this guide to learn more and configure automatic wallet creation.
To create a wallet with the React SDK, use the createWallet
method from the useCreateWallet
hook:
Usage
Parameters
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for the linked account object for the created wallet.
Callbacks
You can optionally register an onSuccess
or onError
callback on the useCreateWallet
hook.
Optional callback to run after a user successfully creates a wallet.
Optional callback to run after there is an error during wallet creation.
To create a wallet with the React SDK, use the createWallet
method from the useCreateWallet
hook:
Usage
Parameters
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for the linked account object for the created wallet.
Callbacks
You can optionally register an onSuccess
or onError
callback on the useCreateWallet
hook.
Optional callback to run after a user successfully creates a wallet.
Optional callback to run after there is an error during wallet creation.
To create a wallet with the React SDK, use the createWallet
method from the useSolanaWallets
hook:
Usage
Parameters
The createWallet
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Solana wallet for the user if they already have an existing Solana embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
The linked account object for the created wallet.
To create a wallet in any of the chains supported at the Tier 2 level
with the React SDK, use the createWallet
method from the useCreateWallet
hook,
imported from @privy-io/react-auth/extended-chains
:
Usage
Parameters
The chain type of the wallet to create. This could be any of the chains supported at the Tier 2 level.
Returns
The React SDK supports automatically creating embedded wallets for your users when they log in to your app. View this guide to learn more and configure automatic wallet creation.
To create a wallet with the React SDK, use the createWallet
method from the useCreateWallet
hook:
Usage
Parameters
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for the linked account object for the created wallet.
Callbacks
You can optionally register an onSuccess
or onError
callback on the useCreateWallet
hook.
Optional callback to run after a user successfully creates a wallet.
Optional callback to run after there is an error during wallet creation.
To create a wallet with the React SDK, use the createWallet
method from the useCreateWallet
hook:
Usage
Parameters
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for the linked account object for the created wallet.
Callbacks
You can optionally register an onSuccess
or onError
callback on the useCreateWallet
hook.
Optional callback to run after a user successfully creates a wallet.
Optional callback to run after there is an error during wallet creation.
To create a wallet with the React SDK, use the createWallet
method from the useSolanaWallets
hook:
Usage
Parameters
The createWallet
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Solana wallet for the user if they already have an existing Solana embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
The linked account object for the created wallet.
To create a wallet in any of the chains supported at the Tier 2 level
with the React SDK, use the createWallet
method from the useCreateWallet
hook,
imported from @privy-io/react-auth/extended-chains
:
Usage
Parameters
The chain type of the wallet to create. This could be any of the chains supported at the Tier 2 level.
Returns
The React Native SDK supports automatically creating embedded wallets for your users when they log in to your app. View this guide to learn more and configure automatic wallet creation.
To create a wallet with the React Native SDK, use the create
method from the useEmbeddedEthereumWallet
hook:
Usage
Parameters
The create
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for an object containing the updated user
object for the user.
To create a wallet with the React Native SDK, use the create
method from the useEmbeddedEthereumWallet
hook:
Usage
Parameters
The create
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for an object containing the updated user
object for the user.
To create a wallet with the React Native SDK, use the create
method from the useEmbeddedSolanaWallet
hook:
Usage
Parameters
The create
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Solana wallet for the user if they already have an existing Solana embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for an object containing the updated user
object.
To create a wallet with the React Native SDK, use the create
method from the useEmbeddedBitcoinWallet
hook:
Usage
Parameters
The create
method optionally accepts as a parameter an opts
object with the following fields:
The type of Bitcoin wallet to create.
Whether or not to create an additional Bitcoin wallet for the user if they already have an existing Bitcoin embedded wallet. Must be set to true
to create additional wallets. Defaults to false
. Learn more
Returns
A Promise
for an object containing the updated user
object.
To create a wallet in any of the chains supported at the Tier 2 level
with the React Native SDK, use the createWallet
method from the useCreateWallet
hook,
imported from @privy-io/expo/extended-chains
:
Usage
Parameters
The chain type of the wallet to create. This could be any of the chains supported at the Tier 2 level.
Returns
To create a wallet with the Swift SDK, use the createEthereumWallet
method from the PrivyUser
instance:
Parameters
The createEthereumWallet
method optionally accepts the following parameters:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
The newly created EmbeddedEthereumWallet
.
To create a wallet with the Swift SDK, use the createEthereumWallet
method from the PrivyUser
instance:
Parameters
The createEthereumWallet
method optionally accepts the following parameters:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
The newly created EmbeddedEthereumWallet
.
To create a wallet with the Android SDK, use the createEthereumWallet
method from the PrivyUser
instance:
Parameters
The createEthereumWallet
method optionally accepts the following parameters:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
A Result
containing the EmbeddedEthereumWallet
for the user.
To create a wallet with the Android SDK, use the createEthereumWallet
method from the PrivyUser
instance:
Parameters
The createEthereumWallet
method optionally accepts the following parameters:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
A Result
containing the EmbeddedEthereumWallet
for the user.
To create a wallet with the Unity SDK, use the CreateWallet
method on your PrivyUser
instance:
Parameters
The CreateWallet
method accepts the following parameter:
Whether or not to create an additional wallet for the user if they already have an existing ethereum wallet.
Must be set to true
to create additional wallets.
Defaults to false
.
Returns
A Task
for the created ethereum wallet object.
To create a wallet with the Unity SDK, use the CreateWallet
method on your PrivyUser
instance:
Parameters
The CreateWallet
method accepts the following parameter:
Whether or not to create an additional wallet for the user if they already have an existing ethereum wallet.
Must be set to true
to create additional wallets.
Defaults to false
.
Returns
A Task
for the created ethereum wallet object.
To create a wallet with the Unity SDK, use the CreateSolanaWallet
method on your PrivyUser
instance:
Parameters
The CreateSolanaWallet
method accepts the following parameter:
Whether or not to create an additional wallet for the user if they already have an existing solana wallet.
Must be set to true
to create additional wallets.
Defaults to false
.
Returns
A Task
for the created solana wallet object.
To create a wallet with the Flutter SDK, use the createEthereumWallet
method from the PrivyUser
instance:
Parameters
The createEthereumWallet
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
A Result
containing the EmbeddedEthereumWallet
for the user.
To create a wallet with the Flutter SDK, use the createEthereumWallet
method from the PrivyUser
instance:
Parameters
The createEthereumWallet
method optionally accepts as a parameter an opts
object with the following fields:
Whether or not to create an additional Ethereum wallet for the user if they already have an existing Ethereum embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
A Result
containing the EmbeddedEthereumWallet
for the user.
To create a wallet with the Android SDK, use the createSolanaWallet
method from the PrivyUser
instance:
Parameters
The createSolanaWallet
method optionally accepts the following parameters:
Whether or not to create an additional Solana wallet for the user if they already have an existing Solana embedded wallet. Must be set to true
to create additional wallets. Defaults to false
.
Returns
A Result
containing the EmbeddedSolanaWallet
for the user.
To create a new wallet with the NodeJS SDK, use the create
method from the Privy client’s walletApi
class:
If you are creating a user wallet, you must specify the user ID as the owner of the wallet. You can obtain a user ID by first creating a user before creating the wallet.
Or, you can create a user and wallet at the same time.
Usage
Parameters
The create
method accepts as a parameter an input
object with the following fields:
Chain type of the wallet to create.
The user ID to set as the owner of the wallet, or the P-256 public key to set as the owner of the wallet.
If you provide this, do not specify an ownerId
as it will be generated automatically.
The key quorum ID of the owner of the wallet. If you provide this, do not specify an owner
.
List of policy IDs for policies that should be enforced on the wallet. Currently, only one policy is supported per wallet.
Idempotency key to identify a unique request.
List of key quorum IDs that should be allowed to approve transactions for the wallet.
Returns
Unique ID of the created wallet. This will be the primary identifier when using the wallet in the future.
Address of the created wallet.
Chain type of the created wallet.
List of policy IDs for policies that are enforced on the wallet.
The key quorum ID of the owner of the wallet. If an ownerId
was passed in, this response is the input ownerId
. If a user ID or authorization key was passed in as the owner
, this response is a newly created key quorum containing the input user ID or authorization key.
The key quorum IDs of the additional signers for the wallet.
Your app can provision a smart account with the wallet as a signer by following this guide.
To create a new wallet for a user, make a POST
request to
If you are creating a user wallet, you must specify the user ID as the owner of the wallet. You can obtain a user ID by first creating a user before creating the wallet.
Or, you can create a user and wallet at the same time.
Body
In the request body, include the following fields.
Chain type of the wallet to create.
The user ID to set as the owner of the wallet, or the P-256 public key to set as the owner of the wallet.
If you provide this, do not specify an owner_id
as it will be generated automatically.
The key quorum ID of the owner of the wallet. If you provide this, do not specify an owner
.
List of policy IDs for policies that should be enforced on the wallet. Currently, only one policy is supported per wallet.
Idempotency key to identify a unique request.
The key quorum IDs to add as additional signers for the wallet.
Response
In the response, Privy will send back the following if successful:
Unique ID of the created wallet. This will be the primary identifier when using the wallet in the future.
Address of the created wallet.
Chain type of the created wallet.
List of policy IDs for policies that are enforced on the wallet.
The key quorum ID of the owner of the wallet. If an ownerId
was passed in, this response is the input ownerId
. If a user ID or authorization key was passed in as the owner
, this response is a newly created key quorum containing the input user ID or authorization key.
The key quorum IDs of the additional signers for the wallet.
The creation date of the wallet, in milliseconds since midnight, January 1, 1970 UTC.
Example
A sample request might look like the following:
A successful response will look like the following: