Getting Started

Staking in the TRON network using the Staking API consists of the following main steps:

  1. Delegate (freeze) TRX to gain voting power.
  2. Sign and broadcast the freeze transaction.
  3. Vote for the Super Representative (SR).
  4. Sign and broadcast the vote transaction.
  5. Optionally, check transaction status.

Amounts must be specified in SUN (1 TRX = 1,000,000 SUN).

Get an authentication token to start using Staking API.

Request examples are provided using cURL.

1. Delegate (Freeze) TRX

Send a POST request to /api/v1/tron/[network]/staking/freeze.

Example request (for testnet-nile network):

curl --request POST \
  --url 'https://api-test.p2p.org/api/v1/tron/testnet-nile/staking/delegate' \
  --header 'accept: application/json' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "delegatorAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "amount": 1000000,
    "resource": "BANDWIDTH"
}'
  • delegatorAddress — your TRON wallet address.
  • amount — amount of TRX to stake, in SUN.
  • resource — resource type to freeze: BANDWIDTH or ENERGY.

Example response:

{
  "error": null,
  "result": {
    "amount": 1000000,
    "delegatorAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "resource": "BANDWIDTH",
    "unsignedTransactionPayload": {
      "amount": 1000000,
      "delegatorAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
      "resource": "BANDWIDTH",
      "voteAccount": "TH7Fe1W8CcLeqN4LGfqX1R9EpsnrJBQJji",
      "createdAt": "2025-06-03T12:25:41.550Z",
      "unsignedTransaction": {
        "visible": false,
        "txID": "98c15dc006cbe2f978ea2f25940703bbafecd89161f92f54eaeb82691faf34ec",
        "raw_data_hex": "0a02ba6b2208475fc5c8083be91340989888aef3325a55083612510a34747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e63655632436f6e747261637412190a1541700ca9ad5f162f9de000558ff04eef8f99dce7e8100170b8c384aef332",
        "raw_data": {
          "contract": [
            {
              "parameter": {
                "value": {
                  "owner_address": "41700ca9ad5f162f9de000558ff04eef8f99dce7e8",
                  "frozen_balance": 1000000
                },
                "type_url": "type.googleapis.com/protocol.FreezeBalanceV2Contract"
              },
              "type": "FreezeBalanceV2Contract"
            }
          ],
          "ref_block_bytes": "ba6b",
          "ref_block_hash": "475fc5c8083be913",
          "expiration": 1748953599000,
          "timestamp": 1748953539000
        }
      }
    },
    "createdAt": "2025-06-03T12:25:40.347Z"
  }
}
  • amount — amount of TRX to freeze, in SUN.
  • delegatorAddress — address from which TRX is frozen.
  • resource — resource type (BANDWIDTH or ENERGY).
  • unsignedTransactionPayload
    • amount — amount to freeze, in SUN.
    • delegatorAddress — your TRON address.
    • resource — requested resource type.
    • voteAccount — Super Representative address for voting.
    • createdAt — time the transaction was prepared (ISO 8601).
    • unsignedTransaction
      • visible — whether address fields are visible/encoded.
      • txID — unique transaction ID (hex).
      • raw_data_hex — hex-encoded raw transaction data.
      • raw_data
        • contract
          • parameter
            • value.owner_address — address freezing TRX (hex).
            • value.frozen_balance — amount to freeze, in SUN.
            • type_url — protocol contract type.
          • type — contract type (FreezeBalanceV2Contract).
        • ref_block_bytes — reference block bytes (hex).
        • ref_block_hash — reference block hash (hex).
        • expiration — transaction expiration timestamp (ms).
        • timestamp — transaction creation timestamp (ms).
    • createdAt — time the operation was created (ISO 8601).

2. Sign and Send Transaction

Use unsignedTransactionPayload to sign and send the signed transaction to the TRON network.

3. Vote for Super Representative

Vote for the P2P Super Representative using your frozen TRX.

Send a POST request to /api/v1/tron/[network]/staking/vote

Example request (for testnet-nile network):

curl --request POST \
  --url 'https://api-test.p2p.org/api/v1/tron/testnet-nile/staking/delegate' \
  --header 'accept: application/json' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "delegatorAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "voteCount": 3
}'
  • delegatorAddress — your TRON wallet address.
  • voteCount — number of votes (equal to frozen TRX amount).

Example response:

{
  "error": null,
  "result": {
    "voteAccount": "TH7Fe1W8CcLeqN4LGfqX1R9EpsnrJBQJji",
    "delegatorAddress": "TVscj8F6wPZ92d1smGYjH9heZR1MaEcE9u",
    "voteCount": 3,
    "unsignedTransaction": {
      "visible": false,
      "txID": "a9283ebb983e932d40bc1fad0a34457acd9922875a27705d76afb2fc62ceb668",
      "raw_data_hex": "0a020e0c22087db974037137d39c4090bde5ccf3325a6a080412660a30747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e566f74655769746e657373436f6e747261637412320a1541da53d324a354aa5924c7117caff3ead97910a5e112190a1541351b95e29c2514b7b8183cbc81a8e08c68e8833b100370b0e8e1ccf332",
      "raw_data": {
        "contract": [
          {
            "parameter": {
              "value": {
                "owner_address": "41da53d324a354aa5924c7117caff3ead97910a5e1",
                "votes": [
                  {
                    "vote_address": "41351b95e29c2514b7b8183cbc81a8e08c68e8833b",
                    "vote_count": 3
                  }
                ]
              },
              "type_url": "type.googleapis.com/protocol.VoteWitnessContract"
            },
            "type": "VoteWitnessContract"
          }
        ],
        "ref_block_bytes": "0e0c",
        "ref_block_hash": "7db974037137d39c",
        "expiration": 1749018042000,
        "timestamp": 1749017982000
      }
    },
    "unsignedTransactionSerialized": "<base64_or_hex>",
    "createdAt": "2025-06-04T06:19:42.228Z"
  }
}
  • voteAccount — address of the Super Representative being voted for.
  • delegatorAddress — voter address.
  • voteCount — number of votes (equal to frozen TRX).
  • unsignedTransaction
    • visible — whether address fields are visible/encoded.
    • txID — transaction ID.
    • raw_data_hex — hex-encoded raw transaction data.
    • raw_data
      • contract
        • parameter
          • value.owner_address — address performing the vote (hex).
          • value.votes[]
            • vote_address — SR address being voted for.
            • vote_count — number of votes for that SR.
          • type_url — protocol contract type.
        • type — contract type (VoteWitnessContract).
      • ref_block_bytes — reference block bytes (hex).
      • ref_block_hash — reference block hash (hex).
      • expiration — transaction expiration timestamp (ms).
      • timestamp — transaction creation timestamp (ms).
  • unsignedTransactionSerialized — serialized unsigned transaction for signing (base64 or hex).
  • createdAt — time transaction was prepared (ISO 8601).

4. Sign and Send Transaction

Use unsignedTransactionPayload to sign and send the signed transaction to the TRON network.

5. Check Transaction Status

You can check the status of any transaction by its hash.

Send a GET request to /api/v1/tron/[network]/transaction/[transactionHash]/status

Example request (for testnet-nile network):

curl --request GET \
  --url 'https://api-test.p2p.org/api/v1/tron/testnet-nile/transaction/852180cff2cc870d0ff904cbf231d194e6a9d4276f309b016831bd0b1b2212d5/status' \
  --header 'accept: application/json' \
  --header 'Authorization: Bearer <token>'

Example response:

{
  "error": null,
  "result": {
    "transactionHash": "852180cff2cc870d0ff904cbf231d194e6a9d4276f309b016831bd0b1b2212d5",
    "status": "PENDING",
    "confirmed": false,
    "block": null,
    "energyUsed": 0,
    "createdAt": "2025-06-05T12:09:11.892Z"
  }
}
  • transactionHash — transaction hash (hex string).
  • status — transaction status: PENDING, CONFIRMED.
  • confirmed — boolean, whether the transaction is confirmed.
  • block — block number if confirmed, otherwise null.
  • energyUsed — energy consumed by the transaction.
  • createdAt — time the status was checked (ISO 8601).

What's Next?