I am programatically calculating fees for transactions.

AFAIK, bakers by default adhere to the following fee calculation:

fees >= (minimal_fees + minimal_nanotez_per_byte * size + minimal_nanotez_per_gas_unit * gas)


minimal_fees = 0.000 1ꜩ (100µꜩ)
minimal_nanotez_per_gas_unit = 100nꜩ/gu (0.000 000 1ꜩ/gu)
minimal_nanotez_per_byte = 1000nꜩ/B (0.000 001ꜩ/B)


Today, I had a transaction which timed out in the mempool. The transaction used 66754 gas units and 234 bytes of storage.

Based on the above, I think that the proposed fee of 0.00701XTZ should have been sufficient to get included in a block:

minimal fees =                     .000001
gas fees     = 66745 * 100nꜩ/gu =  .006676  (rounded up)
storage fees = 234 * 1000nꜩ/B   =  .000234 
total        =                     .00701

Why was this transaction not included in a block?

  • If you want to compare, tzkt.io/opP2A3NnAPwioSHfVcjv6B6Vji5HKF6ruRsJyEVUWDk1x8S7Xy5 0.00701 is crazy high for a fee, almost 4x the minimum of 0.001792. I believe the storage minimum is 257. You might want to look for more examples of calling contracts to see what their fees/params are set. – utdrmac Jul 27 '20 at 14:00
  • AFAIK 257 bytes is the fixed cost for origination of a contract. This is simply an invocation. The gas is expensive, which makes sense. This is a multi-contract call that is updating a big map and serialization/deserialization and contract calls are expensive. I was able to send successfully in this transaction: carthage.tzkt.io/… which applied with: gas = 66754 storage = 234 So I believe those values are correct. I just don't know how to back out the actual fee in XTZ from them. – keefertaylor Jul 28 '20 at 1:50
  • You don't. Gas doesn't have relationship with the txn fee. forum.tezosagora.org/t/psa-do-not-quote-gas-cost-in-tez/1618 You can specify max gas for every operation and keep the minimum fee and still have success. Gas is just a limiting factor to prevent runaway contracts. – utdrmac Jul 28 '20 at 14:07
  • Okay, so it "technically" doesn't but in practice it does. If this wasn't true, then why did this operation not apply? The same exact operation applied with a higher fee. This operation sat in the mempool for 20+ minutes before I overwrote it. – keefertaylor Jul 29 '20 at 2:28

Answering my own question:

'Storage' (the bytes on chain) is burned and isn't related to the fee.

The minimal_nanotez_per_byte refers to the size of the transaction itself when serialized to bytes with a signature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.