Ethereum gas is the fuel that keeps the Ethereum universe running. Gas is the payment for Ethereum miners for varifying transactions or running smart contracts. Here’s how it works!
Ethereum is an open-source blockchain platform, a decentralized public ledger for verifying and recording transactions, with its own cryptocurrency, called Ether. At the moment, it is the other giant of the crypto world besides Bitcoin, with some important tweaks and a broader ambition. The Ethereum network's users can also create and use applications on the platform, called “dapps”, and use its Ether cryptocurrency as payment. Ether is second only to Bitcoin in market value as a digital currency.
Ethereum gas is a measurement unit of computational effort that is needed to execute certain operations. Every single operation taking place across Ethereum requires some amount of gas. Fees paid to miners are linked to Ethereum gas because they are calculated based on how much computational power a transaction, or a specific operation, such as executing a smart contract, requires on the Ethereum network. Hence the name, “gas”, which refers to the “fuel” that keeps the Ethereum network running.
In the Ethereum ecosystem, the gas ensures that an appropriate fee is being paid after transactions that are submitted to the network. It also helps to provide a market-based allocation of network resources. By requiring that a transaction pays for each operation it performs, Ethereum ensures that the network doesn’t get misused.
Ethereum miners - who verify the transaction and add it to the blockchain - get paid based on how much computational effort it took them to complete the transaction. They are compensated in Ether. The gas system prioritizes important transactions, making their computational costs and rewards public to miners, creating a sort of auction system.
Your transaction won’t be completed if you specify too little gas for the operation. Ethereum miners will start the process, but stop when your gas runs out. The transaction fee, ie. the gas used, will be kept by the miner, even though your transaction hasn’t been completed. However, if you dedicate more gas to the task than necessary, you will be compensated by the miner for the unused gas once the operation is completed.
Let’s find out more about gas prices!
How does gas price work?
“Gas limit” refers to the maximum amount of gas a user is willing to spend on a transaction. A standard transfer of Ether requires a gas limit of 21,000 units of gas. As tasks become more complicated, say with dapps or smart contracts, they require more gas, and the gas limit increases. For example, the gas limit can be interpreted as the total amount of gas a car can hold in its tank. The gas price is the cost of a unit of the gas you put into the car.
To find out how much you have to pay for a transaction, you have to multiply the amount of gas used by the applicable gas price. Gas prices are measured in gwei, a denomination of Ether - much like cents versus the US dollar, except in this case 1 billion gwei equals 1 Ether.
Most Ethereum wallets estimate the gas prices applicable to your transaction and then allow you to choose between fast, standard or slow transaction confirmation speed, depending on how much you are willing to pay.
Let’s look at an example! Your wallet estimates the gas price to be 100 gwei if you want to have your transaction done within the next minute. You multiply the amount of gas used for the transaction - let’s say 21,000 units of gas - and the gas price, which is 100 gwei. This results in 2,100,000 gwei, equal to 0.0021 Ether, which - at the July 2021 Ether price of $1,800 - makes the cost of the transaction $3.78.
As demand grows, users can offer higher gas prices to out-bid other users’ transactions and get verified faster.
The idea behind decoupling gas, the computation effort, from the price of Ether is that an increase in Ether price should not change the cost of transactions as long as network activity stays the same. An increase in network activity does raise the gas price, though, hence the spike in Ethereum transaction fees in early 2021.