TRON

Unified API + TRON Integration Workflow

In the following guide, the integration process for the tron chain is covered. TRON integration aligns with the general Unified API process but with network-specific parameters.

Get an authentication token to start using the Unified API.

Request examples are provided using cURL.

To check the integration guides for other chains, refer to the Networks Supported section.

📘

Key TRON-specific details

  • chain — always set to tron for TRON-related requests.
  • network — environment in which the transaction is processed: mainnet ortestnet-nile.
  • stakerAddress — TRON account address initiating staking, voting or withdrawal transactions.
  • amount — amount of tokens in SUN (1 TRX = 10⁶ SUN). Note that only TRX (SUN) can be staked, since USDT (TRC-20) is not natively stakeable.

Staking flow

1. Create freezing request

Send a POST request to /api/v1/unified/staking/stake.

Example request (for testnet-nile network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/stake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "tron",
    "network": "testnet-nile",
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "amount": 1000000,
    "extra": {
				"isDelegation": false,
        "resource": "BANDWIDTH"
    }
}'
  • chain — blockchain network, always set to tron for TRON-related requests.
  • network — environment in which the transaction is processed: mainnet ortestnet-nile.
  • stakerAddress — TRON account address initiating the freeze transaction.
  • amount — amount of tokens to freeze in SUN (1 TRX = 10⁶ SUN). Note that only TRX (SUN) can be staked, since USDT (TRC-20) is not natively stakeable.
  • extra — additional parameters:
    • isDelegation— toggle between self-staking and resource delegation.
    • resource — type of resources to be used for processing the TRON transactionBANDWIDTH or ENERGY.

Example response:

{
    "amount": 1000000,
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "unsignedTransactionData": {
        "visible": false,
        "txID": "5fa8e694866ba0ecfcbf4d4932552ad7f9a198fccc30b5d0b4a1564a986cec8a",
        "raw_data_hex": "0a02ed712208bed86bc0563959f54088abb9edfa325a57083612530a34747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e63655632436f6e7472616374121b0a1541da53d324a354aa5924c7117caff3ead97910a5e110c0843d70a8d6b5edfa32",
        "raw_data": {
            "contract": [
                {
                    "parameter": {
                        "value": {
                            "owner_address": "41da53d324a354aa5924c7117caff3ead97910a5e1",
                            "frozen_balance": 1000000
                        },
                        "type_url": "type.googleapis.com/protocol.FreezeBalanceV2Contract"
                    },
                    "type": "FreezeBalanceV2Contract"
                }
            ],
            "ref_block_bytes": "ed71",
            "ref_block_hash": "bed86bc0563959f5",
            "expiration": 1750965573000,
            "timestamp": 1750965513000
        }
    },
    "extraData": {
        "resource": "BANDWIDTH",
        "voteAccount": "TNo9M6V8AcyMhfU7KzNRvXpT4i9zM1zF82",
        "unsignedTransactionSerialized": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD..."
    },
    "createdAt": "2025-06-26T19:18:33.983Z"
}
  • amount — amount of tokens to freeze in SUN (1 TRX = 10⁶ SUN). Note that only TRX (SUN) can be staked, since USDT (TRC-20) is not natively stakeable.
  • stakerAddress — TRON account address initiating the freeze transaction.
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the staking transaction.
    • visible — internal SDK parameter; always set to false.
    • txID — hash of the freeze transaction.
    • raw_data_hex — raw payload of the unsigned transaction in the hexadecimal format.
    • raw_data — full decoded transaction structure with all the fields and metadata:
      • contract — list of TRON contracts:
        • parameter.value.owner_address — TRON account address initiated the transaction in the hexadecimal format.
        • parameter.value.frozen_balance — amount of tokens to freeze in SUN (1 TRX = 10⁶ SUN).
        • parameter.type_url — TRON network operation type, e.g., type.googleapis.com/protocol.FreezeBalanceV2Contract.
        • type — TRON protocol contract type
      • ref_block_bytes, ref_block_hash — hash and references of the block in which the transaction has been included.
      • expiration — timestamp of the transaction expiration in ms since last epoch.
      • timestamp — timestamp of the transaction in ms since last epoch.
  • extraData — additional transaction details:
    • resource — type of resources to be used for processing the TRON transactionBANDWIDTH or ENERGY.
    • voteAccount — address of the Super Representative to vote for.
    • unsignedTransactionSerialized — unsigned serialized transaction in Base64 encrypted format ready for signing.
  • createdAt — timestamp of the transaction in the ISO 8601 format.

2. Sign and send transaction

Use unsignedTransactionData to sign the transaction using the TRON-specific signing logic.

To broadcast the signed transaction to the TRON network, send a POST request to /api/v1/unified/transaction/broadcast.

Example request (for testnet-nile network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/transaction/broadcast \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "tron",
    "network": "testnet-nile",
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "signedTransaction": "0x410284007427a7dee592c47c6875266357ee7afd763ddfdf6bd1634e410b7335fc38331e01f214ddb36378b5f5927b06028eccfe284d9cb736f8552e301cc09c2006998b098f84bf6386a201aa952fe298dd5f0c5fb6f03fc7b9f7efafd87b6ee321500b8e450340000600070010a5d4e8037427a7dee592c47c6875266357ee7afd763ddfdf6bd1634e410b7335fc38331e"
}'
  • chain — blockchain network, always set to tron.
  • network — environment in which the transaction is processed.
  • stakerAddress — TRON account address initiated the transaction.
  • signedTransaction — signed transaction in Base64 encrypted format, which contains all transaction details (e.g., accounts, instructions, and signatures) required to broadcast the transaction to the network.

Example response:

{
    "error": null,
    "result": {
        "status": "PENDING",
        "extraData": {
            "transactionHash": "71e64f4fca71012b4ee5a40c90eed269875e4a796011e42f46358da68f758a34",
            "createdAt": "2025-06-26T19:25:13.712Z",
            "network": "testnet-nile",
            "senderAddress": "41da53d324a354aa5924c7117caff3ead97910a5e1",
            "block": null,
            "gas": {
                "bandwidthUsed": 0,
                "energyUsed": 0
            }
        }
    }
}
  • status — transaction status: pending, success or failed.
  • extraData — additional transaction details:
    • transactionHash — hash of the transaction.
    • createdAt — timestamp of the transaction in the ISO 8601 format.
    • network — environment in which the transaction is processed.
    • senderAddress — TRON account address in the hexadecimal format.
    • block — block number in which the transaction has been included; null if the transaction has not been confirmed yet.
    • gas — gas usage details:
      • bandwidthUsed — number of bandwidth points consumed for processing the TRON transaction.
      • energyUsed — amount of energy in ms representing the time spent during an execution of a smart contract.

3. Create voting request

To vote for a Super Representative after freezing TRX tokens, send a POST request to /api/v1/unified/staking/stake.

Example request (for testnet-nile network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/stake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "tron",
    "network": "testnet-nile",
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "amount": 1000000,
    "extra": {
        "voteAddress": "TH7Fe1W8CcLeqN4LGfqX1R9EpsnrJBQJji",
        "voteCount": 1
    }
}'
  • chain — blockchain network.
  • network — environment in which the transaction is processed.
  • stakerAddress — TRON account address initiating the voting transaction.
  • amount — amount of frozen tokens to use for voting in SUN (1 TRX = 10⁶ SUN).
  • extra — additional request parameters:
    • voteAddress — address of the Super Representative to vote for.
    • voteCount — number of votes.

Example response:

{
    "amount": 1000000,
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "unsignedTransactionData": {
        "visible": false,
        "txID": "c07e64f57ebb6ae191404b1c693aa46f80789aceacbfd8cc17a7c85c0c8c5559",
        "raw_data_hex": "0a02ee182208eb04b8cce7cc51534090f5d7edfa325a6a080412660a30747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e566f74655769746e657373436f6e747261637412320a1541da53d324a354aa5924c7117caff3ead97910a5e112190a1541351b95e29c2514b7b8183cbc81a8e08c68e8833b100370b0a0d4edfa32",
        "raw_data": {
            "contract": [
                {
                    "parameter": {
                        "value": {
                            "owner_address": "41da53d324a354aa5924c7117caff3ead97910a5e1",
                            "votes": [
                                {
                                    "vote_address": "41351b95e29c2514b7b8183cbc81a8e08c68e8833b",
                                    "vote_count": 1
                                }
                            ]
                        },
                        "type_url": "type.googleapis.com/protocol.VoteWitnessContract"
                    },
                    "type": "VoteWitnessContract"
                }
            ],
            "ref_block_bytes": "ee18",
            "ref_block_hash": "eb04b8cce7cc5153",
            "expiration": 1750966074000,
            "timestamp": 1750966014000
        }
    },
    "extraData": {
        "voteAccount": "TNo9M6V8AcyMhfU7KzNRvXpT4i9zM1zF82",
        "voteCount": 1,
        "unsignedTransactionSerialized": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD..."
    },
    "createdAt": "2025-06-26T19:26:54.816Z"
}
  • amount — amount of frozen tokens used for voting in SUN (1 TRX = 10⁶ SUN).
  • stakerAddress — TRON account address initiated the unfreeze transaction.
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the staking transaction.
    • visible — internal SDK parameter; always set to false.
    • txID — hash of the voting transaction.
    • raw_data_hex — raw payload of the unsigned transaction in the hexadecimal format.
    • raw_data — full decoded transaction structure with all the fields and metadata:
      • contract — list of TRON contracts:
        • parameter.value.owner_address — TRON account address in the hexadecimal format.
        • parameter.value.votes.vote_address — address of the Super Representative to vote for.
        • parameter.value.votes.vote_count — number of votes.
        • parameter.type_url — TRON network operation type, e.g., type.googleapis.com/protocol.VoteWitnessContract.
        • type — TRON protocol contract type
      • ref_block_bytes, ref_block_hash — hash and references of the block in which the transaction has been included.
      • expiration — timestamp of the transaction expiration in ms since last epoch.
      • timestamp — timestamp of the transaction in ms since last epoch.
  • extraData — additional transaction details:
    • amount — amount of tokens to unfreeze in SUN (1 TRX = 10⁶ SUN).
    • resource— type of resources used for processing the freeze transaction:BANDWIDTH or ENERGY.
    • voteAccount— address of the Super Representative to vote for.
    • unsignedTransactionSerialized— unsigned serialized transaction in Base64 encrypted format ready for signing.
  • createdAt — timestamp of the transaction in the ISO 8601 format.

4. Sign and send transaction

Use unsignedTransactionData to sign and send the transaction following the TRON-specific signing logic.

Unstaking flow

1. Create unfreezing request

Send a POST request to /api/v1/unified/staking/unstake.

Example request (for testnet-nile network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/unstake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "tron",
    "network": "testnet-nile",
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "extra": {
        "amount": 1000000,
        "resource": "BANDWIDTH"
    }
}'
  • chain — blockchain network.
  • network — environment in which the transaction is processed.
  • stakerAddress — TRON account address initiating the unfreeze transaction.
  • extra — additional parameters:
    • amount — amount of tokens to unfreeze in SUN (1 TRX = 10⁶ SUN).
    • resource — type of resources used for processing the freeze transaction:BANDWIDTH or ENERGY.

Example response:

{
  "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
  "unsignedTransactionData": {
    "visible": false,
    "txID": "88ae21d037e6f6696dbf9643d9941a38a32997972b25c34177d853e070868f70",
    "raw_data_hex": "0a02ed712208bed86bc0563959f54088abb9edfa325a57083612530a34747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e63655632436f6e7472616374121b0a1541da53d324a354aa5924c7117caff3ead97910a5e110c0843d70a8d6b5edfa32",
    "raw_data": {
      "contract": [
        {
          "parameter": {
            "value": {
              "owner_address": "41da53d324a354aa5924c7117caff3ead97910a5e1",
              "unfreeze_balance": 1000000,
              "resource": "BANDWIDTH"
            },
            "type_url": "type.googleapis.com/protocol.UnfreezeBalanceV2Contract"
          },
          "type": "UnfreezeBalanceV2Contract"
        }
      ],
      "ref_block_bytes": "ed71",
      "ref_block_hash": "bed86bc0563959f5",
      "expiration": 1750965513000,
      "timestamp": 1750965573000
    }
  },
  "extraData": {
    "amount": 1000000,
    "resource": "BANDWIDTH",
    "voteAccount": "TNo9M6V8AcyMhfU7KzNRvXpT4i9zM1zF82",
    "unsignedTransactionSerialized": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD..."
  },
  "createdAt": "2025-06-26T19:26:54.816Z"
}
  • stakerAddress — TRON account address initiated the unfreeze transaction.
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the staking transaction.
    • visible — internal SDK parameter; always set to false.
    • txID — hash of the unfreeze transaction.
    • raw_data_hex — raw payload of the unsigned transaction in the hexadecimal format.
    • raw_data — full decoded transaction structure with all the fields and metadata:
      • contract — list of TRON contracts:
        • parameter.type_url — TRON network operation type, e.g., type.googleapis.com/protocol.FreezeBalanceV2Contract.
        • parameter.value.owner_address — TRON account address in the hexadecimal format.
        • parameter.value.frozen_balance — amount of tokens to unfreeze in SUN (1 TRX = 10⁶ SUN).
      • ref_block_bytes, ref_block_hash — hash and references of the block in which the transaction has been included.
      • expiration — timestamp of the transaction expiration in ms since last epoch.
      • timestamp — timestamp of the transaction in ms since last epoch.
  • extraData — additional transaction details:
    • amount — amount of tokens to unfreeze in SUN (1 TRX = 10⁶ SUN).
    • resource— type of resources used for processing the freeze transaction:BANDWIDTH or ENERGY.
    • voteAccount— address of the Super Representative to vote for.
    • unsignedTransactionSerialized— unsigned serialized transaction in Base64 encrypted format ready for signing.
  • createdAt — timestamp of the transaction in the ISO 8601 format.

2. Sign and send transaction

Use unsignedTransactionData to sign and send the transaction following the TRON-specific signing logic.

3. Create withdrawal request

To initiate the token withdrawal, send a POST request to /api/v1/unified/staking/withdraw.

Example request:

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/withdraw \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "tron",
    "network": "testnet-nile",
    "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
}'
  • chain — blockchain network.
  • network — environment in which the transaction is processed.
  • stakerAddress — TRON account address initiating the unfreeze transaction.

Example response:

{
  "stakerAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
  "unsignedTransactionData": {
    "visible": false,
    "txID": "c1516c840a85c0d0f027a2842970b1fa72f604e9d48977eded8b4a59e9596bd3",
    "raw_data_hex": "0a025e9c2208c8eb8a95e3fd058640bfb1aebfcd335a5a083812560a3b747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e566f746864726177457870697265556e667265657a65436f6e747261637412170a15414b167d9a29108763f3794cdb295a8c0b60b21b9370df899cbfcd33",
    "raw_data": {
      "contract": [
        {
          "parameter": {
            "value": {
              "owner_address": "41da53d324a354aa5924c7117caff3ead97910a5e1"
            },
            "type_url": "type.googleapis.com/protocol.WithdrawExpireUnfreezeContract"
          },
          "type": "WithdrawExpireUnfreezeContract"
        }
      ],
      "ref_block_bytes": "5e9c",
      "ref_block_hash": "c8eb8a95e3fd0586",
      "expiration": 1773149067455,
      "timestamp": 1773148767455
    }
  },
  "extraData": {
    "unsignedTransactionSerialized": "eyJ2a..."
  },
  "createdAt": "2026-03-10T13:19:27.087Z"
}
  • stakerAddress — TRON account address initiated the unfreeze transaction.
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the staking transaction.
    • visible — internal SDK parameter; always set to false.
    • txID — hash of the unfreeze transaction.
    • raw_data_hex — raw payload of the unsigned transaction in the hexadecimal format.
    • raw_data — full decoded transaction structure with all the fields and metadata:
      • contract — list of TRON contracts:
        • parameter.type_url — TRON network operation type, e.g., type.googleapis.com/protocol.WithdrawExpireUnfreezeContract.
        • parameter.value.owner_address — TRON account address in the hexadecimal format.
        • type — TRON protocol contract type
    • ref_block_bytes, ref_block_hash — hash and references of the block in which the transaction has been included.
    • expiration — timestamp of the transaction expiration in ms since last epoch.
    • timestamp — timestamp of the transaction in ms since last epoch.
  • extraData — additional transaction details:
    • unsignedTransactionSerialized — unsigned serialized transaction in Base64 encrypted format ready for signing.
  • createdAt — timestamp of the transaction in the ISO 8601 format.

4. Sign and send transaction

Use unsignedTransactionData to sign and send the transaction following the TRON-specific signing logic.

What's next?