Skip to content

Estimate Energy Amount ​

This endpoint estimates the energy amount needed to make a token transfer without creating a transaction.

POST /v1/estimate-energy

Request ​

Request Parameters ​

FieldTypeRequiredDescription
from_addressstringYesSender's TRON wallet address (34 characters)
to_addressstringYesRecipient's TRON wallet address (34 characters)
contract_addressstringNoSmart contract address (default: TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t - Tether (USDT))
bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{
  "from_address": "TRX_FROM_ADDRESS",
  "to_address": "TRX_TO_ADDRESS",
  "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
}'

# Calculate signature
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)

# Make API request
curl -X POST "https://api.trxup.com/v1/estimate-energy" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -H "X-Signature: ${SIGNATURE}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}"
javascript
const crypto = require('crypto');
const axios = require('axios');

const apiToken = 'your_api_token';
const apiSecret = 'your_api_secret';
const requestBody = JSON.stringify({
  from_address: 'TRX_FROM_ADDRESS',
  to_address: 'TRX_TO_ADDRESS',
  contract_address: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
});

// Calculate signature
const signature = crypto
  .createHash('sha256')
  .update(requestBody + apiSecret)
  .digest('hex');

// Make API request
axios({
  method: 'post',
  url: 'https://api.trxup.com/v1/estimate-energy',
  headers: {
    'Authorization': `Bearer ${apiToken}`,
    'X-Signature': signature,
    'Content-Type': 'application/json'
  },
  data: requestBody
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
php
<?php
$apiToken = 'your_api_token';
$apiSecret = 'your_api_secret';
$requestBody = json_encode([
  'from_address' => 'TRX_FROM_ADDRESS',
  'to_address' => 'TRX_TO_ADDRESS',
  'contract_address' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
]);

// Calculate signature
$signature = hash('sha256', $requestBody . $apiSecret);

// Make API request
$ch = curl_init('https://api.trxup.com/v1/estimate-energy');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Bearer ' . $apiToken,
  'X-Signature: ' . $signature,
  'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
python
import hashlib
import json
import requests

api_token = 'your_api_token'
api_secret = 'your_api_secret'
request_body = json.dumps({
  'from_address': 'TRX_FROM_ADDRESS',
  'to_address': 'TRX_TO_ADDRESS',
  'contract_address': 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
})

# Calculate signature
signature = hashlib.sha256((request_body + api_secret).encode()).hexdigest()

# Make API request
headers = {
  'Authorization': f'Bearer {api_token}',
  'X-Signature': signature,
  'Content-Type': 'application/json'
}

response = requests.post(
  'https://api.trxup.com/v1/estimate-energy',
  headers=headers,
  data=request_body
)

print(response.json())

Response ​

The response provides detailed calculation information for the energy needed to make a token transfer.

Response Fields ​

FieldTypeDescription
codeintegerResponse code (0 = success)
request_idstringUnique request identifier
resultobjectResponse data
result.amountintegerThe energy purchase that covers the transfer, and the amount to pass to Create Transaction: the estimate itself when a service sells exactly that, otherwise the smallest amount on sale above it
result.energyintegerEnergy amount needed to make transfer using the contract (deprecated, use amount)
result.neededintegerWhat the transfer itself burns, as the node reports it. Returned only when it is less than amount — that is, when the transfer falls below the smallest amount on sale
result.durationintegerDuration in hours (currently only 1 hour is available)
result.pricefloatPrice to delegate energy
result.activation_feefloatPrice for address activation (if required)
result.totalfloatFinal price including activation if required
result.from_addressstringThe sender's TRON address provided in the request
result.to_addressstringThe recipient's TRON address provided in the request
result.contract_addressstringThe smart contract address used for the calculation

Example Response ​

json
{
    "code": 0,
    "request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
    "result": {
        "amount": 64400,
        "energy": 64400,
        "duration": 1,
        "price": 3.66,
        "activation_fee": 0,
        "total": 3.66,
        "from_address": "TRX_FROM_ADDRESS",
        "to_address": "TRX_TO_ADDRESS",
        "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    }
}

Example Response (Address not activated) ​

json
{
    "code": 0,
    "request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
    "result": {
        "amount": 64400,
        "energy": 64400,
        "duration": 1,
        "price": 3.66,
        "activation_fee": 1.4,
        "total": 5.06,
        "from_address": "TRX_FROM_ADDRESS",
        "to_address": "TRX_TO_ADDRESS",
        "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    }
}

Example Response (transfer below the smallest amount on sale) ​

json
{
    "code": 0,
    "request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
    "result": {
        "amount": 65000,
        "energy": 65000,
        "duration": 1,
        "price": 3.4,
        "activation_fee": 0,
        "total": 3.4,
        "needed": 64285,
        "from_address": "TRX_FROM_ADDRESS",
        "to_address": "TRX_TO_ADDRESS",
        "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
    }
}

Possible Errors ​

Error CodeKeyDescription
1authAuthentication error (incorrect token or signature)
10invalid_tron_addressInvalid from address
10invalid_tron_addressInvalid to address
10invalid_tron_addressInvalid contract address
35service_unavailableService not available
500internal_server_errorInternal server error

Notes ​

  • The contract_address parameter is optional and defaults to TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t (Tether USDT)
  • This endpoint only estimates energy to make USDT transfer without creating a transaction
  • To create an actual energy purchase transaction, use the Create Transaction endpoint
  • Energy is sold in fixed amounts. A transfer that burns less than the smallest one on sale is quoted at that amount: amount is what you buy and pay for, needed is what the transfer burns. Code 35 service_unavailable is left for an estimate nothing on sale covers — above the largest amount, or no hourly energy on sale at all

Tron Energy API Documentation