Skip to main content

GET /leokit/gas-price/[asset]

Get current or historical gas prices for a specific chain.

Request

OR
Path Parameter: Chain name or asset identifier (e.g., “ETH”, “BTC”, “BTC.BTC”)

Response Formats

The API returns different response formats based on the chain’s pricing model.

Fixed Price Chains (Cosmos)

For Cosmos-based chains with fixed gas prices.

Response

Status Code: 200 OK

Fixed Price Chains

Response Fields

Dynamic Price Chains (EVM, UTXO)

For chains with variable gas prices.

Response

Status Code: 200 OK

Response Fields

Gas Prices Array Format

Each entry in the gas_prices array is a tuple:
  • price (number): Gas price in specified units
  • timestamp (number): Unix timestamp
  • ordering: Descending by timestamp (most recent first)
  • limit: Last 200 entries

Units by Chain

Different chains use different units for gas pricing: EVM Chains (gwei):
  • ETH (Ethereum)
  • ARB (Arbitrum)
  • AVAX (Avalanche)
  • BSC (Binance Smart Chain)
  • BASE (Base)
  • POLYGON (Polygon)
  • OPTIMISM (Optimism)
  • FANTOM (Fantom)
UTXO Chains:
  • Bitcoin: satoshi/vbyte
  • Litecoin: satoshi/vbyte
  • Dogecoin: shibes/vbyte

Example Responses

Ethereum (Dynamic)

Bitcoin (Dynamic)

THORChain (Fixed)

Cosmos Hub (Fixed)

Data Source

  • Database: Fetched from gas_prices table
  • Updates: Periodically updated by background workers
  • Historical Data: Available for trend analysis and prediction
  • Retention: Last 200 data points per chain

Use Cases

Estimating Transaction Costs

Use gas prices to calculate estimated transaction fees before initiating a swap:
Analyze historical gas prices to recommend optimal transaction timing:

Chart Visualization

Display gas price trends over time:

Best Practices

  1. Cache Responses: Gas prices don’t change every second - cache for 10-30 seconds
  2. Handle Both Types: Always check the type field and handle both “fixed” and “dynamic” responses
  3. Current Price: For dynamic prices, the first array entry gas_prices[0][0] is the most recent
  4. Error Handling: Implement fallback values if the endpoint is unavailable
  5. Display Units: Always show the units field to users for clarity

Error Responses

Unsupported Chain (404)
Invalid API Key (403)