GET /leokit/gas-price/[asset]
Get current or historical gas prices for a specific chain.Request
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 thegas_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)
- 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_pricestable - 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:Gas Price Trends
Analyze historical gas prices to recommend optimal transaction timing:Chart Visualization
Display gas price trends over time:Best Practices
- Cache Responses: Gas prices don’t change every second - cache for 10-30 seconds
- Handle Both Types: Always check the
typefield and handle both “fixed” and “dynamic” responses - Current Price: For dynamic prices, the first array entry
gas_prices[0][0]is the most recent - Error Handling: Implement fallback values if the endpoint is unavailable
- Display Units: Always show the
unitsfield to users for clarity