optimizing-gas-fees
Optimize blockchain gas costs by analyzing prices, patterns, and timing. Use when checking gas prices, estimating costs, or finding optimal windows. Trigger with phrases like "gas prices", "optimize gas", "transaction cost", "when to transact".
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 2.0k
- Forks
- 233
01 前言 Front Matter
- name
- optimizing-gas-fees
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Optimize blockchain gas costs by analyzing prices, patterns, and timing. Use when checking gas prices, estimating costs, or finding optimal windows. Trigger with phrases like "gas prices", "optimize gas", "transaction cost", "when to transact".
- allowed-tools
- Read, Bash(python3 *)
02 资源文件 11
- 参考文档ARD.md4.9 KB
- 参考文档config/settings.yaml3.2 KB
- 参考文档PRD.md2.7 KB
- 参考文档references/errors.md2.8 KB
- 参考文档references/examples.md7.0 KB
- 参考文档references/implementation.md1.3 KB
- 脚本scripts/cost_estimator.py7.5 KB
- 脚本scripts/formatters.py7.1 KB
- 脚本scripts/gas_fetcher.py10.9 KB
- 脚本scripts/gas_optimizer.py11.4 KB
- 脚本scripts/pattern_analyzer.py11.0 KB
03 SKILL.md 正文
Optimizing Gas Fees
Overview
Gas fee optimization skill that:
- Fetches real-time gas prices from multiple sources
- Estimates transaction costs in ETH and USD
- Analyzes historical patterns to find optimal timing
- Predicts future gas prices
- Compares gas across multiple chains
Prerequisites
- Python 3.8+ with requests library
- Network access to RPC endpoints
- Optional:
ETHERSCAN_API_KEYfor higher rate limits - Optional: Custom RPC URLs via environment variables
Instructions
1. Check Current Gas Prices
cd {baseDir}/scripts && python3 gas_optimizer.py current
For specific chain:
cd {baseDir}/scripts && python3 gas_optimizer.py current --chain polygon
2. Estimate Transaction Cost
For known operations:
cd {baseDir}/scripts && python3 gas_optimizer.py estimate --operation uniswap_v2_swap --all-tiers
For custom gas limit:
cd {baseDir}/scripts && python3 gas_optimizer.py estimate --gas-limit 150000 --tier fast
Available operations: eth_transfer, erc20_transfer, erc20_approve, uniswap_v2_swap, uniswap_v3_swap, sushiswap_swap, curve_swap, nft_mint, nft_transfer, opensea_listing, aave_deposit, aave_withdraw, compound_supply, compound_borrow, bridge_deposit
3. Find Optimal Transaction Window
cd {baseDir}/scripts && python3 gas_optimizer.py optimal
4. View Gas Patterns
Hourly patterns:
cd {baseDir}/scripts && python3 gas_optimizer.py patterns
Daily patterns:
cd {baseDir}/scripts && python3 gas_optimizer.py patterns --daily
5. Predict Future Gas
cd {baseDir}/scripts && python3 gas_optimizer.py predict --time 14
6. Compare Chains
cd {baseDir}/scripts && python3 gas_optimizer.py compare
7. View Base Fee History
cd {baseDir}/scripts && python3 gas_optimizer.py history --blocks 50
Output
- Current: Base fee, priority fee, and tier prices (slow/standard/fast/instant)
- Estimate: Gas cost in native token and USD for each tier
- Patterns: Historical hourly/daily patterns with low-gas markers
- Optimal: Recommended transaction window with expected savings
- Predict: Gas forecast for specific time with confidence
- Compare: Side-by-side gas prices across chains
Supported Chains
| Chain | Native Token | Block Time |
|---|---|---|
| Ethereum | ETH | ~12 sec |
| Polygon | MATIC | ~2 sec |
| Arbitrum | ETH | ~0.25 sec |
| Optimism | ETH | ~2 sec |
| Base | ETH | ~2 sec |
Price Tiers
| Tier | Percentile | Confirmation Time |
|---|---|---|
| Slow | 10th | 10+ blocks (~2+ min) |
| Standard | 50th | 3-5 blocks (~1 min) |
| Fast | 75th | 1-2 blocks (~30 sec) |
| Instant | 90th | Next block (~12 sec) |
Error Handling
See {baseDir}/references/errors.md for:
- RPC connection issues
- API rate limiting
- Price feed errors
- Pattern analysis errors
Examples
See {baseDir}/references/examples.md for:
- Quick start commands
- Cost estimation scenarios
- Multi-chain comparison
- Practical workflows
Resources
- EIP-1559 - Fee market specification
- Etherscan Gas Tracker - Reference oracle
- L2Fees - L2 cost comparison
04 同仓库更多 Skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
neuropixels-analysis
Neuropixels neural recording analysis. Load SpikeGLX/OpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen/IBL curation, AI-assisted visual analysis, for Neuropixels 1.0/2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
notebooklm
Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.