- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
132 lines
2.5 KiB
Markdown
132 lines
2.5 KiB
Markdown
# Gas API Location and Configuration
|
|
|
|
**Date**: $(date)
|
|
**Purpose**: Guide to finding and using the Gas API
|
|
|
|
---
|
|
|
|
## 📍 Gas API Script Location
|
|
|
|
### Primary Script
|
|
**Path**: `/home/intlc/projects/smom-dbis-138/scripts/deployment/get-multichain-gas-prices.sh`
|
|
|
|
This script fetches real-time gas prices from configured APIs.
|
|
|
|
---
|
|
|
|
## 🔧 Configuration
|
|
|
|
### Environment Variables
|
|
|
|
The Gas API is configured in the `.env` file at:
|
|
**Path**: `/home/intlc/projects/smom-dbis-138/.env`
|
|
|
|
#### Required (for Ethereum Mainnet)
|
|
```bash
|
|
ETHERSCAN_API_KEY=your_etherscan_api_key_here
|
|
```
|
|
|
|
#### Optional (Alternative)
|
|
```bash
|
|
INFURA_GAS_API=your_infura_api_key_here
|
|
# OR
|
|
INFURA_GAS_API=https://gas.api.infura.io/networks/1/suggestedGasFees
|
|
```
|
|
|
|
---
|
|
|
|
## 🌐 API Endpoints
|
|
|
|
### 1. Etherscan Gas API v2 (Primary)
|
|
**Endpoint**:
|
|
```
|
|
https://api.etherscan.io/v2/api?chainid=1&module=gastracker&action=gasoracle&apikey={API_KEY}
|
|
```
|
|
|
|
**Usage**:
|
|
```bash
|
|
curl -s "https://api.etherscan.io/v2/api?chainid=1&module=gastracker&action=gasoracle&apikey=${ETHERSCAN_API_KEY}"
|
|
```
|
|
|
|
**Response Format**:
|
|
```json
|
|
{
|
|
"status": "1",
|
|
"message": "OK",
|
|
"result": {
|
|
"LastBlock": "...",
|
|
"SafeGasPrice": "...",
|
|
"ProposeGasPrice": "...",
|
|
"FastGasPrice": "...",
|
|
"suggestBaseFee": "...",
|
|
"gasUsedRatio": "..."
|
|
}
|
|
}
|
|
```
|
|
|
|
### 2. Infura Gas API (Alternative)
|
|
**Endpoint**:
|
|
```
|
|
https://gas.api.infura.io/networks/1/suggestedGasFees
|
|
```
|
|
|
|
**Usage**:
|
|
```bash
|
|
curl -s "https://gas.api.infura.io/networks/1/suggestedGasFees"
|
|
```
|
|
|
|
---
|
|
|
|
## 📋 Usage
|
|
|
|
### Get Gas Prices for All Chains
|
|
```bash
|
|
cd /home/intlc/projects/smom-dbis-138
|
|
bash scripts/deployment/get-multichain-gas-prices.sh
|
|
```
|
|
|
|
### Update Gas Estimates
|
|
```bash
|
|
cd /home/intlc/projects/smom-dbis-138
|
|
bash scripts/deployment/update-gas-estimates.sh
|
|
```
|
|
|
|
---
|
|
|
|
## 📚 Documentation
|
|
|
|
### Related Documents
|
|
- `docs/deployment/GAS_API_INTEGRATION_SUMMARY.md` - Integration details
|
|
- `docs/deployment/REAL_TIME_GAS_SYSTEM.md` - Real-time gas system
|
|
- `docs/deployment/REAL_TIME_GAS_UPDATES.md` - How to update gas prices
|
|
- `docs/deployment/CURRENT_GAS_PRICES.md` - Current gas price reference
|
|
|
|
---
|
|
|
|
## 🔍 Quick Reference
|
|
|
|
### Script Location
|
|
```
|
|
/home/intlc/projects/smom-dbis-138/scripts/deployment/get-multichain-gas-prices.sh
|
|
```
|
|
|
|
### Configuration Location
|
|
```
|
|
/home/intlc/projects/smom-dbis-138/.env
|
|
```
|
|
|
|
### API Key Variable
|
|
```
|
|
ETHERSCAN_API_KEY
|
|
```
|
|
|
|
### API Endpoint
|
|
```
|
|
https://api.etherscan.io/v2/api?chainid=1&module=gastracker&action=gasoracle&apikey={KEY}
|
|
```
|
|
|
|
---
|
|
|
|
**Last Updated**: $(date)
|
|
|