Onchain Query API · GAS

by Onchain Query API

GETBase

$0.002

per call · USD Coin on Base

Live gas market on any major EVM chain: current gas price, base fee and priority-fee percentiles (p25/p50/p75) in gwei, plus the estimated cost in native token and USD for a plain transfer (21k gas) and a typical DEX swap (200k gas). Lets an agent decide whether a transaction is worth sending right now or should wait for cheaper gas, and budget the fee before signing.

Endpoint

GET https://chain.cyberwarex.com/gas

3

Calls / 30d

1

Unique payers / 30d

Sep 1

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://chain.cyberwarex.com/gas", {
  method: "GET",
});
const data = await res.json();
cURL
curl -X GET \
  "https://chain.cyberwarex.com/gas?chain=base" \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "base_fee_gwei": 0.004119,
  "chain": "base",
  "est_cost": {
    "swap_200k": {
      "native": 0.000001127,
      "usd": 0.003599
    },
    "transfer_21k": {
      "native": 1.18e-7,
      "usd": 0.000377
    }
  },
  "gas_price_gwei": 0.008312,
  "native": "ETH",
  "native_usd": 3194.51,
  "priority_fee_gwei": {
    "p25": 0.001,
    "p50": 0.0015,
    "p75": 0.0031
  }
}

Payment details

Pay to0x058d0cc5cc97e61e8a9f38d6d6365bce525921b2
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Onchain Data and the homepage with a featured placement.

Get featured →

More from Onchain Query API & similar services