Ethereum Gas: Introduction (What is Gas?)

Hey hey! This is Julien and you are on
EatTheBlocks! And in this video I’m going to explain you the concept of Gas. So when
you are a beginner and you want to learn how to build decentralized application on
Ethereum very quickly you stumble upon this weird concept of Gas. So what it is?
Well, very simply gas is a transaction fee. So every time you send a transaction
to the Ethereum blockchain, you have to pay this gas thing. So one thing is very
important to understand: you only need to pay gas when you want to modify data on
the blockchain. If you just want to read data, you don’t need to spend any gas.
So in solidity all the function with the view or pure keyword they are read-only.
So for these functions you don’t need to spend anything. So second question: “who
pays gas?” The payer of gas is the sender of the transaction. So if I sign a
transaction, that means that I will be the payer of gas.
Next, “Who receive gas?” Miners receive gas. So miners are people or entities that
add data to the blockchain and to reward them of the work then we pay them these
gas. “When gas is paid?” Gas is paid when it is mined by a miner.
So that means if I send a transaction at a certain time and I send it to the
Ethereum blockchain I’m not gonna pay any gas until a miner includes it in the
blockchain. Actually it’s possible that no miner wants to include my transaction.
And in this case I will never pay anything. So it’s a little bit like a
cheque that you sign. “Where to buy some gas?” After all if you have to pay it, maybe
that you need to first acquire it, right? Well actually no because gas is
just a measurement. This is an abstract unit so the transaction cost is measured
in gas but you actually pay it in ether. And I’m gonna explain you in the next
videos exactly how you can go from gas to ether. “How to pay Gas?” Well the only thing
you need to do is to sign your transaction, you
send it to the Ethereum Network and then the Ethereum protocol directly is going
to debit some either from your Ethereum address. But you don’t have to do
anything. By the way if you don’t have enough ether in you address, then you
won’t be able to pay this gas cost. And your transaction will fail. By the way if
you want to know my most useful Solidity tips check this free email series link
in the description. The next video of this series will go much more in details
about what is gas and when you are developer, what you have to know about it
and how you can set the gas parameters for your transaction. So we’ll stop here
and in the next video I’ll talk about why we came up with this concept of gas
and how comes we just don’t do the transaction cost in ether for example,
that that would be more simple right? I’m gonna explain you all of this. Thanks for
watching guys, see you for the next video

Leave a Reply

Your email address will not be published. Required fields are marked *