PSA: do not quote gas cost in tez

I’ve seen a few people describe the cost of invoking a contract in tez, they’ll say: “Sending a transaction to that contract costs 0.5 tez in gas”. This is a bad habit, here’s why:

  • The point is generally to compare how gas efficient two contracts might be, but the amount of tez it takes to include a given transaction in a block can vary based on supply and demand for block space and block gas.
  • The gas “price” used is, in most cases, not even based on a fee market price but on a totally arbitrary (and configurable) default value set over a year ago as a mitigation against account creation spam (though the proper fix was to create the account creation burn).

In contrast, gas unit cost is defined by the protocol. It does not depend on the fee market conditions, it does not depend on arbitrary defaults in config files, etc.

It may be hard to interpret gas unit numbers so, to make this more intuitive, bear in mind the following constants:

  • gas limit per operation : 800,000 (1,040,000 in Carthage)
  • gas limit per block : 8,000,000 (10,400,000 in Carthage)
  • simplest transaction (implicit account to implicit account transfer): 10,207
8 Likes

Right now it doesn’t matter, but when blocks are getting full it will. Then bakers will choose to optimize for fee and gas to fit the most tx into their own blocks. Senders will then have to estimate the amount of fees to pay for a known gas usage so that their transactions get selected earlier.

2 Likes

I would say even right now it matters to get into the good habit of counting in gas units.

1 Like