← All articles

Contract-Execution Economics

Key takeaways

  • fee_limit caps the Energy a contract call may draw from its caller, staked Energy included. The TRX burned for the caller's Energy never exceeds it. It is set in the signed transaction before broadcast.
  • A call that runs out of Energy fails with the result OUT_OF_ENERGY. Its state changes are rolled back, and it is charged its whole Energy allowance, including the part it had not used. A call that exits through REVERT is charged only the Energy it used. Neither charge is refunded.
  • A contract's deployer can pay part or all of each call's Energy through consume_user_resource_percent. The deployer's share is capped by origin_energy_limit and by the Energy the deployer has available.
  • The limit, the result, and the payer are all readable in the transaction and its receipt. A reader finds the caller's Energy, the caller's TRX burn, and the deployer's share as separate fields in the receipt.

A contract call can consume a large amount of Energy, and it can fail after consuming it. The network charges a plain TRX transfer Bandwidth, plus flat TRX fees when the sender creates the recipient’s account, attaches a memo, or uses two or more signatures. No contract code runs in a plain transfer, so it uses no Energy. That difference is why contract execution has rules of its own: the caller sets a limit, a failure has a defined price, and a contract’s deployer can pay part of the cost for its users.

This article covers those three rules and what each one leaves on the record. It does not cover the Energy resource itself or how its price is set. Those are in what a transaction actually costs.

fee_limit: the caller’s limit

Every contract call has a fee_limit field, which the TRON documentation describes as capping “the Energy budget that the caller can cover for this transaction, expressed in sun.” A call draws Energy from the caller’s staked Energy first and then burns TRX to buy the rest. The TRX burned never exceeds fee_limit. The documentation calls it a “safety cap” against runaway Energy use.

The limit also applies to the staked part. The documentation says fee_limit “always applies, regardless of how much Energy you have staked.” The caller’s allowance for one call is the smaller of two amounts: the caller’s staked Energy plus what the caller’s TRX balance could buy, and fee_limit divided by the Energy price. A low fee_limit can therefore cause a call to run out of Energy even when the caller has ample stake.

The value is bounded. A valid fee_limit runs from 0 up to a maximum that governance sets, chain parameter No. 47, and the node rejects a transaction outside that range before it executes. On 17 November 2026 TronGrid showed the maximum at 15,000,000,000 sun, which is 15,000 TRX. Committee proposal 79 set that value, with an expiration time of 4 December 2022, and a later proposal can change it.

For a reader, fee_limit is part of the transaction’s signed envelope. It is fixed at signing and visible whether or not the call succeeded. It should not be read as the signer’s estimate of the cost. TronWeb v6.5.2 fills in 150 TRX when the caller passes no value, and the documentation’s recommended sizing formula “typically over-budgets”.

Running out of Energy: rolled back and charged in full

A failed call is still charged, and the charge depends on how the call failed.

When a contract call exhausts the Energy available to it, execution stops with the result OUT_OF_ENERGY. The node rolls back every state change the call made. The TRON documentation says that “all Energy available to that execution is counted as consumed, including any unused remainder.” The same rule applies to a timeout and to an invalid instruction. The java-tron documentation describes a crash, bug, or timeout as an unexpected interruption, where “the system will deduct all available Energy for the transaction as a penalty”.

Contract call BURNS ENERGY AS IT RUNS Out of Energy EXECUTION STOPS [ RUNS DRY ] [ EFFECTS UNDONE ] [ CHARGE STANDS ] State rolled back AS IF THE CALL NEVER RAN Energy not refunded FULL ALLOWANCE CHARGED A PAID, RECORDED FAILURE KEY THE STATE UNWINDS — THE COST DOES NOT
The state is rolled back and the charge stays. A failed call is a paid, recorded transaction.

A REVERT is the milder case. When a contract exits through a REVERT instruction, “only the Energy for the instructions executed up to that point is deducted.” State is rolled back on both paths, and the documentation says the consumed Energy “is not refunded” on either.

The whole allowance is not the same as the whole fee_limit. An investigator can see the difference in one call to the USDT contract, read from TronGrid on 17 November 2026. It had used 10,048 Energy when it failed with OUT_OF_ENERGY, and it was charged its full allowance of 13,880 Energy, which burned 1.388 TRX. Its fee_limit was 100 TRX.

A failed contract call therefore stays on-chain as a costed transaction. A reader finds the result and any Energy charged in the receipt, and the fee_limit in the transaction. An investigator can read from it that a call was attempted, that it did not complete, and what it cost.

A contract’s deployer can take on part or all of the Energy cost of calls to the contract.

Two parameters on the contract split the cost. consume_user_resource_percent is an integer from 0 to 100, the share of each call’s Energy the caller pays. At 60 the caller covers 60% and the deployer covers the other 40%. At 0 the deployer covers everything. origin_energy_limit caps the Energy the deployer will cover on a single call. The deployer’s share comes out of the deployer’s own available Energy, and the deployer’s TRX is never burned for it. The share actually paid is the smallest of three amounts: the configured share, that limit, and the Energy the deployer has available. Only the deployer can change the two settings after deployment.

For a contract deployed by a transaction, the protocol sets no default under which the caller pays all. TronWeb v6.5.2 fills in a caller share of 100 unless the deployer chooses another value. A contract created by another contract is given a caller share of 100 by the node.

ENERGY FOR ONE CALL — SPLIT AT THE PERCENT Caller pays consume_user_resource_percent % AN INTEGER FROM 0 TO 100, SET ON THE CONTRACT Deployer sponsors THE REMAINING % KEY CAPPED BY origin_energy_limit AND THE DEPLOYER'S AVAILABLE ENERGY AT 0, THE DEPLOYER PAYS WHILE ENERGY LASTS
The percentage sets the split. The deployer's cap and available Energy decide how much of its share it can cover.

A caller using a fully sponsored contract can therefore spend little or no Energy of its own, but only while the deployer has Energy behind the setting. The documentation is direct about the limit: “if the developer’s account has insufficient Energy, the remaining cost falls entirely to the caller.” When the split is between 1 and 99, the caller’s own budget also limits the deployer’s contribution, so the caller still needs a sufficient fee_limit.

The setting is an offer. The payment is in the receipt. On 17 November 2026 TronGrid showed the USDT contract set to a caller share of 30, but its deployer account had 9,329 Energy and all of it was used. In 28 blocks read from TronGrid that day, a reader finds a deployer share in 28 of 2,360 USDT receipts.

Reading a contract call’s record

The limit is a signed field. fee_limit is present on successes and failures alike. A reader can take it as the most Energy the call could have drawn from its caller. It may be a library default, so a reader cannot take it as what the signer expected to pay.

The result is in the receipt. OUT_OF_ENERGY and REVERT are separate results, and the node charges them differently. A failed call is an attempt that did not complete, and it can matter to a reader as much as a success.

The payer is in the receipt as well. energy_usage is the caller’s own Energy, energy_fee is the TRX the caller burned, and origin_energy_usage is the deployer’s share. A call with no fee was not always paid by the deployer. The caller’s own stake or Energy delegated to the caller can also cover it. A reader can attribute the payment to the deployer only from origin_energy_usage.

From a contract call’s record, a reader can recover the limit its caller signed, how the execution ended, and whose resources paid for it. To read one, open the receipt before drawing a conclusion from the fee alone.

Sources