Features

API Fee Estimator โ€” Simulate Energy, Bandwidth & Fees

Fee Estimator

Use this endpoint to simulate and calculate the expected costs of executing a signed Tron transaction on-chain โ€” before actually sending it.

This is ideal for:

  • Displaying fee previews to end-users
  • Budgeting before broadcast
  • Determining if extra resources (energy or bandwidth) are needed

#โœ… What You Need

Before estimating the fee, make sure you have:

  • A partially or fully signed Tron transaction JSON (same structure used for sending)
  • The X-Network header set (mainnet or nile)
  • Valid Tronfuel Authorization header

You do not need to include the signature field if you're only estimating cost.


#โš™๏ธ How It Works

  1. You POST a transaction structure (like the one used for /transactions) to the estimation endpoint.
  2. Tronfuel:
    • Analyzes the required energy and bandwidth
    • Calculates whether account activation is needed
    • Returns a fee summary in TRX
  3. You can then decide whether to sign and send it or make adjustments.

#๐Ÿ“ก Example Request

Endpoint:
POST /api/v1/transactions/estimate

 1POST /api/v1/transactions/estimate
 2Host: tronfuel.dev
 3Authorization: Bearer YOUR_API_KEY
 4Content-Type: application/json
 5{
 6  "visible": false,
 7  "txID": "a4248da216a3ed283cc707a6a353dac7fb83222ec972bd00780a5b4e3deb474a",
 8  "raw_data": {
 9    "contract": [
10      {
11        "parameter": {
12          "value": {
13            "data": "a9059cbb00000000000000000000000052a5b77f0f4b3cdbad76f02e56c2d4ec8334cba000000000000000000000000000000000000000000000000000000000000f4240",
14            "owner_address": "4177bafb1379d3b8f85404c8bfa243c4416dcf2092",
15            "contract_address": "41eca9bc828a3005b9a3b909f2cc5c2a54794de05f"
16          },
17          "type_url": "type.googleapis.com/protocol.TriggerSmartContract"
18        },
19        "type": "TriggerSmartContract"
20      }
21    ],
22    "ref_block_bytes": "bcb2",
23    "ref_block_hash": "2601e6c1ee1d5fb9",
24    "expiration": 1750928064000,
25    "fee_limit": 15000000000,
26    "timestamp": 1750928007900
27  },
28  "raw_data_hex": "0a02bcb222082601e6c1ee1d5fb94080fcc7dbfa325aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a154177bafb1379d3b8f85404c8bfa243c4416dcf2092121541eca9bc828a3005b9a3b909f2cc5c2a54794de05f2244a9059cbb00000000000000000000000052a5b77f0f4b3cdbad76f02e56c2d4ec8334cba000000000000000000000000000000000000000000000000000000000000f424070dcc5c4dbfa32900180acc7f037"
29}

#๐Ÿงพ Example Response

 1{
 2  "status": 200,
 3  "ok": true,
 4  "message": "Transaction fee estimated successfully",
 5  "data": [
 6    {
 7      "bandwidth": 345,
 8      "bandwidth_available": 600,
 9      "bandwidth_needed": 0,
10      "bandwidth_cost": 0,
11      "energy": 32000,
12      "energy_cost": 3.064,
13      "account_activated": false,
14      "account_activation_cost": 1.4,
15      "fee": 4.464
16    }
17  ]
18}

#๐Ÿ“˜ Field Reference

| Field | Description | | ------------------------- | -------------------------------------------------- | | bandwidth | Total bandwidth units the transaction will use | | bandwidth_cost | Cost in TRX if bandwidth is not enough | | energy | Estimated energy needed (for smart contract calls) | | energy_cost | Cost in TRX if no free energy is available | | account_activated | Whether the target address needs activation | | account_activation_cost | One-time TRX fee for activating a new account | | fee | Final fee (in TRX) that will be deducted |


#โš ๏ธ Notes

๐Ÿ“Œ Tip: You can call this endpoint multiple times while constructing a transaction to check the cost impact of different amounts, targets, or contract methods.


Need help building your raw transaction? See the Transaction Builder section.

 1
 2Let me know if you want this exported as a file, added to your documentation system, or if you'd like a similar version for โ€œDry Runโ€ testing.