Market Cap:
$293.4B
BTC Dominance:
65.33%
btc:
$10770.00
eth:
$228.66
xrp:
$0.33
Advertise
How To

Guide to Ethereum GAS

Maya Mandz | May. 8, 2019
Guide to Ethereum GAS

May 8, 2019 | AtoZ Markets - Ethereum Gas once was called the lifeblood of the Ethereum network. And that indeed could be the right definition. What is Ethereum GAS and why it is so essential for the ethereum ecosystem? Atoz Markets decided to find out.

What is Ethereum EVM?

First of all, it is worth to mention, that essentially, ethereum was created not as a currency for transfers, but as a platform for certain applications, like smart contracts, execution (with payment by ETH).

Another difference between ethereum and bitcoin is ethereum decentralized virtual machine (EVM). It allows running any smart contract (usually written in the Solidity programming language) if there are enough time and memory. Due to the same EVM, that computer is running, Ethereum wallet-ETH storage usually consumes too much computer resources.

Ethereum GAS as a payment

In the ethereum network, the maximum block size is not measured in bytes, as in bitcoin, but in the amount of Ethereum GAS. It is a unit that measures the amount of computational effort needed to execute certain operations. GAS enables ethereum network user to perform three actions:

  • Transfer ETH to another user.
  • Create a smart contract and insert it in the blockchain.
  • Execute a smart contract.

In order to perform these operations on the ethereum platform, you will need to pay a commission and the unit of payment for any commission is GAS. To conduct a complex operation, like creating a smart contract, you might need more GAS. The simple activity, like the transfer of ETH from one wallet to another, requires less GAS.

Why the Ethereum GAS limit is such a big deal?

GAS Limit is the maximum amount of GAS that can be withdrawn during a transaction. This is done to ensure that as a result of any mistake, you do not have to lose a large number of GAS funds. When setting a GAS limit, it is important to understand a few things:

  • It is crucial to know what limit of GAS you need to put. For example, a GAS limit is 100,000, and for the certain operation execution, you need 50,000. The required amount of GAS, in this case, does not exceed the limit, the transaction falls into the unit and will be executed. The remaining 50,000 GAS will return to the wallet as ETH. If the operation requires 105,000, then all 100,000 will be spent, but the transaction is not validated. 
  • It is worth to learn from smart contract developers when participating in the ICO and other operations, what limit of GAS to set.
  • The standard GAS limit for transferring ETH to another address is 21,000 GAS. If you plan to simply buy and transfer ETH to different addresses without contacting smart contracts, then it is important for you to remember that your Gas limit is 21,000.

What is Ethereum GAS price?

The GAS system is not much different from the use of the designation "kilowatt" to measure household electricity consumption. One difference from the real electricity is that the initiator of the transaction itself sets the price for GAS, which the miner can agree or disagree with. It is sort of a commission, which receives a miner who validates a smart contract or performs any other ethereum network related operation. Although the commission is calculated in GAS, it is paid in the Ether (ETH).

The average gas price is about 20 gwei (or 0.00000002 ETH) but can increase during times of high network traffic as there are more transactions competing to be included in the next block.

But what is Gwei? Gwei is most commonly used when talking about GAS. Rather than saying "your GAS cost is 0.000000001 ether" you can say "1 gwei". Other Ethereum units include Finney, Szabo, and Wei. 1 ETH = 1,000 Finney = 1,000,000 Szabo = 1,000,000,000 Gwei = 1,000,000,000,000,000 Wei

The names of the shares are not accidental, these are the names of people who played a significant role in the development of cryptocurrencies.

Hal Finney - the first Bitcoin user after Satoshi Nakamoto

Nick Szabo - the creator of the idea of smart contracts

Wei Dai - the creator of the concept of b-money, in fact, the ancestor of Bitcoin

If you specified a too low value for the GAS limit, then the transaction becomes invalid and will be rejected due to the “Out of Gas” error, and the GAS spent on the calculations will not be returned to the account. The sender always pays miners for the calculations, regardless of whether the transaction passes or not.

Dos attacks and Ethereum GAS

In the Bitcoin system, miners give priority to those transactions for which the highest commissions are set. The same is true for the ethereum system, where miners can ignore those transactions where GAS prices are too low.

GAS prices per transaction or smart contract are set to deal with the Ethereum Turing Nature and its EVM (Ethereum Virtual Machine). The basic idea is to limit infinite loops.

For example, 10 Szabo, or 0.00001 Eth or 1 GAS can execute a line of code or some command. If there is not enough GAS on the account to complete a transaction or send a message, then such transactions and messages are invalid.

The meaning of this rule is to stop DoS attacks (denial of service attacks) caused by the use of infinite loops, improve code efficiency and force the attacker to pay for the resources he uses - from the bandwidth of the Internet channel to the resources of the CPU and hard drives. Three years ago Ethereum network experienced DoS attack, due to which miners and nodes had to spend a very long time processing some blocks. The consequence of this was that the network was greatly slowing down.

Summary :  

  • GAS and ether are not the same things. Gas is the amount of computational power required while ether is the currency used to pay for that gas.
  • Amount of GAS depends on how many EVM instructions need to be executed.
  • There is no fixed price of conversion. It is up to the sender of a transaction to specify a GAS price. Also, it is up to the miner to verify any transactions they like (usually ones that specify the highest gas price).
  • Miners, who are responsible for putting transactions inside their blocks use their computational power to validate smart contracts. The GAS system allows them to charge a certain fee for doing so.
  • GAS cost is 0.000000001 ETH or 1 gwei.

Please share your thoughts with us in the comment box below.

Disclaimer: The views and opinions expressed in this article are solely those of the author and do not reflect the official policy or position of AtoZ Markets.com, nor should they be attributed to AtoZMarkets.