For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_gasPrice - Celo

Example code for the eth_gasPrice JSON-RPC method. Complete guide on how to use eth_gasPrice JSON-RPC in GetBlock Web3 documentation.

This method returns the current gas price on the Celo network in wei. Celo features extremely low transaction fees (typically sub-cent), making it ideal for micropayments and high-frequency applications. Note: Celo supports fee abstraction, allowing users to pay gas in stablecoins like cUSD.

Parameters

  • None

Returns

Field
Type
Description

result

string

Current gas price in wei as hexadecimal

Request Example

cURL
curl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "eth_gasPrice",
  "params": []
}'
JavaScript (Axios)
const axios = require('axios');

const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';

const payload = {
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'eth_gasPrice',
  params: []
};

axios.post(url, payload, {
  headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

Response Example

Response Parameters

Parameter
Type
Description

result

string

Gas price in wei (0x5d21dba00 = 25 Gwei)

Use Cases

  • Estimate transaction costs

  • Set appropriate gas prices for transactions

  • Monitor network congestion

  • Calculate fee budgets for dApps

  • Compare with stablecoin gas prices (fee abstraction)

Error Handling

Error Code
Description

-32603

Internal error - node processing issues

-32000

Server error - RPC endpoint unavailable

SDK Integration

Last updated

Was this helpful?