> ## 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.

# Create TRON Wallet

> Learn how to create and manage TRON server wallets with Dynamic's Node SDK

## Overview

This guide walks you through creating TRON wallets using Dynamic's Node SDK. You'll learn how to set up different threshold signature schemes and understand the security implications for TRON blockchain operations.

## Prerequisites

Before you begin, make sure you have:

* [Set up your Dynamic project](/docs/node/quickstart)
* [Created an authenticated client](/docs/node/quickstart)
* [Enabled TRON chain in your dashboard](https://console.dynamic.xyz/dashboard/chains)

## Step 1: Choose Your Security Model

Dynamic supports three threshold signature schemes for TRON wallets:

### TWO\_OF\_TWO (Recommended for most use cases)

* **Security**: Highest, requiring both your server and Dynamic's infrastructure
* **Availability**: Lower, since both parties must be online
* **Use case**: High-value transactions, maximum security

### TWO\_OF\_THREE

* **Security**: High, requiring 2 out of 3 shares
* **Availability**: Medium, tolerating one party being offline
* **Use case**: Balanced security and availability

### THREE\_OF\_FIVE

* **Security**: High, requiring 3 out of 5 shares
* **Availability**: Highest, tolerating two parties being offline
* **Use case**: Maximum fault tolerance and availability

## Step 2: Create Your First TRON Wallet

Here's a complete example of creating a TRON wallet:

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

// Create authenticated client
export const authenticatedTronClient = async () => {
  const client = new DynamicTronWalletClient({
    environmentId: process.env.DYNAMIC_ENVIRONMENT_ID!,
  });

  await client.authenticateApiToken(process.env.DYNAMIC_AUTH_TOKEN!);
  return client;
};

export const createTronWallet = async ({
  thresholdSignatureScheme = ThresholdSignatureScheme.TWO_OF_TWO,
  password,
  onError
}: {
  thresholdSignatureScheme?: ThresholdSignatureScheme;
  password?: string;
  onError?: (error: Error) => void;
}) => {
  const tronClient = await authenticatedTronClient();

  const wallet = await tronClient.createWalletAccount({
    thresholdSignatureScheme,
    password,
    onError,
    backUpToDynamic: true,
  });

  return {
    walletMetadata: wallet.walletMetadata,
    accountAddress: wallet.walletMetadata.accountAddress,
    rawPublicKey: wallet.rawPublicKey,
    externalServerKeyShares: wallet.externalServerKeyShares,
  };
};

// Usage example
const wallet = await createTronWallet({
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'your-secure-password',
  onError: (error: Error) => {
    console.error('TRON wallet creation error:', error);
  },
});

console.log('TRON wallet created:', wallet.accountAddress);
// Keep externalServerKeyShares out of logs — treat them like private key material.
```

## Step 3: Handle Errors Gracefully

Always implement proper error handling for TRON wallet creation:

```typescript theme={"system"}
try {
  const wallet = await createTronWallet({
    thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
    onError: (error: Error) => {
      console.error('Wallet creation error:', error);
    },
  });
  console.log('TRON wallet created successfully:', wallet.accountAddress);
} catch (error) {
  if (error.message.includes('invalid session')) {
    console.error('Invalid session ID - please re-authenticate');
  } else {
    console.error('TRON wallet creation failed:', error.message);
  }
}
```

## Step 4: Store Wallet Information Securely

After creating a TRON wallet, you'll receive important information that should be stored securely:

```typescript theme={"system"}
const wallet = await tronClient.createWalletAccount({
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'your-secure-password', // Required when backing up to Dynamic
  backUpToDynamic: true,
});

// Store these in your database
const walletData = {
  accountAddress: wallet.walletMetadata.accountAddress,
  walletId: wallet.walletMetadata.walletId,
  thresholdScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  chainName: 'TRON',
  createdAt: new Date().toISOString(),
};

// Persist walletMetadata for later operations — every signing call
// requires it.
const walletMetadata = wallet.walletMetadata;

// Store externalServerKeyShares in a secrets vault, not your
// application database — they are key material.
```

## Step 5: Derive the TRON Address

You can also derive the TRON address from the wallet's public key using `deriveAccountAddress()`. This is a synchronous method:

```typescript theme={"system"}
const { accountAddress, publicKeyHex } = tronClient.deriveAccountAddress({
  rawPublicKey: wallet.rawPublicKey,
});

console.log('Derived TRON address:', accountAddress); // e.g. T...
```

## Best Practices

1. **Password Security**: Use strong, unique passwords for each TRON wallet
2. **Error Handling**: Always handle potential errors during wallet creation with the `onError` callback
3. **Monitoring**: Log wallet creation events for audit purposes
4. **Backup Strategy**: Implement secure backup strategies for key shares with `backUpToDynamic: true`
5. **Persist `walletMetadata`**: The SDK is stateless — store the returned `walletMetadata` alongside your key shares, since every signing, export, and refresh operation requires it

## TRON-Specific Considerations

### Address Format

TRON addresses are Base58Check strings starting with `T`. All TRON networks (Mainnet, Shasta, Nile) share the same address format, so one wallet works on every network — the network is chosen by the full node you build and broadcast transactions against.

### Native Unit

TRON uses **SUN** as the smallest unit: `1 TRX = 1,000,000 SUN`.

## Next Steps

Now that you've created a TRON wallet, you can:

* [Sign TRON transactions](/docs/node/tron/sign-transactions)
* [Sign TRON messages](/docs/node/tron/sign-messages)
* [Import existing TRON private keys](/docs/node/tron/import-private-keys)
* [Use imported TRON wallets](/docs/node/tron/use-imported-wallets)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.