APIs used:
  • Get gas prices  


Welcome to our guide on using the Covalent API to get real-time gas estimates for various transaction speeds on specific networks. This functionality is crucial for users looking to optimize transaction costs and confirmation times for different event types, including ERC20 token transfers, native tokens transfers, and Uniswap V3 swap events.

What is Gas in Cryptocurrency Transactions?

In Web3, "gas" refers to the fee required to successfully conduct a transaction or execute a contract on the Ethereum network. This term is also used for most other blockchain networks, although some have their own naming conventions. The gas fee is paid in the native currency of the blockchain network, e.g. Ether (ETH) on Ethereum. Gas prices are denominated in Gwei and can fluctuate based on network demand. High gas prices can lead to expensive transactions, whereas low gas prices can result in slower transaction confirmations.

The Covalent API Endpoint for Gas Prices

Get gas prices


Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times.

Supported Chains and Event Types

  • Supported Chains: The API currently supports all 200+ networks indexed by Covalent.

  • Event Types: The endpoint caters to ERC20 transfer events, Uniswap V3 swap events, and native tokens transfers.

Query Parameters

  • quote-currency: This parameter allows users to get gas prices in different fiat currencies, such as USD, CAD, EUR, and more, providing a global perspective on transaction costs.

Getting Started: Installation

Before you start, install the Covalent client SDK:

npm install @covalenthq/client-sdk

Making a Request for Gas Prices

To fetch gas prices, use the following code from the Covalent TypeScript SDK:

import { CovalentClient } from "@covalenthq/client-sdk";

const ApiServices = async () => {
    const client = new CovalentClient("Your_API_Key_Here");
    const resp = await client.BaseService.getGasPrices("eth-mainnet");

Remember to replace "Your_API_Key_Here" with the actual API key, or more likely your .env file.

Understanding the Response

Here is a sample response for what this API returns when querying Uniswap V3 swap events on Ethereum. In this example, the quote currency is set to USD, and we can see the average gas price for the past 1 minute, 3 minute and 5 minute time frames.

	data: {
		updated_at: "2024-02-23T18:36:32.833681102Z",
		chain_id: 1,
		chain_name: "eth-mainnet",
		event_type: "uniswapv3",
		gas_quote_rate: 2945.376708984375,
		quote_currency: "USD",
		base_fee: "36643968777",
		items: [
				gas_price: "39101851588",
				gas_spent: "196739",
				gas_quote: 22.65836825300664,
				other_fees: {
					l1_gas_quote: null
				total_gas_quote: 22.65836825300664,
				pretty_total_gas_quote: "$22.66",
				interval: "Last 1 minute"
				gas_price: "38721358926",
				gas_spent: "197318",
				gas_quote: 22.503918356423565,
				other_fees: {
					l1_gas_quote: null
				total_gas_quote: 22.503918356423565,
				pretty_total_gas_quote: "$22.50",
				interval: "Last 3 minutes"
				gas_price: "38346420580",
				gas_spent: "194294",
				gas_quote: 21.944468613845196,
				other_fees: {
					l1_gas_quote: null
				total_gas_quote: 21.944468613845196,
				pretty_total_gas_quote: "$21.94",
				interval: "Last 5 minutes"
		error: false,
		error_message: null,
		error_code: null

Use Cases and Applications

This endpoint allows users optimize the timing and costs of their transactions. This is useful for developers optimizing their applications, or users who can see real-time gas price functionality in their wallet. Additionally, analysts can gain insights into network congestion and transaction costs over time.

Pricing and Limits

Using this endpoint costs 1.00 Credit per request. Be mindful of your usage to stay within your plan's limits.


Covalent’s gas price endpoint is a robust tool for anyone engaged in Web3 development. It provides critical information to optimize transaction costs and times, enhancing the overall efficiency of blockchain operations.