Concordium / concordium-rust-sdk

Rust SDK for the Concordium blockchain.
https://docs.rs/concordium-rust-sdk/latest/concordium_rust_sdk/
Mozilla Public License 2.0
13 stars 17 forks source link

Better support to estimate the real transaction cost #134

Open DOBEN opened 9 months ago

DOBEN commented 9 months ago

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 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.

GivenEnergy base_cost

Sub-tasks

soerenbf commented 2 months ago

We have TransactionBuilder API. Is that the same?