Documentation Index
Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
importPrivateKey brings an externally-managed private key into the Dynamic MPC system. The imported wallet is stored as a standard MPC wallet with the canonical share layout (client + Dynamic + optional backup) — there is no insecure “key copy”, and the raw private key is never persisted in plaintext after the import ceremony.
Use this for:
- Migrating wallets from another custody system
- Bringing a wallet you previously exported back into MPC
- Onboarding existing on-chain accounts to Dynamic
DynamicEvmWalletClient::importPrivateKey— EVM, takes raw 32 bytesDynamicSvmWalletClient::importPrivateKey— SVM, takes the 32-byte Ed25519 seed (the seed half of a 64-byte keypair)DynamicWalletClient::importRawPrivateKey— chain-agnostic, takes aChainNameenum and lets you tune the threshold scheme
Prerequisites
- Set up your Dynamic project
- An authenticated client (
DynamicEvmWalletClient,DynamicSvmWalletClient, or the baseDynamicWalletClient) - The raw private key bytes (handle them as
byte[]and zero the array after import)
EVM Import
SVM Import
Solana’s native
Keypair is 64 bytes (seed || pubkey). Pass only the first 32 bytes — importPrivateKey derives the public key itself and would reject a 64-byte input.Chain-Agnostic Import
When you want a single code path that handles both EVM and Solana, useDynamicWalletClient::importRawPrivateKey:
Backup After Import
importPrivateKey does not back up to Dynamic automatically. After a successful import:
- Persist the returned
wallet.externalServerKeyShares()to your secrets vault. - If you also want Dynamic-backed storage, call
backupKeyShares(...)on the base client with the password you want to use.
Best Practices
- Treat the source private key as compromised after import. Anyone who held the key before import still has signing power — rotate any on-chain authority that depends on it.
- Zero the source bytes immediately after the import ceremony returns (
Arrays.fill(privateKey, (byte) 0)). - Never log the raw key — redact it from all logs, error messages, and exception payloads.
- Run the import inside try-with-resources so the wallet client and its native handles are released even if vault writes fail.
Next Steps
- Storage Best Practices — persist what the import returned
- Sign EVM messages / Sign SVM messages
- Password & state queries — manage the backup password lifecycle