Skip to main content
Privy enables you to import wallet private keys for use via the Privy API. This allows you to migrate wallets from external sources to Privy, including from a different wallet provider. Or, your app can enable users to bring an existing external wallet into your application in order to access and manage their assets within your app seamlessly.

Importing a wallet

  • React
  • NodeJS
  • NodeJS (server-auth)
  • REST API
  • Rust
To import a private key wallet with the React SDK, use the importWallet method from the useImportWallet hook:
importWallet: (input: {privateKey: string}) => Promise<Wallet>;
  • EVM
  • Solana

Usage

import {useImportWallet} from '@privy-io/react-auth';

const {importWallet} = useImportWallet();

const wallet = await importWallet({
  privateKey: 'your-wallet-private-key'
});

Parameters

privateKey
string
The hex-encoded private key of the ethereum wallet to import, with or without a 0x prefix.

Returns

wallet
Promise<Wallet>
A Promise for the imported wallet object.

Using imported wallets

Imported wallets function the same way as Privy-generated wallets. See the API reference for Ethereum or Solana for information about how to send transactions and execute other wallet operations.
I