What is Gas on the Ethereum Network?
“Gas” on the Ethereum network can refer to two things.
The maximum amount of units of gas one is willing to spend on a given transaction. This ensures that users don’t spend an infinite amount of gas on a transaction that has an error in the contract but is otherwise invalid.
The price paid per unit of gas. This is measured in units called GWEI.
The total transaction fee is the gas limit multiplied by the gas price.
TX = Gas limit * gas price
Why Do We Need Gas?
Any transaction that takes place on the Ethereum blockchain requires computation–whether sending Ethereum-based platform tokens, interacting with contracts, or using Ethereum coins (ETH).
Computation involves miners validating transactions that have been sent to the network’s transaction pool. Valid transactions are added to the blockchain; invalid transactions are rejected. In either case, computation is still required.
Ethereum users must always pay computation fees, because miners must always undertake in the verification process, even when transactions are rendered invalid. The computation or transaction fee is paid to miners. It is calculated in “Gas” and paid in ETH.
How Does this Impact Ethereum Users?
Ethereum users can adjust gas limits and gas prices to increase the likelihood that their transactions will be processed in a timely manner.
Users adjust the gas limit to make sure they aren’t spending all of their ETH on transaction attempts, just in case an error occurs.
Users adjust the gas price to encourage miners to include their transactions in mining blocks. The goal is to set a gas price that is high enough for a miner to want to include the transaction.
Depending on the priority of the transaction, users can also select lower gas prices. Lower prices typically means longer transaction times. Here is an approximate scale for normal transactions:
|Settlement Goal||Gas Price|
|Next block||40 GWEI|
|Next several blocks||20 GWEI|
|Next several minutes||2 GWEI|
For example, if someone sets the limit at 21,000 gas units for 40 GWEI per unit, the total transaction fee will be 0.00084 ETH. This is equivalent to $0.67 if one ETH equals $800.00. The average confirmation time for this transaction will be around 30 seconds.