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

# Send a Tron transaction

> Sign and broadcast a Tron transaction in one call using Privy

Sign and broadcast a Tron transaction with Privy. Privy automatically fetches fresh block reference fields (`ref_block_bytes`, `ref_block_hash`, `expiration`) if you omit them.

<Info>
  To sign without broadcasting — for example when using a gas-sponsoring RPC like
  [Transatron](/recipes/tron/transatron) — use
  [`tron_signTransaction`](/api-reference/wallets/tron/tron-sign-transaction) instead.
</Info>

<View title="REST API" icon="terminal">
  To send a transaction, make a `POST` request to

  ```bash theme={"system"} theme={"system"}
  https://api.privy.io/v1/wallets/<wallet_id>/rpc
  ```

  All addresses in `raw_data.contract` must be **41-prefixed hex** — use `TronWeb.address.toHex()` to convert from base58check.

  ### TRX transfer

  ```bash theme={"system"} theme={"system"}
  $ curl --request POST https://api.privy.io/v1/wallets/<wallet_id>/rpc \
  -u "<your-privy-app-id>:<your-privy-app-secret>" \
  -H "privy-app-id: <your-privy-app-id>" \
  -H "privy-authorization-signature: <authorization-signature>" \
  -H 'Content-Type: application/json' \
  -d '{
    "method": "tron_sendTransaction",
    "caip2": "tron:mainnet",
    "params": {
      "raw_data": {
        "contract": [
          {
            "type": "TransferContract",
            "owner_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c",
            "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
            "amount": 1000000
          }
        ]
      }
    }
  }'
  ```

  ### TRC-20 transfer

  ```bash theme={"system"} theme={"system"}
  $ curl --request POST https://api.privy.io/v1/wallets/<wallet_id>/rpc \
  -u "<your-privy-app-id>:<your-privy-app-secret>" \
  -H "privy-app-id: <your-privy-app-id>" \
  -H "privy-authorization-signature: <authorization-signature>" \
  -H 'Content-Type: application/json' \
  -d '{
    "method": "tron_sendTransaction",
    "caip2": "tron:mainnet",
    "params": {
      "raw_data": {
        "contract": [
          {
            "type": "TriggerSmartContract",
            "owner_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c",
            "contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c",
            "data": "a9059cbb000000000000000041e552f6487585c2b58bc2c9bb4492bc1f17132cd000000000000000000000000000000000000000000000000000000000000f4240",
            "call_value": 0
          }
        ],
        "fee_limit": 100000000
      }
    }
  }'
  ```

  A successful response looks like:

  ```json theme={"system"} theme={"system"}
  {
    "method": "tron_sendTransaction",
    "data": {
      "hash": "8a3f2b1c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1",
      "caip2": "tron:mainnet",
      "transaction_id": "8a3f2b1c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1"
    }
  }
  ```

  ### Parameters

  <ParamField body="method" type="string" required>
    Must be `"tron_sendTransaction"`.
  </ParamField>

  <ParamField body="caip2" type="string">
    Tron CAIP-2 chain. Defaults to `tron:mainnet`. Use `tron:nile` for the Nile testnet.
  </ParamField>

  <ParamField body="params.raw_data.contract" type="array" required>
    Array of exactly one contract — either `TransferContract` (native TRX) or `TriggerSmartContract`
    (TRC-20 / smart contract call). All addresses must be 41-prefixed hex.
  </ParamField>

  <ParamField body="params.raw_data.fee_limit" type="number">
    Maximum energy fee in sun. Required for `TriggerSmartContract`. `100_000_000` (100 TRX) is a safe
    default for standard TRC-20 transfers.
  </ParamField>

  <ParamField body="params.raw_data.ref_block_bytes" type="string">
    4 hex-character block reference. Optional — Privy fetches fresh values if omitted.
  </ParamField>

  <ParamField body="params.raw_data.ref_block_hash" type="string">
    16 hex-character block reference hash. Optional — Privy fetches fresh values if omitted.
  </ParamField>

  <ParamField body="params.raw_data.expiration" type="number">
    Expiration timestamp in Unix milliseconds. Optional — Privy sets `now + 60s` if omitted.
  </ParamField>

  <ParamField body="params.reference_id" type="string">
    Optional idempotency key (max 64 characters). Re-submitting the same `reference_id` returns the
    cached response.
  </ParamField>

  ### Returns

  <ResponseField name="data.hash" type="string">
    Tron transaction ID — SHA-256 of the raw transaction bytes, lowercase hex, no `0x` prefix.
  </ResponseField>

  <ResponseField name="data.caip2" type="string">
    The CAIP-2 chain the transaction was broadcast on.
  </ResponseField>

  <ResponseField name="data.transaction_id" type="string">
    Privy internal transaction ID.
  </ResponseField>

  Check out the [API reference](/api-reference/wallets/tron/tron-send-transaction) for more details.
</View>

<View title="NodeJS" icon="node-js">
  Use the typed `wallets().tron().sendTransaction()` method to sign and broadcast a transaction in one call.

  ### TRX transfer

  ```typescript theme={"system"} theme={"system"}
  import {PrivyClient} from '@privy-io/node';
  import {TronWeb} from 'tronweb';

  const privy = new PrivyClient({
    appId: process.env.PRIVY_APP_ID,
    appSecret: process.env.PRIVY_APP_SECRET
  });

  const {hash, transaction_id} = await privy
    .wallets()
    .tron()
    .sendTransaction('insert-wallet-id', {
      caip2: 'tron:mainnet',
      params: {
        raw_data: {
          contract: [
            {
              type: 'TransferContract',
              owner_address: TronWeb.address.toHex('insert-wallet-address'),
              to_address: TronWeb.address.toHex('insert-recipient-address'),
              amount: 1_000_000 // 1 TRX in sun
            }
          ]
        }
      }
    });

  console.log('txID:', hash); // lowercase hex, no 0x prefix
  ```

  ### TRC-20 transfer

  ```typescript theme={"system"} theme={"system"}
  import {PrivyClient} from '@privy-io/node';
  import {TronWeb, utils} from 'tronweb';

  const privy = new PrivyClient({
    appId: process.env.PRIVY_APP_ID,
    appSecret: process.env.PRIVY_APP_SECRET
  });

  const USDT_CONTRACT = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'; // USDT on Tron mainnet

  // ABI-encode transfer(address,uint256) calldata
  const recipientHex = TronWeb.address.toHex('insert-recipient-address').replace(/^41/, '0x');
  const calldata = utils.abi.encodeParamsV2ByABI(
    {
      name: 'transfer',
      type: 'function',
      inputs: [
        {name: 'to', type: 'address'},
        {name: 'value', type: 'uint256'}
      ],
      outputs: [{name: '', type: 'bool'}],
      stateMutability: 'nonpayable'
    },
    [recipientHex, BigInt(1_000_000)]
  );
  const data = 'a9059cbb' + calldata.slice(2); // transfer(address,uint256) selector

  const {hash} = await privy
    .wallets()
    .tron()
    .sendTransaction('insert-wallet-id', {
      caip2: 'tron:mainnet',
      params: {
        raw_data: {
          contract: [
            {
              type: 'TriggerSmartContract' as const,
              owner_address: TronWeb.address.toHex('insert-wallet-address'),
              contract_address: TronWeb.address.toHex(USDT_CONTRACT),
              data,
              call_value: 0
            }
          ],
          fee_limit: 100_000_000 // 100 TRX — safe default for TRC-20 transfers
        }
      }
    });

  console.log('txID:', hash);
  ```

  ### Parameters and Returns

  Check out the [API reference](/api-reference/wallets/tron/tron-send-transaction) for more details.
</View>

<View title="Go" icon="golang">
  Use the typed `Wallets.Tron.SendTransaction` method to sign and broadcast a transaction in one call. The `caip2` argument identifies the target network.

  ```go theme={"system"} theme={"system"}
  data, err := client.Wallets.Tron.SendTransaction(context.Background(), walletID, "tron:mainnet",
      privy.TronSendTransactionRpcInputParams{
          RawData: privy.TronRawDataForSend{
              Contract: []privy.TronContractUnion{
                  {
                      OfTransferContract: &privy.TronTransferContract{
                          Type:         privy.TronTransferContractTypeTransferContract,
                          OwnerAddress: ownerAddressHex,     // 41-prefixed hex
                          ToAddress:    recipientAddressHex, // 41-prefixed hex
                          Amount:       1_000_000,           // 1 TRX in sun
                      },
                  },
              },
          },
      },
  )
  if err != nil {
      log.Fatalf("failed to send transaction: %v", err)
  }

  fmt.Println("txID:", data.Hash) // lowercase hex, no 0x prefix
  ```

  ### Parameters and Returns

  See the [API reference](/api-reference/wallets/tron/tron-send-transaction) for more details.
</View>

<View title="Ruby" icon="gem">
  Use the typed `wallets.tron.send_transaction` method to sign and broadcast a transaction in one call. The `caip2` argument identifies the target network.

  ```ruby theme={"system"} theme={"system"}
  response = client.wallets.tron.send_transaction(
    wallet_id,
    params: {
      raw_data: {
        contract: [
          {
            type: "TransferContract",
            owner_address: owner_hex_address,   # 41-prefixed hex
            to_address: recipient_hex_address,  # 41-prefixed hex
            amount: 1_000_000                   # 1 TRX in sun
          }
        ]
      }
    },
    caip2: "tron:mainnet"
  )

  puts("txID:", response.hash) # lowercase hex, no 0x prefix
  ```

  ### Parameters and Returns

  See the [API reference](/api-reference/wallets/tron/tron-send-transaction) for more details.
</View>

<View title="Python" icon="python">
  Use the `send_transaction` method on the Tron wallet service.

  ```python theme={"system"}
  response = client.wallets.tron.send_transaction(
      wallet_id,
      params={"raw_data": raw_data},
  )

  transaction_hash = response.hash
  ```
</View>

<Warning>
  The wallet RPC endpoint is a synchronous endpoint, and a successful response indicates that the
  transaction has been broadcasted to the network. Transactions may get broadcasted but still fail
  to be confirmed by the network. The endpoint does not wait for confirmation or retry if the
  transaction fails to be confirmed. To handle these scenarios, see our guide on [speeding up
  transactions](/recipes/speeding-up-transactions).
</Warning>
