19

In protocol 003_PsddFKi3, how can the gas and storage usage be calculated without doing a dry-run in a node?

14

There's no other way, you have to simulate what the operation does if you want to estimate this value, and this is exactly what a dry run does. You could try to reimplement it outside of a node, but the approach would be the same.

| improve this answer | |
  • 1
    That's true. If doing it outside of the node the same logic must be used as in the dry run. For operations that doesn't involve parameters or script, I guess a simplified logic could be used in the client, in order to reduce the traffic to the node. – Klassare Feb 1 '19 at 18:06
0
+50

According to the official documentation available here you can get the gas and storage cost of the operation you plan to broadcast to the network by passing the parameter --dry-run to the client node

Quoting the doc it mentions

Another important use of validation is to determine gas and storage limits. The node first simulates the execution of a Michelson program and takes trace of the amount of gas and storage. Then the client sends the transaction with the right limits for gas and storage based on that indicated by the node. This is why we were able to submit transactions without specifying this limits, they were computed for us.

So officially there's indeed no alternative way short of implementing your own validator.

| improve this answer | |

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.