适用于 Openclaw 的 Base Gas

Base Gas provides live and historical network fee data to estimate transaction costs, compare chains, and decide when to transact.

memosr
v1.0.0
2026年10月18日
0
71
0

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install base-gas

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式
~/.openclaw/skills/
工作区
<project>/skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 base-gas。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

更倾向于下载?

获取包含原生技能文件的ZIP压缩包。

什么是 Base Gas?

Base Gas gives AI agents access to live and historical gas data for Base mainnet through x402-protected endpoints. It returns gas prices in gwei and estimated transaction costs in ETH and USD, helping users evaluate transfers, swaps, NFT mints, contract deployments, and other on-chain work.

Beyond current prices, the skill can compare Base with OP Mainnet, Arbitrum, and Ethereum, assess whether gas is cheap or expensive relative to recent history, and identify potentially cheaper hours for transactions. Openclaw Skills users can apply these insights to transaction planning and on-chain workload budgets while checking data coverage before paying for historical queries.

Base Gas 应用场景

  • Check Base gas prices before submitting a transaction.
  • Estimate costs for an ETH or ERC-20 transfer, NFT mint, Uniswap swap, or contract deployment using an operation-specific gas limit.
  • Determine whether current gas is cheap, normal, expensive, or flat compared with a selected historical window.
  • Compare estimated fees across Base, OP Mainnet, Arbitrum, and Ethereum.
  • Find out whether waiting or scheduling a batch transaction is likely to save money.
  • Check historical data coverage before making a paid history or cheapest-window request.
  • Budget gas for recurring transactions or on-chain agent workloads.

Base Gas 工作原理

  1. Check GET /health first to review free history-coverage details, including the number of samples and hours covered.
  2. Choose the endpoint for the question: /gas for current fees, /gas/compare for cross-chain estimates, /gas/history for trends, or /gas/cheapest-window for hourly averages.
  3. If estimating a specific operation, provide its gasLimit; otherwise, the estimate defaults to 21,000 gas units.
  4. Fetch the endpoint with npx agentcash@latest fetch. Paid endpoints use x402; payment settles on Base mainnet in USDC.
  5. Interpret the returned fee and cost fields. For history, use the supplied verdict and verdictNote; for hourly planning, check hasDailyCycle and follow the recommendation.
  6. Make the transaction or schedule it based on the estimate, historical context, data coverage, and whether the potential savings are meaningful.

Base Gas 配置指南

The skill requires npx. For installation and wallet setup, consult the skill's referenced rules/getting-started.md; those details are not included in the supplied SKILL.md. Check the free health endpoint before paying for historical data, then use AgentCash to fetch paid routes.

# Check history coverage for free
curl -s https://base-gas-x402-production.up.railway.app/health

# Fetch the current Base gas estimate
npx agentcash@latest fetch https://base-gas-x402-production.up.railway.app/gas

# Estimate an operation using a custom gas limit
npx agentcash@latest fetch "https://base-gas-x402-production.up.railway.app/gas?gasLimit=180000"

Paid requests settle in USDC on Base mainnet (eip155:8453). Endpoint prices are published in the service's /openapi.json document.

Base Gas 数据架构与分类体系

The skill reads data from the Base Gas x402 service at https://base-gas-x402-production.up.railway.app. It does not describe local files generated by the skill; responses are structured endpoint data.

Endpoint Purpose Key response data
GET /health Free history coverage check samples, hoursCovered, oldestSample, newestSample, sampleIntervalSeconds, retentionHours, durable, lastError, and nextSteps
GET /gas Current Base fees and operation estimate baseFeePerGas, low/medium/high priorityFeePerGas, gasPrice, estimatedTransferCost, blockNumber, and fetchedAt
GET /gas/compare Cross-chain fee comparison chains ranked cheapest first, cheapest, baseRank, baseVsEthereum, and unavailable
GET /gas/history Historical trend for a 1–168-hour window samples, summary (min, max, average, median), currentGasPrice, verdict, verdictNote, and spreadPercent
GET /gas/cheapest-window Hourly averages for a 1–168-hour window hasDailyCycle, recommendation, savingsPercent, hourlyAverages, cheapestHourUtc, and priciestHourUtc

Fee values are reported in gwei, with transaction estimates also available in ETH and USD. The current-gas and comparison routes accept an optional gasLimit (default 21,000). Historical routes include a coverage object; USD estimates can be null if the price feed is unavailable.

Base Gas 高级特性

  • Compare four networks in one /gas/compare request; unavailable chain RPCs are reported without preventing a partial comparison.
  • Price different transaction types by passing a custom gasLimit, such as 65,000 for an ERC-20 transfer, 85,000 for an NFT mint, 180,000 for a swap, or 1,500,000 for a contract deployment.
  • Use historical verdicts (cheap, normal, expensive, or flat) to distinguish a price snapshot from a trend-based decision. The skill advises using verdictNote rather than reinterpreting the verdict.
  • Check hasDailyCycle before relying on hourly rankings; when it is false, hourly timing does not meaningfully differ and the recommendation should guide the decision.
  • Plan batch jobs with avoidHoursUtc, cheapestHourUtc, and savingsUsd.vsAverageHour when those fields are available, and convert UTC when scheduling locally.
  • Reduce unnecessary spend by checking free coverage before history requests, using one comparison request instead of four separate current-price requests, and avoiding polling more than once a minute.
  • Access the service's OpenAPI document at /openapi.json for endpoint specifications and current published prices.

SKILL.md


加载中

Openclaw 相关技能

METADATA

Github Stars: 0
forks: 0

精选*