DEV Community

LogicNodes
LogicNodes

Posted on

Migrating Off Blocknative's Gas API Before June 19: A Code-Level Guide

Blocknative's Gas API and Gas Network shut down on June 19, 2026. If you have api.blocknative.com/gasprices/blockprices anywhere in your codebase, that call starts failing in days.

This is the code-level migration guide. We published the announcement earlier; this post covers the exact request/response mapping, what's identical, and — just as important — what's not.

The 30-second migration

Swap the base URL. Drop the auth header. That's it for the core endpoint.

- curl -H "Authorization: $BLOCKNATIVE_KEY" \
-   "https://api.blocknative.com/gasprices/blockprices?chainid=8453"
+ curl "https://logicnodes.io/gasprices/blockprices?chainid=8453"
Enter fullscreen mode Exit fullscreen mode

No signup, no API key. Free tier is 100 calls/day per IP, tracked via the X-Free-Calls-Remaining-Today response header.

JavaScript:

// before
const r = await fetch(
  "https://api.blocknative.com/gasprices/blockprices?chainid=1",
  { headers: { Authorization: process.env.BN_KEY } }
);

// after
const r = await fetch(
  "https://logicnodes.io/gasprices/blockprices?chainid=1"
);
const { blockPrices } = await r.json();
const { maxFeePerGas, maxPriorityFeePerGas } =
  blockPrices[0].estimatedPrices.find(p => p.confidence === 95);
Enter fullscreen mode Exit fullscreen mode

Python:

import requests

r = requests.get(
    "https://logicnodes.io/gasprices/blockprices",
    params={"chainid": 137},
    timeout=10,
)
est = r.json()["blockPrices"][0]["estimatedPrices"]
p95 = next(p for p in est if p["confidence"] == 95)
# p95["maxFeePerGas"], p95["maxPriorityFeePerGas"] — gwei floats
Enter fullscreen mode Exit fullscreen mode

What you get back

Same shape your Blocknative parsing code already expects:

{
  "system": "base",
  "network": "main",
  "unit": "gwei",
  "maxPrice": 0.1131,
  "currentBlockNumber": 47211781,
  "msSinceLastBlock": 662,
  "blockPrices": [
    {
      "blockNumber": 47211782,
      "estimatedTransactionCount": 211,
      "baseFeePerGas": 0.005,
      "estimatedPrices": [
        { "confidence": 99, "price": 0.1126, "maxPriorityFeePerGas": 0.1076, "maxFeePerGas": 0.1131 },
        { "confidence": 95, "price": 0.017,  "maxPriorityFeePerGas": 0.012,  "maxFeePerGas": 0.0175 },
        { "confidence": 90, "price": 0.01,   "maxPriorityFeePerGas": 0.005,  "maxFeePerGas": 0.0105 },
        { "confidence": 80, "price": 0.0085, "maxPriorityFeePerGas": 0.0035, "maxFeePerGas": 0.009 },
        { "confidence": 70, "price": 0.0069, "maxPriorityFeePerGas": 0.0019, "maxFeePerGas": 0.0075 }
      ]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

All five confidence levels (99/95/90/80/70), gwei units, maxFeePerGas / maxPriorityFeePerGas per level — code that indexes into blockPrices[0].estimatedPrices works unchanged.

What's different (read this before you ship)

We'd rather you find out here than in production:

  • One pending block only. blockPrices always has exactly one entry (the next block). Blocknative could return several future blocks. If you read blockPrices[1+], that needs to go.
  • No estimatedBaseFees array. We don't return the multi-block base-fee forecast distribution.
  • Confidence is percentile math, not a simulation platform. Each confidence level maps to an eth_feeHistory reward percentile (99→p99, 95→p95, …) over the last 100 blocks; priority fee is the median of the most recent 20 blocks at that percentile, plus a base-fee headroom buffer derived from 100-block volatility. It's deterministic and you can recompute it from any node — but it is not Blocknative's mempool-simulation model.
  • estimatedTransactionCount is the latest block's transaction count, not a pending-pool prediction.

Supported chains — only these five

chainid network
1 Ethereum
137 Polygon
8453 Base
42161 Arbitrum One
10 Optimism

Any other chainid returns a 400 listing exactly what we serve — no silent fallbacks, no fake coverage. Blocknative served 40+ chains; we don't, and we won't pretend to. If you need a chain we're missing, email hello@logicnodes.io and we'll prioritize it.

Past the free tier

After 100 calls/day from one IP, the endpoint returns 402 with x402 payment instructions: $0.001 USDC per call on Base, passed via an X-Payment-Tx header. No account, no card, no sales call. Or just come back tomorrow.

Verify it yourself

Everything above is reproducible from a public node:

curl -s https://mainnet.base.org -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_feeHistory","params":["0x64","latest",[70,80,90,95,99]]}'
Enter fullscreen mode Exit fullscreen mode

That's the entire upstream data source. The response header X-Data-Source: eth_feeHistory-100-blocks says so on every call.

Links

Eight days left. The URL swap takes less time than reading this post.

Top comments (0)