skill-12-gas-optimization
Skill2 starsChanged 6 months agoMITView on GitHub
Optimizes transaction gas via EIP-1559 fee prediction, nonce management, private transaction submission, and EIP-4844 blob fee handling. Use when estimating fees, fixing stuck transactions, or submitting MEV-sensitive txs.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/00-web3-agent-core.mdcCursor rule
- .cursor/rules/10-guardrails-first.mdcCursor rule
- .cursor/rules/20-chain-preset-selector.mdcCursor rule
- .cursor/rules/30-simulate-before-send.mdcCursor rule
- skill-01-wallet-managementSkill
- skill-02-smart-contract-interactionSkill
- skill-03-defi-operationsSkill
- skill-04-nft-managementSkill
- skill-05-dao-governanceSkill
- skill-06-cross-chain-bridgeSkill
- skill-07-token-analyticsSkill
- skill-08-security-auditSkill
- skill-09-compliance-amlSkill
- skill-10-identity-didSkill
- skill-11-oracle-data-feedsSkill
- skill-13-rwa-tokenizationSkill
- skill-14-social-reputationSkill
- skill-15-mev-protectionSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Use 75th percentile of priority fees
- Distinctive: line 38
Use nonce manager for parallel txs (increment locally, track pending)
- Distinctive: line 50
Use private submission for swaps, liquidations, and any MEV-exposed operation.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Gas Optimization
When to Use
- Estimating transaction costs before execution
- Managing nonces for sequential or parallel txs
- Submitting private transactions (Flashbots, MEV-Share)
- Handling EIP-4844 blob transactions (L2 data availability)
- Recovering stuck transactions (speed up / cancel)
Prerequisites
- MCP:
blockchain-rpc-server - Skill-15 for private tx routing on mainnet swaps
EIP-1559 Fee Strategy
maxPriorityFeePerGas = baseFee * 0.1 (min 1 gwei on Ethereum)
maxFeePerGas = baseFee * 2 + maxPriorityFeePerGas- Fetch
eth_feeHistoryfor last 10 blocks - Use 75th percentile of priority fees
- On L2s (Arbitrum, Base, Optimism): use L1 data fee + L2 execution fee
Nonce Management
- Query
eth_getTransactionCountwithpendingtag - Use nonce manager for parallel txs (increment locally, track pending)
- Cancel: send 0 ETH self-transfer with same nonce, +20% gas
- Speed up: resubmit with same nonce, +15% maxFeePerGas
Private Transactions
| Network | Method |
| Ethereum | Flashbots Protect RPC, MEV-Share |
| Polygon | Fastlane private RPC |
| Base/Arbitrum | Sequencer private orderflow (limited) |
Use private submission for swaps, liquidations, and any MEV-exposed operation.
Blob Fees (EIP-4844)
For rollup batch submissions or blob-carrying txs:
blobGasPrice = getBlobBaseFee()
totalBlobCost = blobGasUsed * blobGasPriceMonitor excessBlobGas in block header for fee spikes.
L2 Gas Notes
| Chain | Gas Token | Notes |
| Arbitrum | ETH | L1 calldata cost dominates |
| Optimism | ETH | L1 fee + L2 fee split |
| Base | ETH | OP Stack, similar to Optimism |
| Polygon | POL | Low base fees, occasional spikes |
References
references/fee-oracles.md— RPC methods and fallback APIs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

