gas-oracle
Predicts L2 gas costs several blocks ahead using post–EIP-4844 blob base fee dynamics—useful for wallets and DeFi that otherwise over- or under-shoot on estimates.
Chains: Arbitrum One, Optimism, Base, Scroll. See the repo README for RPC requirements and env configuration.
Quick start
npm install
npm run build
npx gas-oracle predict --chain arbitrum --blocks 10
Why it exists
L2 fees track the L1 blob base fee market. That market is volatile and auction-driven, so naïve “current fee” estimates are often wrong. gas-oracle smooths recent history, fits a short horizon trend, and returns a prediction plus a confidence score.
As a library
import { GasOracle } from '@kcolbchain/gas-oracle'
const oracle = new GasOracle({
l1Rpc: 'https://eth.llamarpc.com',
chain: 'arbitrum',
l2Rpc: 'https://arb1.arbitrum.io/rpc',
})
const prediction = await oracle.predict({ blocksAhead: 10 })
// { gasPrice, blobFee, confidence, blocksAhead }
Architecture
L1 RPC (blob base fee history)
↓
Fetcher → last N blocks of blob fees + L2 gas samples
↓
Predictor → EMA + linear regression + confidence band
↓
Chain adapter → chain-specific L2 fee formula
↓
Prediction
License
MIT. Issues and PRs: github.com/kcolbchain/gas-oracle.