People must pay a small fee for all transactions and smart contract executions on Ethereum. This fee is called Gas. Technically, Gas is the unit of measurement on the amount of computational effort required to execute an operation or a smart contract. More complex operations require more gas to fulfill. Gas fees are paid entirely in ETH. The network demand can fluctuate the price of gas from time to time. Gas price can increase if there are more people interacting on the Ethereum blockchain due to the limited amount of computing resources on the network. On the other hand, when the network is not congested, the market price of gas would decrease. When the network is busy due to high utilization, transactions with the highest gas fee associated with it will be prioritized for validation and adding to the blockchain. The transactions will be queued up according to gas fees paid and transactions with lower-than-average gas fees can take long time to complete.
Example of how gas fees are calculated
Gas price is typically denoted in gwei.
1 gwei = 0.000000001 (10-9) ether
Assume a smart contract execution to transfer tokens require 20,000 gas units.
Assume the average market rate for gas price is 4 gwei.
20,000 gas x 4 gwei = 80,000 gwei = 0.00008 ETH
When executing the transactions, you will pay a gas fee of 0.00008 ETH to
process and validate your transaction in the network.