Skip to main content

Overview

This guide shows you how to import existing Bitcoin private keys into Dynamic’s MPC wallet system. This is useful when migrating from traditional Bitcoin wallets or integrating with existing systems.

Prerequisites

WIF Format

Bitcoin private keys are imported in WIF (Wallet Import Format). WIF is a base58-encoded format that includes:
  • Network identifier (mainnet or testnet)
  • The 32-byte private key
  • Compression flag
  • Checksum
Example WIF formats:
  • Mainnet compressed: L... or K... (52 characters)
  • Testnet compressed: c... (52 characters)

Supported Address Types

When importing a private key, you must specify the address type. Currently supported:
  • Native SegWit (P2WPKH): BitcoinAddressType.NATIVE_SEGWIT
  • Taproot (P2TR): BitcoinAddressType.TAPROOT

Import Your Bitcoin Private Key

Keep the returned wallet.walletMetadata. You pass it to signMessage, signTransaction and exportPrivateKey. Read the private key from a secret store or an environment variable, and never hard-code it.

Import with Different Address Types

Native SegWit

Taproot

Export Private Key

You can export an imported wallet’s private key back to WIF format:
exportPrivateKey returns the key in mainnet WIF format (starting with K or L), including for a wallet you use on testnet. Treat the exported key as highly sensitive and don’t log it.

Offline Export

If you need to export the private key from existing key shares without a network call, use offlineExportPrivateKey():
offlineExportPrivateKey needs the full set of key shares. In @dynamic-labs-wallet/node-btc 1.1.52, passing the externalServerKeyShares returned for a wallet that is backed up to Dynamic fails with Must provide at least min threshold of key shares.

Error Handling

The SDK supports both Bitcoin Mainnet and Testnet. Use BitcoinNetwork.MAINNET for production and BitcoinNetwork.TESTNET for development and testing.

Security Considerations

  • Private Key Format: Ensure your private key is in valid WIF format
  • Password Security: Use a strong, unique password
  • Key Storage: Never store private keys in plain text after import
  • Backup: Ensure you have a secure backup of your original private key
  • Key Share Backup: Use backUpToDynamic: true for secure key share storage

Threshold Signature Schemes

Choose based on your security and availability needs:
  • TWO_OF_TWO: Maximum security, requires both server and Dynamic
  • TWO_OF_THREE: Balanced security and availability

Next Steps

Last modified on October 27, 2026