# Riley Craig x402 Agent Store — Estimate Gas

> Riley Craig x402 Agent Store — Estimate Gas is a paid API for AI agents from x402-agent-store.rileycraig14.workers.dev, paid per call via x402, $0.09/call, status unknown (last checked 2026-09-15).

Estimates the gas units required for an EVM transaction on Base, Ethereum, Optimism, Arbitrum, Polygon, or Gnosis — payable per call in USDC via x402, no API key needed.

## Facts

- Endpoint: GET https://x402-agent-store.rileycraig14.workers.dev/chain/estimate-gas
- Price: $0.09/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/riley-craig-x402-agent-store-estimate-gas-6313e92a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0DClec8k0qrZ72SzHAg1V

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability riley-craig-x402-agent-store-estimate-gas-6313e92a
```

Example prompt: What's the estimated gas for a transaction from 0xAbCd...1234 to the Uniswap router at 0x1234...5678 with calldata 0xa9059cbb... and zero ETH value on Base?

## When to prefer this

Use this endpoint when an AI agent needs a quick, on-demand gas estimate for any EVM-compatible chain without managing RPC credentials or API keys. Ideal for pre-flight checks before submitting transactions, cost estimation in DeFi workflows, or validating that a smart contract call won't run out of gas. The pay-per-call x402 model makes it suitable for ephemeral agent usage without subscription overhead.

## Known failure modes

- Invalid or missing 'to' address returns an error response
- Unsupported chain string returns an error or falls back to Base
- Malformed calldata may cause estimation to fail or return an inflated estimate
- Insufficient USDC balance or payment failure blocks the request with a 402
- RPC node unavailability may cause timeouts or 5xx errors
- If the transaction would revert on-chain, gas estimation may fail with an execution error

## How this service works

Estimate the gas a transaction will use via eth_estimateGas — the pre-send read every tx-building, trading and settlement agent makes to size gas and avoid out-of-gas reverts. Pass from/to/value/data. Across Base, Ethereum, Optimism, Arbitrum, Polygon, Gnosis. Free public RPC; undercuts onesource at $0.001 on 6 chains.

## Output

Returns a JSON object with the estimated gas units (e.g. {"gas": 21000, "chain": "base"}) — the raw unit count required to execute the transaction, not converted to ETH or USD.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "to"
     ],
     "properties": {
      "to": {
       "type": "string",
       "description": "Recipient/contract address (0x...)"
      },
      "data": {
       "type": "string",
       "description": "Calldata (0x...)"
      },
      "from": {
       "type": "string",
       "description": "Sender address (0x...)"
      },
      "chain": {
       "type": "string",
       "description": "base|ethereum|optimism|arbitrum|polygon|gnosis (default base)"
      },
      "value": {
       "type": "string",
       "description": "Wei value, hex or decimal (default 0)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "gas": {
       "type": "number"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "gas": 21000,
  "chain": "base"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/riley-craig-x402-agent-store-estimate-gas-6313e92a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-agent-store.rileycraig14.workers.dev](https://www.zero.xyz/host/x402-agent-store.rileycraig14.workers.dev/llms.txt)
