Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Estimating gas fees #9

Open
jefft0 opened this issue Aug 25, 2023 · 2 comments
Open

Estimating gas fees #9

jefft0 opened this issue Aug 25, 2023 · 2 comments
Labels
question Further information is requested

Comments

@jefft0
Copy link
Contributor

jefft0 commented Aug 25, 2023

GnoMobile is a framework to help developers deploy their Gno apps on mobile. A Gno app calls realm functions which subtract gas from the user's account. Some functions may require extra gas, for example to post a message with a large document. Therefore, it is useful to estimate the gas that will be used before calling the function. This presents special issues for mobile apps, as mentioned below.

Possible methods to estimate gas fees are:

  • Use an approximation based on the amount of data and typical processing fees for that function. This is the simplest method and may work in most cases, but is not exact and can cause surprises. Works well on mobile.
  • Use gnovm to evaluate the function locally based on a sample realm state. This does not require syncing the current state of the realm, which can be expensive on mobile. This would be a more accurate measure of CPU fees but is still not exact. Also, because the realm state is not current, the function call may fail (when it would succeed with the current realm state).
  • Use gnovm to evaluate the function locally using the current realm state. This would compute the exact fees, but requires to sync and store the realm state which can use lots of bandwidth and storage which may be undesirable (or impossible) on mobile.
  • Use gnovm on a remote server to evaluate the function using the current realm state. The server has enough storage and bandwidth, but would use lots of CPU. Who runs these "eval servers" and what is the incentive? Is this compatible with a peer-to-peer approach?

In the end, we need to decide on one or more methods and have API support in Gno plus support for mobile app development in GnoMobile.

@jefft0
Copy link
Contributor Author

jefft0 commented Aug 25, 2023

We need to resolve the related issue gnolang/gno#1070 about getting the correct "gas used" from the realm function call.

@jefft0 jefft0 added the question Further information is requested label Sep 29, 2023
@jefft0
Copy link
Contributor Author

jefft0 commented Aug 28, 2024

See this issue about gas estimation in the main gno repo. gnolang/gno#1826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Development

No branches or pull requests

1 participant