Skip to main content

Function Signature

Description

Imports an existing private key into the MPC wallet system. The private key is split into shares according to the specified threshold signature scheme. Returns a walletMetadata object (non-sensitive identity + backup pointers) alongside the sensitive externalServerKeyShares. Persist bothwalletMetadata in your cache and externalServerKeyShares in a secrets vault.

Parameters

Required Parameters

  • privateKey (string) - The private key to import (64 hex characters with 0x prefix)
  • chainName (string) - The chain name (use ‘EVM’ for Ethereum chains)
  • thresholdSignatureScheme (ThresholdSignatureScheme) - The threshold signature scheme for the wallet

Optional Parameters

  • password (string) - Password to protect the wallet’s key shares. Required when backUpToDynamic is true. You can use the same password for all wallets or a unique password per wallet.
  • onError ((error: Error) => void) - Error callback function
  • backUpToDynamic (boolean) - Whether to back up the first key share to Dynamic’s client share service (defaults to false). When true, a password must be provided.

Returns

  • Promise<object> - Object containing wallet information:
    • walletMetadata (WalletMetadata) - Non-sensitive identity + backup-pointer metadata. The wallet’s address is at walletMetadata.accountAddress. Persist this in your cache.
    • publicKeyHex - Public key in hex format
    • rawPublicKey - Raw public key object
    • externalServerKeyShares (ServerKeyShare[]) - Sensitive plaintext shares for MPC operations. Store these in a secrets vault.
    • externalKeySharesWithBackupStatus - Array of key shares with their backup status (see createWalletAccount for details)

Example

Error Handling

Last modified on May 21, 2026