Skip to main content
Fees in TON align with the execution phases of a transaction:
  • Storage fees are charged in the storage phase.
  • Compute fees are charged in the compute phase.
  • Forward and action fees are charged in the action and bounce phases.
  • Import fees apply at the start of smart contract execution, not a specific phase.
The total transaction fee is the sum of these components. Validators set fee levels through voting:

Storage fees

The storage fee uses account.bits and account.cells from AccountStorage, excluding ExtraCurrencyCollection stored in the other field. The other field is replaced with a single 0 bit that represents an empty HashmapE.

Compute fees

All computation is measured in gas units. A TVM operation typically has a fixed gas cost, but that is not always the case. Network configuration defines gas prices; users cannot override them.

Flat gas limit

A contract invocation pays for at least flat_gas_limit gas units. Spending up to that limit costs flat_gas_price TON. If the contract spends gasUsed gas units, the fee is:

Forward fee

Forward fee is calculated with this formula:
where:
  • lumpPrice is the fixed value from config paid once for the message.
  • msgSizeInCells is the number of cells in the message.
  • msgSizeInBits is the number of bits in all the cells of the message.
  • bitsInRoot is the number of bits in the root cell of the message.
The formula excludes the message root cell because it mainly contains headers. lumpPrice covers that root cell.

Action fee

Action fee is the portion of fwdFee granted to the validator of the message’s source shard. The remaining fwdFee - actionFee amount goes to the validator of the destination shard. Action fee exists only for internal messages.
Starting with Global Version 4, a failed SENDMSG action incurs a penalty proportional to the attempted message size. It is calculated as:

Import fee

Import fee mirrors forward fee for inbound external messages. The root cell and its contents are covered by lumpPrice in the same way as internal messages.

Helper functions (full code)