Transaction fees
Fees on TON are calculated using this formula:FORMULAS
2^16
for precision) and come from network configuration:
-
storage_fees
: param 18 -
in_fwd_fees
: params 24 and 25 -
computation_fees
: params 20 and 21 -
action_fees
: params 24 and 25 -
out_fwd_fees
: params 24 and 25 -
storage_fees
is the amount you pay for storing a smart contract on the blockchain. In fact, you pay for every second the smart contract is stored on the blockchain.- Example: your TON wallet is also a smart contract, and it pays a storage fee every time you receive or send a transaction.
-
in_fwd_fees
is a charge for importing messages only from outside the blockchain, for example,external
messages. Every time you make a transaction, it must be delivered to the validators who will process it. For ordinary messages from contract to contract, this fee does not apply. Read the TON Blockchain paper to learn more about inbound messages.- Example: each transaction you make with your wallet app (like Tonkeeper) must first be distributed among validators.
-
computation_fees
is the amount you pay for executing code in the virtual machine. Computation fees depend on executed operations (gas used), not code size.- Example: each time you send a transaction with your wallet (which is a smart contract), you execute the code of your wallet contract and pay for it.
-
action_fees
is a charge for sending outgoing messages made by a smart contract, updating the smart contract code, updating libraries, etc. -
out_fwd_fees
is a charge for forwarding outgoing internal messages within TON between shardchains; it depends on message size.
Storage fee
Storage fee for smart contracts is calculated using the following formula, values are defined in network config param18
:
FORMULAS
TypeScript example
See Helper functions appendix for full implementations.
DeduplicationThe system counts only unique hash cells for storage and forward fees. For example, it counts three identical hash cells as one. This mechanism deduplicates data by storing the content of multiple equivalent sub-cells only once, even if they are referenced across different branches. Read more about deduplication.
Gas fee
All computation is measured in gas units; each TVM operation has a fixed gas cost.The gas price is defined by network configuration and can not be set by users.
- Basechain: 1 gas =
26214400 / 2^16
nanotons = 0.0000004 TON - Masterchain: 1 gas =
655360000 / 2^16
nanotons = 0.00001 TON
20
and 21
for current gas prices.The values can change through validator governance.
TypeScript example
See Helper functions appendix for full implementations.
Forward fee
Forward fee for message size (msg.bits
, msg.cells
) per params 24
/25
:
FORMULAS
TypeScript example
Invalid
Received: info
Expected one of: note, tip, caution, danger
type
passed!Received: info
Expected one of: note, tip, caution, danger
Import fee
Import fee is the same as forward fee for inbound external messages.Action fee
Action fee is charged in the Action phase and is the sender’s share of the forward fee.You pay it for
SENDRAWMSG
; actions like RAWRESERVE
, SETCODE
do not incur the fees.
FORMULAS
first_frac
(params 24
/25
) divided by 2^16
≈ 1/3 of msg_fwd_fees
.
Action fine (failed send): Starting with Global Version 4, a failed “send message” action incurs a penalty proportional to the attempted message size. It is calculated as:
FORMULAS