Have you heard of “ether gas?” What is it and why do you need to understand it?
Simply put, ether gas is a denomination of ether designated toward paying the cost of running a transaction on the Ethereum blockchain. It is what you must pay to run an Ethereum transaction using an ether block someone else mined.
To illustrate, think about it like this. Suppose you belong to a bake club. The members of the bake club are allowed to use each other’s kitchens, granted you all agree to pay for the electricity and ingredients used. You call this cost to use someone else’s kitchen “cookie dollars.” Ether gas, in a sense, is the equivalent of “cookie dollars.” It is both the honorarium paid for using the service and the discouragement toward preventing misuse of the privilege.
Gas, Gas Prices and Gas Limits
When a miner discovers a new ether block, he or she will receive transaction fees in perpetuity as a reward. These transaction fees are the ether collected in gas cost for all transactions performed on that block.
To understand this, let’s consider asking the Ethereum blockchain to add 2 and 5. The resulting code, in pseudo-machine code, may look like this:
- CREATE ARRAY MEMBLOCK(1)-MEMBLOCK(4) of type INTEGER
- RECEIVE “2” in MEMBLOCK(1)
- RECEIVE “+” in MEMBLOCK(2)
- RECEIVE “5” in MEMBLOCK(3)
- IF MEMBLOCK(2)=”+” THEN
- MEMBLOCK(4)=MEMBLOCK(1)+MEMBLOCK(3)
- END IF
- PRINT MEMBLOCK(1),MEMBLOCK(2),MEMBLOCK(3),”=”,MEMBLOCK(4)
This code would cost a computer eight instruction steps to run. On the Ethereum blockchain, lines of code cost one gas unit to perform. A gas unit is simply the number of wei a line of code costs to run on a node, or the ether gas price in wei (Gwei) (A wei is the basic denomination of ether. ETH, as measured on the market charts, is 1018 wei, or 1,000,000,000,000,000,000 wei.) So, if the gas price was 10 Gwei, adding 2 and 5 would cost 80 Gwei per instance or 80/1,000,000,000,000,000,000 ETH.
The ether gas price is determined by the transaction’s initiator. When a DAPP starts a transaction on Ethereum, it announces an ether gas price. The higher the price, the more likely a block will take the transaction and the more likely the block will prioritize it. Gas prices are set by weighed distribution, meaning that there is always a minimum and maximum accepted gas price. Depending on the complexity and importance of the transaction, the price can be adjusted by the DAPP accordingly.
An ether gas limit is a limit that an end user can set on the maximum amount of ETH he or she is willing to spend on ether gas. This can be a very important safeguard to prevent overspending on transaction runs. Gas limits also prevent unscrupulous users from emptying the wallets of unsuspecting victims by creating unlimited reiterations of a transaction. Should a user attempt to run a transaction that exceeds his or her set ether gas limit, he or she will get an “out of gas” error and the transaction will be aborted.
Blocks also have gas limits, meaning that only a certain number of transactions can be performed on a block at a given time. Given that, establishing the correct gas price is essential for the success and speed of a transaction.
Conclusion
Ether gas was created as a part of the Ethereum framework to both encourage mining and to keep transaction times as low as possible. By establishing transaction fees, it creates an emphasis to keep transactions simple, to set a fair and competitive gas price, and to minimize the number of transactions and iterations that a single DAPP is producing. This “responsibility by economics” philosophy continues to make the Ethereum blockchain the choice for DAPPs and ICOs.
As an Ethereum user, you will find that ether gas will be a regular part of your life. It is advised that you review the ether gas cost of any DAPPs you may be using for any ICOs in which you may participate and establish an ether gas limit that is appropriate for your needs. It is also important to keep track of ether gas prices. One can track gas prices at ETH Gas Station or EtherScan.
Want to understand more about the digital currency space and its role in new finance? Click here to subscribe to the Bitcoin Market Journal newsletter today.