Recommended: JavaScript SDK with React Hooks
For new React apps, we recommend the JavaScript SDK with React Hooks (
@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.General Setup
Formatting
| Chain | ✅ Import Format | ✅ Export Format |
|---|---|---|
| EVM | Hexadecimal with or without 0x | Hexadecimal without 0x |
| Solana | Base58-encoded private key | Base58-encoded private key |
| Sui | Bech32-encoded private key | Bech32-encoded private key |
Importing Wallet Keys
When importing an existing private key into Dynamic’s TSS-MPC system, we use Shamir Secret Sharing (SSS) to securely split the key into multiple shares. This process:- Takes your existing private key as input
- Uses SSS to split it into either 2 or 3 shares (depending on your configuration)
- Distributes the shares between the relevant parties (user, server, and optionally a backup)
- Securely destroys the original private key
Using your UI
importPrivateKey(options) imports a private key. Available from the useDynamicWaas hook.
Parameters:
privateKey: string - The private key to importthresholdSignatureScheme: ThresholdSignatureScheme - Defaults to ThresholdSignatureScheme.TWO_OF_TWO
Exporting Wallet Keys
For maximum user control and portability, Dynamic allows users to export their private keys. During export:- The key shares are temporarily recombined on the user’s device using secure MPC
- The private key is constructed client side and provided to the user
When implementing Dynamic in a custom UI, please ensure you are surfacing this flow to your end-users, so that they always maintain control of their wallet.
Private Key Export Settings
By default, users can export their private keys from embedded wallets. You can control this setting in the Embedded Wallets dashboard. Navigate to the Security section and toggle Private Key Exports to enable or disable private key exports.
Using our UI
The Dynamic export flow reveals the private key/seed phrase in an secure isolated iFrame to limit the ability of Dynamic, the developer, or anyone in the flow to view the exported key. For more details on the security of the iframe and cryptographic flows go to our FAQs.
Using your UI
exportPrivateKey(options)
The exportPrivateKey method uses the SDK to render into a secure, sandboxed, cross‑origin iframe you don’t control in order to display the private key in a secure manner. You cannot access or manipulate the iframe content.
Parameters:
accountAddress: string - The address of the account to exportdisplayContainer: HTMLIFrameElement - The container to display the private key in
exportClientKeyshares(options)
Exports client keyshares for a specific account as a download through a secure iframe.
Parameters:
accountAddress: string - The address of the account to export keyshares for