Gas is an internal currency for entering into transactions or contracts in Ethereum. At the time of writing and before Frontier was launched, it was installed at 10 Szabo, which is about 1/100000 of Ether. This separated the Ether block (ETH) and its market value from the unit of measurement (Gas). Thus, the miner can decide to increase or decrease the use of Gas according to his needs, and if necessary, the price of Gas can be appropriately increased or reduced, avoiding a situation in which an increase in the price of an ETH will necessitate a change in the entire price of Gas. This is also a kind of response to the discussion in Bitcoin about the fee structure.
Gas system is not very different from using KW to measure electricity consumption at home. One difference from the real energy market is that the initiator of the transaction sets the price for Gas, which the buyer can agree or not, which leads to the emergence of a market around Gas.
In Ethereum there is also a limit of blocking – so you pay for the premium space in the next block just like in Bitcoin.
Bitcoin’s miners prioritize transactions with the highest prey fees. The same can be said of Ethereum, where miners can freely ignore deals whose gas price limit is too low.
Gas price per transaction or contract is set to deal with Turing Complete and its EVM (Ethereum Virtual Machine Code) – the idea is to limit the endless cycles. For example, 10 Szabo or 0,00001 Ether or 1 Gas can execute a line of code or some command. If the account does not have enough Ether to execute a transaction or message, then the action is automatically considered invalid. The idea is to stop attacks on denial of service due to endless cycles, increasing the efficiency of the code, and also to force the attackers to pay for the resources they use, from bandwidth usage to processor calculations.
The more complex the commands that you want to perform, the more Gas (and Ether) you have to pay. For example, if Anne wants to send to Agent 1 Ether – then the total cost of 1.00001 Ether will be paid by Ana. However, if Anna wanted to sign a contract with Victor depending on the future price of the Ether, there would be more lines of executable code and more responsibility or energy consumption placed in the distributed Ether network – and therefore, Anne would have to pay more than 1 Gas for made transaction.
Some computing operations are more expensive than others because they are more resource-intensive at the computational level and because they have more data to be stored in the state. Here is the list of operations in the Ethereum virtual code and their cost in Gas (which is Ether).
The gas price limit is currently set to ensure the stable launch of Ethereum, but it will be allowed to float freely according to need, and the amount of total Gas per block will increase gradually to contribute to the stability of the Ethereum network.