Lets imagine you’re in a Sunday Morning , sitting on a comfy couch and you remembered you have things to do.
You have the day off and its your chance to fix all these things out, so you start the car with checklist in hand. You go first to buy from the grocery store, then went to sell your old phone on the market in downtown.
After that you met your friend to exchange some movie CDs
Everywhere you go the car need gas right?
Because the car operate on gas to take us anywhere we want. …So what this has to do with Ethereum gas?
Ethereum blockchain is like a vehicle.. it takes you anywhere you want, build limitless apps as long as you feed it with gas.
Anything that change the state of blockchain is a transaction, deploying, selling, exchanging, change value of a smart contract, all these actions cost us gas.. but here it called Ethereum gas.
lets give an example for a smart contract and when will we need gas in the process.
Mathematical operations like Addition, Subtraction, Multiplication, Division ..each one of these operators cost gas, to know more about gas prices and the type of operators that cost gas (check)
- Any transaction that modifies the blockchain costs gas
- The user that generates the transaction the one who pays for the gas