A multi-chain gas estimation agent that compares real-time gas costs across Tempo L1, Ethereum, Arbitrum, and Base.
- ✅ Compare gas costs across 4+ chains
- ✅ Real-time gas price queries
- ✅ USD cost estimation
- ✅ Support for multiple operations (transfer, swap, deploy, etc.)
- ✅ Smart recommendation for cheapest chain
- ✅ 15-second caching (configurable)
- ✅ Graceful RPC failure handling
# Install dependencies
npm install
# Run development server
npm run dev
# Run tests
npm test
# Run CLI
npx ts-node src/cli.ts simple-transfer| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/estimate/:operation |
GET | Get estimate for specific operation |
/estimate-all |
GET | Get estimates for all operations |
/operations |
GET | List supported operations |
/clear-cache |
POST | Clear estimation cache |
/cache-ttl |
POST | Update cache TTL |
{
"operation": "simple-transfer",
"estimates": [
{
"chain": "Tempo L1",
"gasPrice": "0.00 gwei",
"gasPriceGwei": 0,
"costUsd": 0,
"speed": "2s",
"blockTime": 2
},
{
"chain": "Arbitrum",
"gasPrice": "0.10 gwei",
"gasPriceGwei": 0.1,
"costUsd": 0.0012,
"speed": "2s",
"blockTime": 2
},
{
"chain": "Base",
"gasPrice": "0.05 gwei",
"gasPriceGwei": 0.05,
"costUsd": 0.0006,
"speed": "2s",
"blockTime": 2
},
{
"chain": "Ethereum",
"gasPrice": "25.00 gwei",
"gasPriceGwei": 25,
"costUsd": 1.8375,
"speed": "12s",
"blockTime": 12
}
],
"recommendation": "Tempo L1 offers the lowest cost at $0.0000 with 2s confirmation time.",
"timestamp": 1708901234567
}# RPC URLs (optional - defaults to public endpoints)
TEMPO_RPC=https://rpc.tempo.io
ETH_RPC=https://eth.llamarpc.com
ARB_RPC=https://arb1.arbitrum.io/rpc
BASE_RPC=https://mainnet.base.org
# Server
PORT=3000simple-transfer- Simple ETH/Token transfer (21,000 gas)erc20-transfer- ERC-20 token transfer (65,000 gas)contract-deploy- Smart contract deployment (2,000,000 gas)swap- DEX token swap (150,000 gas)nft-mint- NFT minting (150,000 gas)
# Run all tests
npm test
# Run with coverage
npm test -- --coverage
# Run specific test
npm test -- gas-estimator# Estimate specific operation
npx ts-node src/cli.ts simple-transfer
# Estimate all operations
npx ts-node src/cli.ts all
# Show help
npx ts-node src/cli.tsTo register this agent on the PayPol marketplace:
import { PayPolSDK } from '@paypol/sdk';
const sdk = new PayPolSDK({
apiKey: process.env.PAYPOL_API_KEY,
});
await sdk.registerAgent({
name: 'Gas Estimator',
description: 'Multi-chain gas cost comparison agent',
endpoint: 'http://localhost:3000',
operations: ['simple-transfer', 'erc20-transfer', 'contract-deploy'],
});MIT