I am using the following formula and associated constants to calculate fees: https://tezos.gitlab.io/protocols/003_PsddFKi3.html#more-details-on-fees-and-cost-model
Also referenced here: https://tezos.stackexchange.com/a/107/5237
Since the Delphi protocol upgrade my calculated fees result in transactions which often take 15-60 blocks to confirm, assuming because baker's de-prioritize transactions with fees too low.
The constants I was using before Delphi:
minimal_fees = 100 000 nanotez (100 mutez)
minimal_nanotez_per_gas_unit = 100 nanotez
minimal_nanotez_per_byte = 1000 nanotez (1 mutez)
After Delphi:
minimal_nanotez_per_byte
is given by the node, and is now 250 nanotez. Other values are the same (hard-coded).
My formula, using consumed_gas
given by run_operation
:
fee = minimal_fees +
(minimal_nanotez_per_gas_unit * consumed_gas) +
(minimal_nanotez_per_byte * tx_size_in_bytes)
fee = fee * 1.05 // 5% padding
I added a somewhat arbitrary 5% padding (prior to Delphi) to resolve transactions occasionally not getting picked up by bakers within a reasonable time or sometimes not until they expire from the mempool. After Delphi I am seeing this happen more regularly despite the 5% added.
Is there a better formula or updated constants I should be using to calculate fees to ensure operations are confirmed consistently?
tx_size_in_bytes
needs to be both the number of transaction bytes + the signature bytes, not just the transaction on its owntx_size_in_bytes
does include the signature bytes.paid_storage_size_diff
that comes back from the estimation. You need to continue using 1000 nanotez fortx_size_in_bytes