eth_gasPrice
Get the current gas price on Avalanche C-Chain network.
Parameters
This method accepts no parameters.
{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}
Returns
QUANTITY
- Integer of the current gas price in wei (nAVAX).
- Type: Hexadecimal string
- Format:
0x
prefixed - Unit: Wei (1 AVAX = 10^18 wei)
Implementation Example
- cURL
- JavaScript
curl -X POST https://api-avalanche-mainnet-archive.n.dwellir.com/YOUR_API_KEY/ext/bc/C/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
const response = await fetch('https://api-avalanche-mainnet-archive.n.dwellir.com/YOUR_API_KEY/ext/bc/C/rpc', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_gasPrice',
params: [],
id: 1
})
});
const data = await response.json();
const gasPriceWei = parseInt(data.result, 16);
console.log('Gas price:', gasPriceWei, 'wei');
Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5d21dba00"
}
Note: Gas prices on Avalanche are typically lower than Ethereum mainnet, enabling cost-effective transactions.
Need help? Contact our support team or check the Avalanche documentation.