Ethereum Gas Refund - Deepstash

Ethereum Gas Refund

If an operation runs out of gas, then it is reverted back to its original state like nothing actually happened, however, the operation generator must STILL pay the miners the fee for their computational costs and the operation gets added to the blockchain (even if it has not been executed).



MORE IDEAS FROM What is Ethereum Gas? [The Most Comprehensive Step-By-Step Guide Ever!]

The attributes of a Smart Contract

A smart contract functionality needs to be 3 things: 

Deterministic: it gives the same output to a given input every single time.

Terminable: contracts by definition, must be capable of termination in a given time limit.

Isolated: a contract will be kept isolated in a sandbox to save the entire ecosystem from negative effects. 




Ether is made of a blockchain (an immutable database) and a world decentralised computer (EVM), a virtual machine in which all the smart contracts function in Ethereum. 

The EVM is a simple yet powerful Turing Complete 256-bit virtual machine. Turing Complete means that given the resources and memory, any program executed in the EVM can solve any problem.



From Bitcoin to Smart Contracts

Bitcoin created a decentralized monetary system which can transfer money from one person to another. That only allowed for monetary transactions, there was no way to add conditions to those transactions: 

Alice can send Bob 5 BTC, but she couldn’t tell Bob that he will get the money only if he performed certain tasks.

These conditions are a smart contract: self-executing with specific instructions written in its code which get executed when certain conditions are made.

Say Alice wants to buy a house. The seller will receive the funds only if property rights are cleared and after the rights have been transferred over.




Gas is a unit that measures the amount of computational effort that it will take to execute certain operations. Each and every line of code in an Ethereum smart contract requires a certain amount of gas to be executed.

Suppose you are going on a road trip:

  • You go to the gas station & specify how much gas you want to fill up in your car.
  • You get that gas-filled up in your car.
  • You pay the gas station the amount of money you owe them for the gas.

In Ether world:

  • Driving the car is the smart contract.
  • The gas is well….gas.
  • The gas station is your miner.
  • The paid money is miner fees.




To get an operation done in Ethereum, the sender of the transaction must specify a gas limit before they submit it to the network & a gas price: 

  • The gas limit is the maximum amount of gas the sender is willing to pay for this transaction. If an operation has LOW gas, then the miners won’t even pick it up because it doesn’t have enough gas to finish the computation.
  • The price is the amount of gas the sender is willing to pay. If an operation has LOW fees, then it might have just enough gas to cover it but still, the miners won’t be chomping at the bits to pick it up because an operation with low fees isn’t economically appealing for them.



When two numbers are added a million times in Ethereum it costs ~$26.55 in fees. On Amazon AWS system it costs $0.000000066.

This means that computation in Ethereum is 400 million times more expensive!


  • A well-written contract would likely move such computational complexity off-chain and deal more with updating state in the contract.
  • A well-written contract would likely move such computational complexity off-chain and deal more with updating state in the contract.



Incentivization. Like any proof-of-work peer-to-peer system, Ethereum is heavily dependent on the computational power of its miners. More miners, more computational power, more secure and fast the system.

To attract more miners Ether needs to make the system as profitable and alluring as possible for the miners. In Ethereum, there are two ways that miners can earn money:

  • By mining blocks and getting block rewards.
  • By running smart contracts. The gas system allows them to charge a certain fee for doing so.



If bitcoin is digital gold, Ethereum is alike the power grid, powering an ecosystem of worldwide decentralized applications

The gas is the metering system for the consumed power. And ETH is the currency used to pay for running the software and maintaining the network. 



Deepstash helps you become inspired, wiser and productive, through bite-sized ideas from the best articles, books and videos out there.



A world computer & a settlement layer

Ethereum is a “world computer”: It lets people build apps & products with money baked into the code. If you believe that web3 is going to continue to grow, then you likely believe that over time,

Ethereum will become the “settlement layer” of the internet: All sorts of transactions (whether on-chain or even Visa) will turn to Ethereum to exchange funds and keep secure, immutable records.

Owning ETH is like owning shares on the internet. Demand for ETH will go up with increased web3 adoption, while upcoming changes will decrease the supply of ETH and let more value accrue to holders.




The Proof of work concept existed even before bitcoin , but Satoshi Nakamoto applied this technique to the digital currency revolutionizing the way traditional transactions are set.

In fact, PoW idea was originally published by Cynthia Dwork and Moni Naor back in 1993, but the term “proof of work” was coined by Markus Jakobsson and Ari Juels in a document published in 1999.

But, returning to date, Proof of work is maybe the biggest idea behind the Nakamoto’s bitcoin white paper – published back in 2008 – because it allows trustless and distributed consensus.




What Are Cryptocurrencies?

A cryptocurrency is a digital medium of exchange using strong cryptography to secure financial transactions, control the creation of additional units and verify the transfer of assets.

There are a few pieces here to focus on: digital, strong cryptography, creation, transactions and verification.