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

# Use Imported TRON Wallets

> Learn how to work with imported TRON wallets for common operations like checking balances and signing transactions

## Overview

This guide shows you how to work with imported TRON wallets for common operations. Once you've imported a private key, you can perform various wallet operations directly.

## Prerequisites

* [Imported a TRON private key](/docs/node/tron/import-private-keys)
* [Set up your authenticated client](/docs/node/quickstart)
* Access to a TRON full node (for example, [TronGrid](https://www.trongrid.io/))

## Step 1: Check Wallet Balance

Check the TRX balance of your imported wallet using the TronGrid API:

```typescript theme={"system"}
const address = 'YourImportedTronWalletAddress';

const response = await fetch(
  `https://api.trongrid.io/v1/accounts/${address}`
);
const data = await response.json();

const balanceSun = data.data?.[0]?.balance ?? 0;
const balanceTrx = balanceSun / 1_000_000;

console.log('Balance:', balanceSun, 'SUN');
console.log('Balance in TRX:', balanceTrx);
```

## Step 2: Sign Transactions with Imported Wallet

Use your imported wallet to sign TRON transactions. Build the unsigned transaction against a full node, then pass it to `signTransaction()`:

```typescript theme={"system"}
import { authenticatedTronClient } from './client';

const tronClient = await authenticatedTronClient();

// Build the unsigned transaction against a full node
const unsignedResponse = await fetch(
  'https://api.trongrid.io/wallet/createtransaction',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      owner_address: walletMetadata.accountAddress,
      to_address: 'RECIPIENT_TRON_ADDRESS',
      amount: 1_000_000, // 1 TRX in SUN
      visible: true,
    }),
  }
);
const unsignedTransaction = await unsignedResponse.json();

// Sign with imported wallet — returns broadcast-ready JSON
const signedTransaction = await tronClient.signTransaction({
  walletMetadata,
  transaction: unsignedTransaction,
});

console.log('Signed transaction:', signedTransaction);
```

## Step 3: Sign Messages with Imported Wallet

Sign messages for authentication or data integrity:

```typescript theme={"system"}
const message = 'Hello from my imported TRON wallet!';
const signature = await tronClient.signMessage({
  message,
  walletMetadata,
});

// Returns a 0x-prefixed TIP-191 signature
console.log('Message signed (hex):', signature);
```

## Step 4: Check TRC-20 Token Balances

Check TRC-20 token balances in your imported wallet by triggering a `balanceOf` call on the token contract:

```typescript theme={"system"}
const response = await fetch(
  'https://api.trongrid.io/wallet/triggerconstantcontract',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      owner_address: walletMetadata.accountAddress,
      contract_address: 'TRC20_CONTRACT_ADDRESS',
      function_selector: 'balanceOf(address)',
      parameter: '', // ABI-encoded address parameter
      visible: true,
    }),
  }
);
const data = await response.json();
console.log('TRC-20 balance result:', data);
```

## Complete Example: Sign and Send from Imported Wallet

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

export const signAndSendFromImportedWallet = async ({
  walletMetadata,
  toAddress,
  amountSun,
}: {
  walletMetadata: WalletMetadata;
  toAddress: string;
  amountSun: number;
}) => {
  const tronClient = await authenticatedTronClient();

  // Build the unsigned transaction against a full node
  const unsignedResponse = await fetch(
    'https://api.trongrid.io/wallet/createtransaction',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        owner_address: walletMetadata.accountAddress,
        to_address: toAddress,
        amount: amountSun,
        visible: true,
      }),
    }
  );
  const unsignedTransaction = await unsignedResponse.json();

  // Sign — returns broadcast-ready JSON
  const signedTransaction = await tronClient.signTransaction({
    walletMetadata,
    transaction: unsignedTransaction,
  });

  // Broadcast
  const broadcastResponse = await fetch(
    'https://api.trongrid.io/wallet/broadcasttransaction',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: signedTransaction,
    }
  );

  const result = await broadcastResponse.json();
  console.log('Broadcast result:', result);
  return result;
};
```

## Best Practices

1. **Balance Checking**: Verify sufficient balance (including bandwidth/energy) before sending transactions
2. **Error Handling**: Implement proper error handling for all wallet operations
3. **Security**: Never expose sensitive information in server-side code
4. **Network Selection**: Pick the full node matching your target network — Mainnet, Shasta, and Nile all use the same address format

## Next Steps

* [Sign TRON transactions](/docs/node/tron/sign-transactions)
* [Sign TRON messages](/docs/node/tron/sign-messages)


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