If you’ve ever sent a transaction on the Ethereum blockchain, you’ve had to select some amount of Gas to go with it so it can be confirmed. Without an appropriate amount of Gas, your transaction won’t be selected by the network’s miners and included in a subsequent block.
What Is Gas?
Gas is essential to the Ethereum network, it is quite literally the fuel that allows it to operate. More specifically, Gas refers to the unit that measures the amount of computational effort required to execute specific operations on the Ethereum network. When you want to participate in a token crowdsale or play CryptoKitties, you need Gas to incentivize miners to include your transactions in the blockchain.
This Gas fee is paid out in ETH, which is most times converted into GWEI for a better user experience.
A simple analogy to understanding the role of Gas in the Ethereum network is to compare it to how cars need gas or to function. In the same way that individuals go to the gas station and pay to fill up their cars, users of the Ethereum network pay to have their smart contracts executed by miners. This is why so many in the blockchain community like to refer to ETH as the ‘fuel for the digital economy.’ ETH quite literally converts into fuel, which incentivizes miners to perform computation on a global network.
Gas is vital because it serves as the primary incentivization mechanism in the Ethereum network. Remember that miners have to expend their own computational power to run smart contract operations, they don’t do so out of their good will, but rather because they can earn fees from providing a valuable service.
As in any Proof-of-Work system, the security of the network is reliant on miner hashrate, which is primarily dependent on the monetary incentive to secure the network. The more Gas that Ethereum miners can earn, the more secure the network will be.
When thinking about Gas, there are two main components: Gas Limit and Gas Price. The total cost of performing an operation is the product of the Gas Limit and Gas Price (gas limit x gas price).
The Gas Limit refers to the maximum number of Gas a user is willing to spend on a computation. Some basic computations require a predetermined number of Gas and it’s easy for wallets to provide these estimates based on what type of an operation the user is trying to perform. For example, the Ethereum yellow paper states that every transaction requires 21,000 Gas. This is why most UIs will display 21,000 as the Gas Limit by default.
The price per unit of Gas is represented in GWEI, which is a more user digestible version of WEI. WEI is equivalent to ETH in the way that a penny is equivalent to the dollar, it is the smallest denomination of the currency. One GWEI is 10^9 WEI and provides a much better user experience for calculating gas costs.
As you’d expect, the higher the proposed gas price, the higher the chances that the transaction will be included in the next block since this is what incentivizes miners. The default gas price on most interfaces is 20 GWEI, which should be sufficient to get a transaction in the next couple of minutes. Increasing the price to 40 GWEI will likely get you in the next block.