Privy enables you to import HD wallets 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

To import an HD wallet, you’ll provide your 12 or 24 word BIP39 mnemonic and the specific address and index you’d like to import.
If you’d like to import multiple addresses for the same HD wallet, you can make multiple import calls with the same mnemonic and each index/address pair you’d like to import.
To import an HD wallet with the NodeJS SDK, use the importWallet method from the Privy client’s walletApi class. The Privy client will encrypt your mnemonic for secure transmission to the TEE. See architecture for more details.
import {PrivyClient} from '@privy-io/server-auth';

const privy = new PrivyClient('your-app-id', 'your-app-secret');

const wallet: WalletApiWalletResponseType = await privy.walletApi.importWallet({
  address: '<your-wallet-address>',
  chainType: 'ethereum',
  entropy: '<your-bip39-mnemonic>',
  entropyType: 'hd',
  index: <your-wallet-index>
});
The returned wallet is type WalletApiWalletResponseType. See get wallet by ID for type definition.

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.