Cheapest rail right now

Where should an agent transact this minute? Live gas on Ethereum + every major L2 side by side, Base gas tiers, a fee estimate for your transaction type, and ETH spot to price it all in dollars.

$0.009 per call · one payment for the whole workflow
POST /api/skill/cheapest-rail
Sample output + API docs →

4 tools run server-side in one request. You pay once, settle once, and get a single response - no orchestration, no per-step payments, and a partial-success envelope if any step fails. USDC over x402 on any supported chain.

When to use this pack

An agent about to do REAL onchain work - deploy a contract, move funds, batch-settle, mint - wants to pick the chain and the moment. Gas varies 10-100x between Ethereum and its L2s and swings hour to hour; eyeballing four gas trackers is human work. One call returns the cross-chain comparison, the chosen chain's slow/standard/fast tiers, a per-transaction-type estimate, and the ETH price to convert gwei into dollars. (x402 tool payments themselves are gasless - this pack is for everything else an agent does on-chain.)

Tools in this pack

All 4 run inside the single $0.009 call above. Each is also callable on its own if you only need one part.

Bought one at a time, these 4 tools cost $0.009 together; the pack is that sum less a 10% bundle discount, rounded up to the $0.001 settlement floor, which is $0.009.

Workflow

  1. l2-gas-comparison with {networks: ["ethereum", "base", "arbitrum", "optimism", "polygon"]} - one row per chain with current gas. This is the headline: sort ascending and you have the cheapest venue.
  2. gas-snapshot with {network: <the winner>} - slow/standard/fast tiers on the chosen chain. If your action is deferrable, the slow tier is often half the fast tier; note the spread.
  3. gas-estimate for your transaction type on that chain - a simple transfer, an ERC-20 transfer, and a contract deploy differ by an order of magnitude in gas units; this converts 'gwei is low' into 'this action costs N'.
  4. crypto-price with {coins: "ETH", currency: "usd"} - multiply units × price × ETH spot to state the cost in dollars, which is the number a budget check actually wants.
  5. Report: { cheapest: <chain>, comparison: [...], tiers: {...}, estimatedCostUsd, decision: 'act now on <chain>' | 'defer - spread suggests off-peak in a few hours' }.

Arguments

NameRequiredDescriptionExample
networksnoComma-separated chains to compare (default: ethereum,base,arbitrum,optimism,polygon)ethereum,base,arbitrum,optimism,polygon

What one call returns

A JSON object with pack, args, steps, summary; steps holds one entry per tool (l2-gas-comparison, gas-snapshot, gas-estimate, crypto-price), each with its own result or error. Full example on the API page.

Call it directly

Any x402 client pays the 402 and gets the whole workflow back in one response:

npx agent402-client call cheapest-rail {"networks":"ethereum,base,arbitrum,optimism,polygon"}

Run it in Claude

claude mcp add agent402 -s user -- npx -y agent402-mcp@latest

Then paste this prompt into Claude:

Find the cheapest chain for an ERC-20 transfer right now using Agent402 (networks: ethereum,base,arbitrum,optimism,polygon): (1) l2-gas-comparison with that network list - sort by gas ascending. (2) gas-snapshot {network: <cheapest>} - read the standard tier. (3) gas-estimate on that network for an ERC-20 transfer. (4) crypto-price {coins: "ETH", currency: "usd"} - express the final cost in USD. Return {cheapest, gasStandard, estimatedCostUsd, comparison}.

← All skill packs