Transaction - Calculate a gas limit

Is there a way to calculate precise limit for transaction? :thinking:
I’m using a limit of 100 for all my transactions for now, but this is like a blind shot :man_shrugging:

We fully intend to support gas estimation, but it’s still in the early design phase right now. The Cadence gas metering model itself is subject to further changes, so it’ll likely be a little while until we know how to best calculate gas limits.

Our ideal solution would allow a user to calculate a gas limit without much communication with a Flow node. While some networks require gas estimation to be performed by a networked node, we’re hoping to arrive at a solution that leverages static analysis to produce reliable estimates without actually executing the transaction in the full Flow VM.

For now it’s best to assume that we will eventually add a function to the SDKs that takes a transaction as input and returns a reliable gas estimate. In the meantime it’s safe to use a much higher than needed limit because we’ve configured both the emulator and live networks with generous upper bounds.

1 Like

Thank you a detailed response! :man_bowing: