Gas is a fundamental concept within the Ethereum blockchain network that plays a crucial role in the execution of smart contracts and transactions. Gas refers to the computational work required to process and validate actions on the network. It is a measure of the computational resources needed for a specific operation, such as sending Ether or executing a smart contract.
Gas is used to determine the transaction fees or the cost associated with performing operations on the Ethereum network. Users must pay Gas fees to incentivize miners to include their transactions in a block and process them. These fees are typically paid in Ether and can vary depending on the complexity and resource requirements of the transaction.
Understanding Ethereum Gas is essential for participants in the Ethereum ecosystem, as it directly impacts the speed and cost of executing transactions and smart contracts on the network. Properly managing Gas fees ensures efficient and timely interaction with the Ethereum blockchain.
It is also important to note that gas costs can change based on the code version that ethereum clients are running, this article includes changes included in the London Upgrade (EIP-1559) which is, as of the time of writing, the latest version.
There are mainly three type of transactions in ethereum :
- Ether transfer : transaction in which account A transfers an amount of ether to account B.
- Smart contract call : transaction in which account A invokes a smart contract method (and maybe transfers an amount of ether to the contract to).
- Smart contract deployment : transaction in which account A deploys a new smart contract into the blockchain.
The first type of transaction has a fix cost of 21’000 units of gas (if calldata is empty), which corresponds to the “transaction initial cost” (described in the next subsection), however the other two types of transactions have variable costs, depending on several factors, this formula summarizes it perfectly :
TOTAL GAS COST = Transaction initial cost + Calldata cost + Opcodes execution cost + Storage cost + Address cost + Memory cost.
#Ethereum #Gas #work #Gas #fundamental #concept #Alberto #Molina #Coinmonks #Sep