The transaction costs on Concordium have two components, one is based on the size of the transaction and the number of signatures, and then there is a transaction-specific one for executing the transaction.
Helper functions to estimate the first component, called the base_cost (mainly the transaction_size needs to be exposed), or the combined cost of base_cost+ transaction-specific execution cost would give better insight into Concordium's transaction cost mechanism. Currently, the GivenEnergy::Add(energy) can automatically handle the base_cost before sending the transaction on chain but for applications that need inside and visibility (e.g. for cost optimization or some checks) that is not a good option.
Task description
The transaction costs on Concordium have two components, one is based on the size of the transaction and the number of signatures, and then there is a transaction-specific one for executing the transaction.
There is already support to get the transaction-specific execution cost. https://github.com/Concordium/concordium-rust-smart-contracts/blob/main/templates/default/deploy-scripts/src/deployer.rs#L297
Helper functions to estimate the first component, called the
base_cost
(mainly thetransaction_size
needs to be exposed), or the combined cost ofbase_cost
+transaction-specific execution cost
would give better insight into Concordium's transaction cost mechanism. Currently, theGivenEnergy::Add(energy)
can automatically handle thebase_cost
before sending the transaction on chain but for applications that need inside and visibility (e.g. for cost optimization or some checks) that is not a good option.GivenEnergy base_cost
Sub-tasks
base_cost
function.base_cost
function that given a signed transaction returns thebase_cost
of that transaction.transaction_cost
function that given a signed transaction returns the combined energybase_cost
+transaction-specific execution cost