/v1/estimate_gas_price
This endpoint gets the estimated gas price for executing a transaction in the Aptos blockchain network.
Supported Network
- Mainnet
Parameter
None
Request
Base URL
bashhttps://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>Example(cURL)*
curlcurl --location 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/v1/estimate_gas_price'Response Example
json{
"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)
jsconst axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/v1/estimate_gas_price',
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Python(Request)
pythonimport requests
url = "https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/v1/estimate_gas_price"
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)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.