eth_gasPrice - Arbitrum
Example code for the eth_gasPrice json-rpc method. Сomplete guide on how to use eth_gasPrice json-rpc in GetBlock.io Web3 documentation.
This method gets the current average gas price on the Arbitrum network. This value is derived from recent transactions and can be used as a baseline for setting transaction fees.
Parameters
None
Request
curl --location 'https://go.getblock.us/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"id": "getblock.io",
"params": [],
}'import axios from 'axios'
let data = JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"id": "getblock.io",
"params": [],
};
let config = {
method: "post",
maxBodyLength: Infinity,
url: "https://go.getblock.us/<ACCESS_TOKEN>",
headers: {
"Content-Type": "application/json",
},
data: data,
};
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0x989680"
}Reponse Parameter Definition
result
string (hex)
Current average gas price in wei
Use case
eth_gasPrice is used to:
Determines the baseline cost for sending transactions
Allows wallets to calculate estimated fees
Helps dApps display up-to-date network fees
Useful for automated bots adjusting to network congestion
Let's developers optimize cost-sensitive interactions such as bridging, swapping, or minting
Error handling
403
Forbidden
Missing or invalid ACCESS_TOKEN.
Integration with Web3
The eth_gasPrice can help developers:
Display real-time gas prices in interfaces
Adjust transaction fees automatically
Improve user experience during times of congestion
Support trustless fee estimation without relying on third-party APIs
Last updated
Was this helpful?