Smart Contract Fee
A "smart contract" is simply a program that runs on the Glitch blockchain. It's a collection of code (its functions) and data (its state) that resides at a specific address on the Glitch blockchain.
Smart contracts are a type of Glitch account. This means they have a balance and they can send transactions over the network. However they're not controlled by a user, instead, they are deployed to the network and run as programmed. User accounts can then interact with a smart contract by submitting transactions that execute a function defined on the smart contract. Smart contracts can define rules, like a regular contract, and automatically enforce them via the code. Smart contracts can not be deleted by default, and interactions with them are irreversible.
The total fee is calculated as below:
Fee = Gas used (units) * Gas price per unit
- Gas used (units)
Gas usedis the amount of computational effort required to execute transactions on the Glitch network. It includes computation steps and storage.
- Gas limit refers to the maximum amount of gas you are willing to consume on a transaction. More complicated transactions, involving smart contracts, require more computational work so they require a higher gas limit than a simple payment. A standard GLCH transfer requires a gas limit of 21,000 units of gas.
- Gas prices
- Gas fees are paid in Glitch's native currency, GLCH.
Gas pricesare denoted in
gwei, which itself is a denomination of GLCH - each gwei is equal to 0.000000001 GLCH (10-9 GLCH). For example, instead of saying that your gas costs 0.000000001 GLCH, you can say your gas costs 1 gwei. The word 'gwei' itself means 'giga-wei', and it is equal to 1,000,000,000 wei. Wei itself is the smallest unit of GLCH.
- In short, gas fees help keep the Glitch network secure. By requiring a fee for every computation executed on the network, we prevent bad actors from spamming the network. In order to prevent accidental or hostile infinite loops or other computational wastage in code, each transaction is required to set a limit to how many computational steps of code execution it can use. The fundamental unit of computation is "gas".
As shown on the diagram, making transaction needs gas available called gas limit. Then additional gas is needed for operation and storage.
- Gas price per unit: Price per unit is estimated with a certain amount. It is calculated in Gwei. The gas price is configurable and determined by the demand for resources in the network.