agentleFS
vaquarkhanvaquarkhan/web3-agent-skills/skills/skill-12-gas-optimization/SKILL.md

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.

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
  1. Distinctive:

    Use 75th percentile of priority fees

    line 32
  2. Distinctive:

    Use nonce manager for parallel txs (increment locally, track pending)

    line 38
  3. Distinctive:

    Use private submission for swaps, liquidations, and any MEV-exposed operation.

    line 50

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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
  1. Fetch eth_feeHistory for last 10 blocks
  2. Use 75th percentile of priority fees
  3. On L2s (Arbitrum, Base, Optimism): use L1 data fee + L2 execution fee

Nonce Management

  • Query eth_getTransactionCount with pending tag
  • 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

NetworkMethod
EthereumFlashbots Protect RPC, MEV-Share
PolygonFastlane private RPC
Base/ArbitrumSequencer 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 * blobGasPrice

Monitor excessBlobGas in block header for fee spikes.

L2 Gas Notes

ChainGas TokenNotes
ArbitrumETHL1 calldata cost dominates
OptimismETHL1 fee + L2 fee split
BaseETHOP Stack, similar to Optimism
PolygonPOLLow base fees, occasional spikes

References

  • references/fee-oracles.md — RPC methods and fallback APIs

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.