What's in a transaction
Nothing is loaded from YouTube until you press play, and then without tracking cookies.
About this video
Let's discuss what goes into a blockchain transaction.
Understanding transaction fees and the mystery of gas.
The latest DevHub Replay stemming from t.me/neardev
Transcript
773 wordsCaptions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.
- 0:03
I got another Dev Hub replays for you coming up we need the glasses for this one are you sure about that recently one of our support chats we got the question of how to understand a transaction but specifically the question really was where does the transaction fee come from how is that calculated uh help me understand please I don't know what's happening here with where's all my money going it was just really so if you look at a block
- 0:29
Explorer like anyone like all the different chains have one uh you see information vaguely like this that that's here with all the basics of when happened where it happened how to look it up again uh who was interacting with what and that fun stuff but you'll see here at the bottom uh there are things like deposit value transaction fee transaction actions that actually what actually happened there then gas limit and things like that that's all the
- 0:54
stuff that we need to know for this so what actually is gas and why is it referenced that way and what does it all actually mean no one knows what it means and this is the important part of the transaction fee so a gas is a unit representation of the actual computational work simply said uh the validators have to do stuff when you make a make a request and this is the representation of that gas is not an
- 1:20
actual price okay so gas just like you put gasoline in your car you might put let's say 10 gallons of gas in there or petrol for those overseas look a clock we don't have that in America I put gas in my car you know or Petrol in your automobile but you're going to say okay I have 10 gallons of gas and that cost x amount of dollars or whatever and then you you calculate that and that's how much you pay in total to put the gas in
- 1:55
your vehicle great cash homie here is the same kind of idea except we're talking about transactions being processed SO gas is that unit saying how much we do something in this example and in most transactions on like the near blockchain most have a trans gas limit of let's say 300 T gas the T gas just stands for trillion gas units why make trillions when we could make billions so it's divided a unit into a trillion parts now this is
- 2:29
important because you'll see some other terminology as well that's like this and in this example that's a lot lower number so we're actually going to see something called G gas which is simply one billion billion gas units so one t gas is equal to 1,000 ggas bro what are you talking about and how is that actually represented in this example well here we go so you can see the basics here of was the transactional success the hash you can look back up
- 3:01
when it happened uh there's sharding I just sharded on the near blockchain so you can see what Shard it happened on even though it doesn't matter for you as a developer you can you don't have to reference the chart ever but it's good to know there but down below what we're really worried about is a transaction fee for this example my transaction fee is going to be my gas amount times the
- 3:22
price okay of the of what it is so and let's say the example is one t gas cost 0.000000001 near whatever it is uh that times the amount of gas being used leads to what the actual fee is going to be you incredible in math so now you see here that the usage in this transaction was only 2% of that almost two and a half 7.31 T gas was actually used 311 G gas was burn so all of that com combined together times the price you get your transaction fee which you see here is
- 4:04
0469 very nice now the deposit part of that is the other part of the equation where your deposit is what Fe is going to come out of money please the rest of your deposit gets returned to you um on near there's two parts to this there's the transaction fee and then there is the storage fee put them together and that's what comes out of your deposit the rest your deposit gets returned you don't provide enough deposit you don't get to have the transaction just like
- 4:38
life see you next time