The Token Singaporean

Hosted ByVNSTR

The Token Singaporean is a show about Non Fungible Tokens, the blockchain technology changing the world of digital art and collectibles

TS8 | Understanding Gas Fees

Apple PodcastsSpotify

The word Gas is used for so many things. It refers to a type of matter. It’s used for heating and cooking in many households. We also use it as a synonym for petrol and worry when the prices go up. But what does it have to do with crypto?

Discussion Topics: Understanding Gas Fees

  • How to understand gas fees
  • What makes them go up or down
  • The concept of gas limits and how they impact your transaction
  • When is a gas fee too high?
  • Gas fees as a factor in evaluating NFTs

Transcript: Understanding Gas Fees

Hi, everybody. Welcome back to this week’s episode of ‘The Token Singaporean’. My name is Vnstr. So happy to have you guys back with me. And for today, we’re going to talk a little bit more in-depth about a topic that we have briefly touched on before and I think, this particular topic, as long as you have ever interacted with the Ethereum blockchain, pretty sure you have come across this thing in one way or another.

But perhaps a lot of us, we might have gone through it, but we don’t really know how it works and as such many times we might be baffled by why is it that I’m paying an exorbitant amount for this particular thing or why is it that my transactions are stuck and I don’t know what to do about it. So for people who get the hint, you probably know that today we’re going to talk a little bit more about understanding gas fees on the Ethereum platform.

So let’s go. So to understand a little bit more about what gas fees are, basically gas fees are like transaction fees that you pay the people who help to process and authorise your transaction. Over here I’m trying to refrain from using the terminologies that might confuse you guys. So let’s just stick to that. The main idea is to understand the concept and how it works. So just imagine that you’re at a restaurant and you finish eating and everything and you want to pay the bill for your goods, for the service that has been rented.

So what happens is you get the waiter. And then if there is no one in the restaurant, you’ll be pretty fast I hope. So the waiter or waitress will come over to get you the bill, you can get it signed, get it paid, and then off you go. All’s good. Okay. Transaction done. However, what happens when there are a lot of people in a restaurant and it’s packed, but they only have a very limited number of staff available and you’re in a rush to sort of like, pay and leave because you have to go watch a movie or whatever it is. So what happens that is similar to how the Ethereum transaction fee works is that you could put in a little bit more money.

So if you put in a little bit more money, it gives more incentive for the service staff to come over and give you the bill first, since they can keep the rest of the money for themselves as a tip. So in a way, gas fees are like that as well. So if you proceed with the transaction, if there’s nobody using the blockchain, the network is pretty free.

Your transaction should be able to go through with the standard amount of service fees and stuff and it should happen without a hitch. However, if the network is very busy, but there is only a fixed number of people who are validating the transactions then what you can do is increase your gas fees, and then this will bring your transaction forward in a sense that you can cut the queue because you’re paying more.

So the queue is basically arranged based on who is willing to pay more. The people who pay more will get their transaction done first as simple as that. So this is basically how gas fees work in the Ethereum blockchain in general, but let us take things a little bit deeper. Now that you understand the conceptual idea of how gas fees work, how exactly are gas fees calculated on the blockchain? So actually it’s pretty simple for you to understand it in layman’s terms.

And I’ll try my best to sort of simplify it as much as possible. So to understand gas fees, you need to know that gas fees are basically calculated by breaking them down into two parts. The first part is gas price and gas price is the amount of gwei you pay for each unit of gas. So basically the amount of money that you pay for each unit of gas. And then there is also another aspect is gas limit and gas limit, which basically represents the maximum units of gas that you’re willing to pay for each transaction.

So transaction fees are basically calculated by getting the gas price times the gas limit. So for example, each unit of gas, you are willing to pay 30 gwei and then your gas limit is like, let’s say 200. So your gas price will be 30 gwei times, 200, something like that. The numbers are arbitrary. So I’m just like putting out numbers anyhow.

It doesn’t represent how the fees are usually like in terms of actual values, but the concept is as such. So to give you a better idea, we can think of it in the scenario of driving a car. So I will try to explain this in terms of driving a car to give you an idea of how it’s applied in this sense. So gas price, just like petrol price fluctuates. Like petrol fluctuates depending on demand and supply, depending on a lot of different factors. So similarly gas price on the ethereum network also fluctuate depending on network congestion.

So the more ethereum transaction at a point in time, the higher the gas price will be. So this is a demand supply concept. It is pretty straight forward. And then for the second aspect, gas limit, so the gas limit is dependent on the weight of the smart contract. What I mean by that is that when you interact with smart contracts, the way it’s transacted is dependent on how much data and information there is within a smart contract.

It’s a little bit like, maybe getting a delivery service. Delivery services are all the same. However, if you are moving more things, then obviously you’re paying more. If you’re moving less things, you’re paying less. So same thing for contracts within each contract, the more complicated it is, the more heavy it is in terms of data the more you need to pay for gas limit, because it will take more time and energy.

I’m going to re-explain the gas limit part. So I’m going to start here. And for gas limit, how it works is that gas limit is basically calculated dependent on the weight of the smart contract. So what I mean by that is that it’s essentially calculated depending on how much data there is within a smart contract. So if I want to apply in a scenario, it’s a little bit like hiring a delivery service.

If you are doing one trip, however, if you are going to move more stuff within that one trip, you obviously have to pay more compared to if you move just very little items because there’ll be more effort required. So this is the same concept as the gas limit. So once again, the more complicated and more data within the smart contract, the higher the gas limit will be required.

But the good thing about here is that you can actually just assign more gas limit because unused gas will be returned to you. So how I explain this is if we go back to the idea of gas price, when you are pumping petrol for your car if the price is $60 per litre, I don’t drive so I don’t know how much petrol actually cost, but let’s say it’s like $20 per litre. I think that still sounds like too much.

I have no idea honestly, I have no concept of how much petrol costs, but okay let’s say it’s like $10 per litre and you have agreed to say that okay, fine I’m going to pay $10 per litre. I’m going to pump a full tank. And then obviously you gotta pay the price for the full tank. And if after you pump suddenly something happens and then the price of petrol drops significantly you can’t go back to the petrol kiosk to say that I just pumped five minutes ago can you calculate based on the price now and not the one that was agreed before. It doesn’t work like that.

So in a sense, when it comes to gas price the moment you’ve agreed on the price the amount that you’re willing to pay you can’t back up from it. That is the set price. However, for gas limits, it is a little bit more like how much you’re pumped in, in terms of petrol in your car. So let’s say you need to travel from Singapore to a very faraway place. And then you can’t really gauge how much petrol you need to have in your car.

So what happens is that it’s okay what you can do is you can just pump a full tank and then when you reach your destination, whatever petrol that is not used, still stays in the car. So in a way it is still yours, it’s not like it will be burned. So this idea should be pretty easy to understand. So this is the reason why when it comes to the gas limit, you can assign more gas limit because any unused gas will eventually be returned to you.

So what happens if you put too low an amount for both gas price or gas limit? So for gas price, if you put too low an amount what you will see on your contract I mean, on your transaction details would be that your transaction will remain stuck in pending because the gas price is too low nobody’s willing to sell you their service, nobody’s willing to sell you the petrol. So you’ll forever be pending.

Pending means that you are just stuck in the queue, just waiting for your turn. So maybe someone will entertain you when the network fees are really low and they have nothing to do. But if the network is busy, it is unlikely that you’ll get your turn. So you might get stuck there all the way until, for example, if you’re minting NFTs, and it’s high in demand it could get stuck and so even though you’re there first because people are willing to pay for higher prices, their transaction will get authorised first and then they will get the NFT and you will not. Once it’s sold out, it’s done. So what happens if you put too low a gas limit?

So your transaction will essentially fill with the reason that says out of gas. So it’s the same as like the petrol scenario. So you’re driving, but you only want to pump like one quarter tank and you want to go all the way to KL. It’s not going to happen. You’re going to reach somewhere in the middle. I mean, not even in the middle at the beginning of the trip and then what happens is that your car is going to stop moving because there’s not enough petrol and when you get all this petrol refunded, you will not get this petrol refunded and you will also not reach your destination. So this will be a big issue.

So usually we don’t really manipulate gas limit because when we do a transaction, what happens is that, I think metamask or whatever wallet you’re using they usually calculate the gas limit that’s required and it’s usually pretty accurate. So we try not to touch the gas limit.

However, when it comes to gas price, if you are not in an urgent situation where it’s like a fastest fingers first situation, what you can do is you could actually just try to put a slightly lesser in terms of like gas price, if it’s too high at that point in time and just wait if you’re waiting to wait usually as long as you know, the network conditions are a little bit calmer gas price will drop and then your transaction will just get through when network is less busy.

But of course, if you’re going to put like a ridiculous price, I mean, below what people are willing to accept in terms of petrol, nobody’s going to sell you even if no one buys it, same thing for gas price. So it still has to be within a certain mark of how much you need to spend at the bare minimum in order for your transaction to get through. And all this information can be found on Google.

You can just Google and you can just use like a gas tracker this and that, something like that to sort of like understand at the point in time of your transaction what the gas price is, and then sort of think about how much you’re willing to spend in terms of gas price because essentially it is transaction fee. It is not part of the value of like, whatever you are transacting.

So for example, you’re buying an NFT even if NFT costs $50, but your transaction fee costs $200 then you have to think about whether it’s really something that you want to do or can you perhaps afford to wait a little bit for transaction fees to become lower, I mean, for gas fees to become lower before you proceed your transaction. So on and so forth. And usually just looking at these mark contracts is a pro tip, I guess, in a way because like I mentioned before the more data there is in a smart contract the higher price required for gas limit.

So in a sense, sometimes having a lot of data in a smart contract might also mean that the smart contract might not be very efficient. So this might also be a reflection of the quality of the project that you’re interacting with. Of course, it is not a hundred percent the case because there are definitely projects that can be very complicated. There’s a lot required in smart contracts. I mean, I’m not a smart contract expert myself, so I can’t say much, but when it comes to NFTs, like at this point in time of recording I think a lot of contract writers they have managed to sort of innovate and improve to make smart contracts, very efficiently.

So, a lot of times these days even though network conditions can be busy, but because the smart contract is so light in a sense it’s so efficient the gas fees are not as crazy compared to maybe months ago. Months ago I think I remember telling you guys that I did pay 0.3 eth for gas price. And that is crazy.

So these days I don’t think you meet this kind of price that much also because volume is lower now, of course, but in general, I think smart contracts are becoming lighter, and lighter because people learn to write in a way that’s more and more efficient. So that’s a good thing as well. So in a sense, I guess this could also be one aspect that you can think about when you’re evaluating whether a project is worthy or not in a sense, whether the debts and the founders are doing what they can to sort of make their project good.

I mean, just from simple stuff, like the amount of effort they put in to make sure that their contract is efficient says a lot because if you’re not willing to even put in that bare minimum, especially in times like this, when mostly it’s already almost like a prerequisite, then I think you need to rethink your investment as well.

So with this, this is the end of our episode on understanding a little bit more about what ethereum gas fees are about. And I hope that you have learned a thing of two from this. So this concludes our episode about ethereum gas fees. It’s not very in depth, but I just hope that it serves sort of like an episode that will allow you to understand in brief how ethereum gas price works.

And if I’m able to make it such that you are now able to sort of understand conceptually how things happen then it is good enough for me. So if you like, and enjoy this episode, do feel free to share this podcast, give me a like, or just comment in our social media and follow us definitely and stay tuned to look out for the next episode coming up. See you.

Leave a Reply

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