> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Import TON Private Keys

> Learn how to import existing TON private keys into Dynamic's MPC wallet system

## Overview

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

## Prerequisites

* [Set up your Dynamic project](/node/quickstart)
* Have your existing TON private key ready

## Import Your TON Private Key

```typescript theme={"system"}
import { authenticatedTonClient } from './client';
import { ThresholdSignatureScheme } from '@dynamic-labs-wallet/node';

const tonClient = await authenticatedTonClient();

const wallet = await tonClient.importPrivateKey({
  privateKey: 'YourTonPrivateKey',
  chainName: 'TON',
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'your-secure-password',
  backUpToDynamic: true,
});

console.log('TON wallet imported:', wallet.accountAddress);
console.log('Public key:', wallet.rawPublicKey);
console.log('External server key shares:', wallet.externalServerKeyShares);
```

## Offline Export

If you need to export the private key from existing key shares without a network call, use `offlineExportPrivateKey()`:

```typescript theme={"system"}
const { derivedPrivateKey } = await tonClient.offlineExportPrivateKey({
  keyShares: wallet.externalServerKeyShares,
  derivationPath: undefined, // optional
});

console.log('Exported private key (hex):', derivedPrivateKey);
```

## Security Considerations

* **Private Key Format**: Ensure your private key is in the correct format (hex or base64)
* **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

* [Sign TON transactions](/node/ton/sign-transactions)
* [Sign TON messages](/node/ton/sign-messages)
* [Use imported TON wallets](/node/ton/use-imported-wallets)
