What gas is
Every transaction makes the network's validators do work: check a signature, run a smart contract, update balances. Gas is the unit of that work. A simple transfer uses little gas; a swap that runs through several contracts uses much more. The fee is roughly gas used × gas price, paid in the chain's native coin to the network that processes it.
The fee is not a charge by the app you use. It goes to the network, which is why you pay it even when the app takes nothing, and why you need some of the native coin in your wallet even to move a token. A worked example with made-up numbers: at a price of 1,000 nanotons per gas unit, a call using 10,000 gas costs 10,000,000 nanotons, which is 0.01 GRAM.
On some chains users bid for block space and fees spike when the network is busy. On TON the prices are fixed by the network's configuration: users cannot raise them to jump the queue.
How fees work on TON
A TON transaction fee is the sum of several parts, all paid in GRAM:
- compute (gas) fee: the gas the contract used times the gas price, with a minimum flat charge for any call;
- storage fee: rent for keeping the account's code and data on the blockchain, charged over time; an account that cannot pay for long enough can be frozen;
- forward fee: the price of sending a message to another contract, which grows with the message's size.
Because a swap or a jetton transfer is a chain of messages between contracts (your wallet, your jetton wallet, a DEX, the recipient's jetton wallet), the wallet attaches more GRAM than the first step needs. What the chain does not spend comes back to you as an excess, a separate incoming transfer at the end of the chain.
Validators set all these prices by vote, and they change rarely. Newer wallet contracts such as W5 also support gasless transfers: a relayer attaches the GRAM for you and may take its fee in the token you send.
Where DYOR shows fees
- Blockchain config decodes the parameters that hold the prices: gas in ConfigParam 20 (masterchain) and 21 (basechain), storage in 18, message forwarding in 24 and 25. Flat amounts are in nanotons; per-unit prices are shown as the network stores them, in nanotons times 65,536.
- DYOR Swap shows the network fee before you confirm. DYOR adds no fee of its own; the exchanges' fees are already in the quoted rate.
- The staking calculator subtracts an estimate of the network fee for staking and unstaking from the result.
- The unit converter turns nanotons into GRAM and dollars, handy when an API or a config shows raw numbers.