Obtaining resources

Get the Bandwidth and Energy you need before deploying or invoking a contract on TRON — by staking TRX, by delegation, or by burning TRX directly.

📘

Prerequisites

Deploying a smart contract on TRON requires two essential network resources: Energy and Bandwidth. If your account holds a sufficient balance of these resources, the deployment will be processed free of charge without burning any TRX. Resources can be acquired through several methods:

  • Staking: You can stake your own TRX to generate a recurring daily allowance of Energy or Bandwidth.
  • Delegation: You can receive resources delegated from other users or via resource rental platforms.

If your account lacks the necessary resources, the network will automatically burn TRX from your balance to pay for the deployment. This dual-model gives you the flexibility to either pre-load your account with resources for zero-fee operations or pay-as-you-go using TRX.

How much Energy do I need?

The Energy a contract deployment or call consumes depends on the contract's bytecode size and the operations it performs. A typical TRC-20 token contract deployment consumes roughly 200,000 to 500,000 Energy depending on complexity. Always estimate before broadcasting on Mainnet.

For details on how to estimate Energy for a deployment or call, see How to estimate the Energy consumption of a contract deployment transaction.

Option 1: stake TRX (recommended)

Staking TRX gives you Energy proportional to your stake relative to the total network stake. Used Energy regenerates over 24 hours.

// Stake 5,000 TRX for Energy using TronWeb
const tx = await tronWeb.transactionBuilder.freezeBalanceV2(
  tronWeb.toSun(5000),  // amount in sun
  'ENERGY'              // resource type
);
const signed = await tronWeb.trx.sign(tx);
const result = await tronWeb.trx.sendRawTransaction(signed);

For the full staking workflow including delegation and reward claims, see Stake 2.0.

Option 2: Get Energy via delegation

If you do not want to lock up TRX yourself, another account can delegate Energy to you. This is common in TRON's energy rental market — services like JustLend DAO Energy Rental provide instant rentals without staking.

See Stake 2.0 Solidity SDK reference if you want to handle delegation programmatically from a contract.

Option 3: pay TRX directly

If you do not have staked or delegated Energy, TRON automatically burns TRX from your balance to cover the Energy cost. The Energy unit price (energyPrice) is currently 100 sun (0.0001 TRX) per Energy unit, but it can be adjusted by SR proposals — check the latest value through wallet/getchainparameters or TRONSCAN.

For most occasional deployers, paying TRX directly is the simplest path; for frequent deployers or production DApps, staking pays off quickly.

Setting fee_limit

Whenever you deploy or call a contract, set fee_limit to cap the maximum TRX that can be burned. This protects you from unexpectedly high costs if the contract enters an expensive code path.

The maximum allowed fee_limit is currently 15,000 TRX on Mainnet, controlled by chain parameter getMaxFeeLimit (#47). Query the live value via wallet/getchainparameters rather than hard-coding. For most TRC-20 deployments, 1,000 TRX is enough. For complex contracts or DApps under heavy load, calibrate using the Energy estimation flow above.

For the full cost-management guide — including the on-chain max_factor parameter and how to calculate fee_limit for high-success-rate deployment — see FeeLimit & Energy cost.


Related resources