Tezos Storage Cost, Gas and Fees
Fleetingtezos storage cost
on top of funding the contract with ꜩ1, alice was also charged an extra cost that is burnt. This cost comes from the storage and is shown in the line Paid storage size diff: 46 bytes, 41 for the contract and 5 for the string “hello”. Given that a contract saves its data on the public blockchain that every node stores, it is necessary to charge a fee per byte to avoid abuse and encourage lean programs
other cost associated with running contracts is the gas, which measures how long does a program take to compute. Contrary to storage there is no cost per gas unit, a transfer can require as much gas as it wants, however a baker that has to choose among several transactions is much more likely to include a low gas one because it’s cheaper to run and validate. At the same time, bakers also give priority to high fee transactions. This means that there is an implicit cost for gas that is related to the fee offered versus the gas and fees of other transactions.
Another important use of validation is to determine gas and storage limits. The node first simulates the execution of a Michelson program and tracks the amount of gas and storage that has been consumed. Then the client sends the transaction with the right limits for gas and storage based on those indicated by the node. This is why we were able to submit transactions without specifying these limits: they were computed for us.