Skip to main content
Privy enables your users to export the private key for their embedded wallet. This allows them to use their embedded wallet address with another wallet client, such as MetaMask or Phantom.

Availability

Export access depends on wallet ownership and authorization.

Client-side export

User-owned embedded wallets can be exported using the exportWallet method in Privy’s React SDK. (This includes wallets created server-side with a Privy user as the owner) Due to the sensitive nature of key export, client side export is only available in the React SDK where the operation can be secured with strict browser security guarantees. If you’d like to enable key export with one of Privy’s other client-side SDKs, we encourage setting up a minimal web page with Privy’s React SDK and export wallet functionality that you can direct users to.
For a step-by-step guide on enabling key export from React Native, Swift, Android, and Flutter apps using a WebView, see the mobile key export recipe.
By default, to use wallets, users authenticate to the Privy API directly from their client using their access token. This means that users can send transactions or export their keys using their access token with the Privy API, even if an application does not implement Privy’s exportWallet method. This design ensures users always retain self-sovereign access to their wallet keys.To prevent users from unilaterally exporting keys, applications can set up a 2-of-2 key quorum as the wallet owner, consisting of the user and an authorization key controlled by the application’s server. This requires authorization from both parties to export the wallet.

Server-side export

Wallets can be exported using Privy’s server-side SDKs or REST API, regardless of whether they were created client-side or server-side. Provide the wallet owner’s credentials in the authorization context. App credentials alone do not authorize export for user owned wallets.
Wallet export is restricted to wallet owners and enabled by default, unless explicitly disabled by a DENY policy. Wallets without owners cannot be exported.

Supported chains

Key export is available for all wallets on every supported tier.

Usage

To have your user export their embedded wallet’s private key, use Privy’s exportWallet method:
When invoked, exportWallet will open a modal where your user can copy the full private key for their embedded wallet. The modal will also link your user to a guide for how to load their embedded wallet into another wallet client, such as MetaMask or Phantom.If your user is not authenticated or has not yet created an embedded wallet in your app, this method will fail.As an example, you might attach exportWallet to an export wallet button in your app:
If your application uses smart wallets on EVM networks, exporting the wallet will export the private key for the smart wallet’s signer, and not the smart wallet itself. Users can control their smart wallet via this private key, but will be required to manually use it to sign calls to the contract for their smart wallet directly to use the smart wallet outside of your app.

Exporting HD wallets

If your user has multiple embedded wallets, you can export the private key for a specific wallet by passing the address of your desired wallet as an address parameter to the exportWallet method:
When your user exports their embedded wallet, their private key is assembled on a different origin than your app’s origin. This means neither you nor Privy can ever access your user’s private key. Your user is the only party that can ever access their full private key.

Private key formats

The format of the exported private key varies depending on the chain type of the wallet: