Gas Price vs Total/Max Gas in Ethereum

R P
3 min readJan 5, 2018

--

The distinction between gas price and the total gas is not as complicated as it is said to be. Of note, total gas is AKA max gas AKA gas limit, though gas limit has a more accurate technical meaning in terms of the maximum gas in a block that miners determine.

The plain term “Gas” simply represents computational power or resources that the network has to expend. This includes execution and storage.

Name = GAS PRICE; Unit = GigaWEI (GWEI)(or other multiple of Wei which is a subdivision of Ether)

This represents the amount you are willing to pay per unit of computational power that is expended by the network. If you pay too little, miners may not incorporate it (“mine”) into the blockchain and you will be kept waiting. If you pay “too” much, it should be incorporated quickly, but you may have overpaid when less could have sufficed. ETHGasStation is a great resource.

Name = Total Gas (AKA Max Gas (Pseudo-AKA Gas Limit)); Unit = Gas

This represents the total amount of work you are willing to pay for at the gas price (mentioned above). If the limit is set too low, and the miner “runs out” of gas while executing your request (such as a large contract), then the transaction is reverted but you still pay for the gas that was used. Think of this as an “Authorization” of work. If you set this number too high though, and the contract has a severe surprising inefficiency, you may end up paying for a lot more work than intended.

Analogy

Think of a situation where you are hiring a mover that uses a truck to move your furniture to a distant city. You pay per hour. You also set a limit on how many hours you are willing to pay for at maximum. The pay per hour is the gas price. The maximum hours you are willing to pay for is the total gas/max gas. For example: You say you will pay 100 dollars per hour of work but only up to a total of 12 hours. Gas price ~100 dollars per hour. Total Gas ~12 hours. If you do not offer a high enough gas price, no mover will accept the contract. If you offer too little of a total gas, your move will be aborted prior to reaching the destination city, but you will still pay for the incomplete work that was performed.

Disclaimer: I do not claim to be an expert on Ethereum. I am an early adopter like you. I do not speak for the Ethereum Foundation. Do not hold me liable for any losses. The above recommendations are provided “as-is.” I give no warranties. Currently, blockchain technology is “forgive-less.”

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response