githubEdit

/v1/estimate_gas_price - Aptos

Example code for the /v1/estimate_gas_price json-rpc method. Сomplete guide on how to use /v1/estimate_gas_price json-rpc in GetBlock.io Web3 documentation.

This endpoint gets the estimated gas price for executing a transaction in the Aptos blockchain network.

Supported Network

  • Mainnet

Parameter

None

Request

Base URL

https://go.getblock.io/<ACCESS_TOKEN>

Example(cURL)*

curl --location 'https://go.getblock.io/<ACCESS_TOKEN>/v1/estimate_gas_price'

Response Example

{
    "deprioritized_gas_estimate": 100,
    "gas_estimate": 100,
    "prioritized_gas_estimate": 150
}

Response parameter definition

Field

Type

Description

deprioritized_gas_estimate

String

Lower gas price estimate — slower inclusion, suitable for non-urgent txns.

gas_estimate

String

Standard recommended gas price (balanced option).

prioritized_gas_estimate

String

Higher gas price estimate — ensures faster transaction processing.

Use Cases

This method can be used for:

  • Wallets can auto-suggest gas fees based on the user's urgency.

  • dApps can provide a “fast/normal/slow” fee slider to users.

  • Developers can programmatically ensure transactions won’t fail due to low gas.

  • Cost optimisation for batch transactions.

Code example

Node(axios)

Python(Request)

Error handling

Status Code

Error Message

Cause

403

Forbidden

Missing or invalid <ACCESS_TOKEN>.

500

Internal server error

Node or network failure when estimating gas.

Integration with Web3

By integrating /v1/estimate_gas_price into dApp, developers can:

  • Provide real-time fee estimation inside wallets and dApps.

  • Improve transaction confirmation rates by suggesting optimal gas.

  • Enhance user experience with clear trade-offs (fast vs cheap).

  • Avoid failed transactions due to underpriced gas.

Last updated

Was this helpful?