Gas is the internal cost to make a transaction or contract in Ethereum. At the time of writing it was just before the Frontier launch, it was fixed to 10 Szabo, about 1 / 100.000 of an Ether. It separates the units of Ether (ETH) and its market value from the unit of computing usage (gas). Hence, a miner can decide to increase or decrease its usage gas according to its needs, while if necessary, gas prices may increase or decrease accordingly, avoiding the price increase of ETH need to change everything gas price. This is also a response to the discussion of bitcoin on fee structure.
The gas system is no different from using Kw to measure electricity used in homes. One difference from the actual energy market is that the initiator of the transaction sets the price of gas for miners that they can decide to accept or not, which leads to the emergence of a market around gas. You can see the development of gas prices here: https://etherscan.io/404
With Ethereum there is also a blockize limit - so you're paying a premium for the next block just like Bitcoin.
With Bitcoin miners, they prioritize transactions with the highest mining fees. The same is true for Ethereum, where miners are free to bypass transactions where the gas cost limit is too low.
Gas cost per transaction or contract is set to deal with the nature of the loop code (Turing Completeof Ethereum and EVM (Ethereum Virtual Machine Code) - the idea to limit the infinite loop. For example 10 Szabo, or 0.00001 Ether or 1 Gas can execute a single line of code or some command. If there is not enough Ether in the account to carry out the transaction or message, it will be considered invalid. The goal is to stop denial of service attacks from infinite loops, encourage efficiency in code, and get attackers to pay for the resources they use, from bandwidth through computing. CPU math then storage.
The more complex commands you want to execute, the more gas (and Ether) costs you will have to pay. For example if A wants to send unit B 1 Ether - there will be a total cost of 1.00001 Ether paid by A. However if A wants to form a contract with B depending on the future price of Ether, then there will be More executable lines of code and more than one task or energy consumption are placed on the distributed Ether network - and thus A will pay more than 1 Gas does in the transaction.
Some calculation steps are much more valuable than others because they are expensive with estimation or because they increase the amount of data that must be stored in the state. Below is a list of activities in Ethereum Virtual Code and their cost in gas (called Ethers).
Operation name Gas Cost Function
Step 1 The default amount of gas to pay for an execution cycle.
Stop 0 No Fee for SUICIDE operation.
Sha3 20 Paid for SHA3 operation.
Sload 20 Paid for a SLOAD activity.
Sstore 100 Paid for a normal SSTORE activity (double or sometimes waived).
Balance 20 Paid for BALANCE operation
Creat 100 Paid for a CREATE operation
Call 20 Paid for a CALL activity.
Memory 1 Charges each additional word when expanding memory
Txdata 5 Takes every byte of data or code for a transaction
Transaction 500 Paid for every transaction
Gas price limits are set at the present time to provide for the Ethereum stabilization system but will be released freely according to demand and the total amount of gas per block ( block) will gradually increase to encourage the stability of the Ethereum network.