Skip to main content
Version: 6.2.0 - 6.2.1

Energy & Bandwidth Guide

Every transaction on TRON consumes resources — Bandwidth for data transmission and Energy for smart contract execution. Understanding these resources is critical for cost optimization.

Resource Types

ResourcePurposeHow to ObtainConsumed By
BandwidthTransaction data sizeFreeze TRX / Daily free allowanceAll transactions
EnergySmart contract executionFreeze TRX onlyContract calls only

Free Bandwidth

Every TRON account receives 1,500 free bandwidth points per day (resets every 24 hours). This is enough for ~10 standard TRX transfers.

Bandwidth Cost

Each transaction consumes bandwidth based on its raw data byte size. If bandwidth is insufficient, TRX is burned for the transaction fee.

Energy Cost

Energy is required only for smart contract operations (deploy, trigger). The energy cost depends on the contract's computational complexity.

Estimating Energy

Before calling a smart contract, estimate the energy required:

const result = await tronWeb.transactionBuilder.estimateEnergy(
'TContractAddr', // contract address
'transfer(address,uint256)', // function selector
{}, // options
[
{ type: 'address', value: 'TReceiverAddr' },
{ type: 'uint256', value: 1000000 },
],
'TCallerAddr', // issuer address
);
console.log('Estimated energy:', result.energy_required);

Parameters:

ParameterTypeDescription
contractAddressstringSmart contract address
functionSelectorstringFunction signature (e.g., 'transfer(address,uint256)')
optionsobjectOptions like { callValue, tokenId, tokenValue, feeLimit }
parametersarrayFunction parameters: [{ type, value }]
issuerAddressstringCaller address

Constant Contract Deployment

For estimating deployment costs:

const result = await tronWeb.transactionBuilder.deployConstantContract({
input: contractBytecode,
ownerAddress: 'TDeployerAddr',
// ABI, feeLimit, etc.
});
console.log('Deploy energy estimate:', result.energy_used);

Querying Account Resources

const resources = await tronWeb.trx.getAccountResources(address);
console.log(resources);
// {
// freeNetUsed: 100, // Free bandwidth used
// freeNetLimit: 1500, // Free bandwidth limit
// NetUsed: 200, // Staked bandwidth used
// NetLimit: 5000, // Staked bandwidth limit
// EnergyUsed: 10000, // Energy used
// EnergyLimit: 50000, // Energy limit from staking
// TotalNetLimit: ..., // Network total bandwidth
// TotalNetWeight: ..., // Network total bandwidth weight
// TotalEnergyLimit: ..., // Network total energy
// TotalEnergyWeight: ..., // Network total energy weight
// }

Resource Calculation

How Much Energy Do I Get From Staking?

Your Energy = (Your Frozen TRX / Total Network Frozen TRX) × Total Energy Limit
const resources = await tronWeb.trx.getAccountResources(address);
const myFrozen = 10000_000_000; // 10,000 TRX in SUN
const estimatedEnergy = Math.floor(
(myFrozen / resources.TotalEnergyWeight) * resources.TotalEnergyLimit
);
console.log('Estimated energy from staking:', estimatedEnergy);

Bandwidth Calculation

Your Bandwidth = (Your Frozen TRX / Total Network Frozen TRX) × Total Bandwidth Limit

Cost Optimization Tips

  1. Stake for Energy — Contract-heavy dApps should stake TRX for energy rather than paying per-transaction TRX fees.

  2. Estimate before execution — Always use estimateEnergy before calling contracts to set appropriate feeLimit.

  3. Use free bandwidth — Simple TRX transfers and TRC-10 operations can use the daily free bandwidth allowance.

  4. Batch operations — Combine multiple operations when possible to reduce overhead.

  5. Set appropriate feeLimit — Setting feeLimit too high doesn't cost more, but setting it too low causes transaction failure with fees still consumed.

// Good practice: estimate + buffer
const estimate = await tronWeb.transactionBuilder.estimateEnergy(...);
const safeLimit = Math.ceil(estimate.energy_required * 1.2); // 20% buffer
const energyPrice = 420; // current energy price in SUN

const tx = await tronWeb.transactionBuilder.triggerSmartContract(
contractAddress,
'transfer(address,uint256)',
{ feeLimit: safeLimit * energyPrice },
[{ type: 'address', value: to }, { type: 'uint256', value: amount }],
);