Skip to content

[chain] Gas Estimations #1826

@zivkovicmilos

Description

@zivkovicmilos

Description

This effort covers the introduction of gas estimation functionality for transactions.

Copied from an issue on the Gno repo:
For users to send transactions that will eventually be committed to the Gno chain, they essentially need to provided 2 pieces of information gas-wise:

  • Gas Limit - the amount of gas (units of gas) the user is willing to pay for a given transaction to go through
  • Gas Price - the amount of native currency the user is willing to pay for a single unit of gas

Currently, gas estimation is not possible for a client application interacting with gno, and therefore applications and users need to guess the gas limit. If they guess incorrectly (too low), their transaction is rejected as being underpriced.
Additionally, there is the problem of gas fees being fixed to 1GNOT (1000000ugnot), as outlined in issue #649.

Ethereum has support for gas estimations with the following RPC endpoints:

  • eth_estimateGas - returns the lowest gas limit at which the transaction is successful. It finds the lowest value by doing a binary search over the gas range, and executing the transaction for each (middle) value in that range
  • eth_gasPrice - returns the current average gas price for a (any) transaction, in wei. Usually, this average is implemented as a rolling average value, and is tied temporally to the node serving the call (the average is reset when the node is restarted)

Successful outcome of this effort:

  • A user can estimate the minimum amount of gas their transaction will use
  • A user can see the current average gas price for the network

Metadata

Metadata

Type

No type

Projects

Status

Done

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions