blockchain-compare-base
v1.0.0
Published
npm Package - blockchain-compare-base
Readme
blockchain-compare-base
Compare gas prices, transaction speed, and features between NEAR Protocol and Base (Ethereum L2).
Installation
npm install blockchain-compare-base
Usage
import { getNearGasPrice, getBaseGasPrice, compareGas, compareSpeed, compareFeatures, } from 'blockchain-compare-base';
Get Gas Prices
const nearGas = await getNearGasPrice(); // { chain: 'NEAR', gasPriceYocto: '...', gasPriceUsd: 0.00001 }
const baseGas = await getBaseGasPrice(); // { chain: 'Base', gasPriceGwei: 0.05, gasPriceUsd: 0.0012 }
Compare Gas
const gasComparison = await compareGas(); console.log(gasComparison); // { near: {...}, base: {...}, nearSavingsPercent: 95, winner: 'NEAR' }
Compare Speed
const speedComparison = await compareSpeed(); console.log(speedComparison); // { near: { chain: 'NEAR', avgBlockTimeMs: 1000, finalityMs: 2000 }, base: {...}, winner: '...' }
Compare Features
const features = await compareFeatures();
features.forEach(f => {
console.log(${f.feature}: winner is ${f.winner});
});
// { feature: 'Account Model', near: 'Human-readable named accounts', base: 'Hex addresses only', winner: 'NEAR' }
API
| Function | Returns |
|---|---|
| getNearGasPrice() | Promise<{ chain, gasPriceYocto, gasPriceUsd }> |
| getBaseGasPrice() | Promise<{ chain, gasPriceGwei, gasPriceUsd }> |
| compareGas() | Promise<GasComparison> |
| compareSpeed() | Promise<SpeedComparison> |
| compareFeatures() | Promise<FeatureComparison[]> |
License
MIT
