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

# Sign TRON Messages

> Learn how to sign messages using Dynamic's Node SDK for TRON

## Overview

This guide shows you how to sign messages with your TRON wallet. Message signing follows the TIP-191 standard (the `signMessageV2` surface used by TronLink) and returns the signature as a `0x`-prefixed hex string. It is commonly used for authentication, nonce verification, and data integrity checks.

## Prerequisites

* [Created a TRON wallet](/docs/node/tron/create-wallet)

## Basic Message Signing

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

const tronClient = await authenticatedTronClient();

const signature = await tronClient.signMessage({
  message: 'Hello, TRON!',
  walletMetadata,
});

console.log('Message signed (hex):', signature);
```

`signMessageV2()` is an alias for `signMessage()` — TIP-191 is the only message-sign path for TRON, so both names produce the same signature.

## Simple Message Signing

Whether you need to provide `externalServerKeyShares` depends on how you created your wallet:

### With Automatic Backup (Recommended)

If you created your wallet with `backUpToDynamic: true`, you don't need to provide external key shares, but you must pass the password used at creation so the SDK can decrypt the backed-up shares:

```typescript theme={"system"}
// ✅ Simple signing - no externalServerKeyShares needed
const signature = await tronClient.signMessage({
  message: 'Hello, TRON!',
  walletMetadata,
  password: 'your-secure-password',
});

console.log('Message signed (hex):', signature);
```

### With Manual Backup

If you created your wallet with `backUpToDynamic: false`, you must provide external key shares:

```typescript theme={"system"}
// First, retrieve your stored key shares
const keyShares = await retrieveStoredKeyShares('YourTronWalletAddress');

// ❌ Must provide externalServerKeyShares
const signature = await tronClient.signMessage({
  message: 'Hello, TRON!',
  walletMetadata,
  externalServerKeyShares: keyShares, // Required for manual backup!
  password: 'your-password', // Only if wallet was created with password
});

console.log('Message signed (hex):', signature);
```

**Password Handling Notes:**

* If your wallet was created **without a password**, omit the `password` parameter
* If your wallet was created **with a password**, you must provide it for all operations
* The password parameter is always optional in the API, but required if the wallet is password-protected

## Inspecting the Signed Digest

`prepareSignMessage()` returns the `0x`-prefixed TIP-191 digest that `signMessage()` sends to the signer. Use it when you need to show the exact payload being signed:

```typescript theme={"system"}
const digest = tronClient.prepareSignMessage({
  message: 'Hello, TRON!',
});

console.log('TIP-191 digest:', digest);
```

## Common Use Cases

### Authentication

```typescript theme={"system"}
const nonce = Date.now().toString();
const message = `Sign this message to authenticate: ${nonce}`;
const signature = await tronClient.signMessage({
  message,
  walletMetadata,
});
// signature is a 0x-prefixed r || s || v hex string
```

### Data Integrity

```typescript theme={"system"}
const data = { userId: 123, action: 'transfer', amount: '100' };
const message = JSON.stringify(data);
const signature = await tronClient.signMessage({
  message,
  walletMetadata,
});
```

## Next Steps

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


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