# 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)

