eth_gasPrice - Arc RPC Method
Get current gas price on Arc. Essential for transaction cost estimation for crossborder settlement, merchant payments, institutional clearing, and USDC-denominated financial applications.
Returns the current gas price on Arc in wei.
Why Arc? Build on Circle's stablecoin-native Layer 1 where USDC is the gas token and BFT consensus gives sub-second deterministic finality with USDC as the native gas token, sub-second irreversible finality, an EWMA-smoothed fee market with a 20 Gwei floor, and EIP-7708 Transfer logs for native value movement.
When to Use This Method
The eth_gasPrice method serves these key scenarios for payment platforms, stablecoin issuers, exchange and treasury teams, and Solidity developers building on Arc:
- Set gas price for legacy transactions - Use the returned wei value as the
gasPricefield in legacy (pre-EIP-1559) transactions on Arc - Monitor network congestion - Track gas price fluctuations to determine the best time to submit transactions for lower fees
- Estimate transaction costs - Multiply gas price by estimated gas units to calculate the total cost before sending any transaction
- Build gas price oracles - Feed real-time gas price data into fee estimation UIs, automated trading bots, and wallet applications
Common Use Cases
1. Calculate Total Transaction Cost
Multiply the current gas price by the estimated gas for a transaction to determine the total cost in the native currency of Arc. This lets users see the expected fee before confirming any transaction.
import { JsonRpcProvider, formatUnits } from 'ethers';
const provider = new JsonRpcProvider('https://api-arc-mainnet.n.dwellir.com/YOUR_API_KEY');
async function calculateTransactionCost(gasLimit) {
const gasPrice = await provider.send('eth_gasPrice', []);
const costWei = BigInt(gasPrice) * BigInt(gasLimit);
const costEth = formatUnits(costWei, 'ether');
console.log(`Gas price: ${formatUnits(gasPrice, 'gwei')} Gwei`);
console.log(`Estimated cost: ${costEth} ETH`);
return costEth;
}
await calculateTransactionCost(21000);2. Build Dynamic Gas Price Strategy
Adjust gas prices dynamically based on current network conditions. During peak congestion on Arc, multiply the base gas price by 1.2-1.5x for faster inclusion; during quiet periods, use the raw gas price for the most economical confirmation.
import { JsonRpcProvider, formatUnits } from 'ethers';
const provider = new JsonRpcProvider('https://api-arc-mainnet.n.dwellir.com/YOUR_API_KEY');
async function getDynamicGasPrice(strategy = 'medium') {
const baseGasPrice = BigInt(await provider.send('eth_gasPrice', []));
const multipliers = { low: 1.0, medium: 1.2, high: 1.5 };
const adjustedPrice = baseGasPrice * BigInt(Math.floor(multipliers[strategy] * 100)) / 100n;
console.log(`Base gas price: ${formatUnits(baseGasPrice, 'gwei')} Gwei`);
console.log(`Strategy (${strategy}): ${formatUnits(adjustedPrice, 'gwei')} Gwei`);
return adjustedPrice;
}
await getDynamicGasPrice('medium');3. Compare Gas Prices Across Chains
If your application supports multiple chains, compare gas prices to route transactions to the most cost-effective network. This is particularly useful for cross-chain bridges and multi-chain DeFi aggregators.
const chains = {
ethereum: 'https://eth.dwellir.com',
polygon: 'https://polygon.dwellir.com',
arbitrum: 'https://arb.dwellir.com'
};
async function compareGasPrices() {
const results = {};
for (const [name, rpcUrl] of Object.entries(chains)) {
const provider = new JsonRpcProvider(rpcUrl);
const gasPrice = await provider.send('eth_gasPrice', []);
results[name] = {
wei: BigInt(gasPrice).toString(),
gwei: Number(BigInt(gasPrice)) / 1e9
};
}
const sorted = Object.entries(results).sort((a, b) => a[1].gwei - b[1].gwei);
console.log('Cheapest chain:', sorted[0][0], '-', sorted[0][1].gwei, 'Gwei');
return results;
}
compareGasPrices();Best Practices
- Legacy gas price is a single number: for EIP-1559 transactions, prefer using
eth_feeHistorycombined witheth_maxPriorityFeePerGasinstead - The return value is in wei: divide by
1e9to convert to gwei, which is the standard unit for gas price display - Consider current network conditions on Arc: multiply by 1.2-1.5x for faster block inclusion during congestion
- Most modern chains use EIP-1559 exclusively: check if Arc supports dynamic fee transactions before relying on legacy gas price
Arc fee market
Arc denominates gas in USDC and replaces Ethereum's per-block EIP-1559 recalculation with an EWMA-smoothed base fee, so quotes move gradually rather than spiking with a single busy block.
| Parameter | Value |
|---|---|
| Minimum base fee | 20 Gwei (protocol floor) |
| Maximum base fee | 20,000 Gwei |
| Base fee target | ~$0.01 per transaction under normal load |
| Gas throughput | 30M gas per block |
| Base fee destination | Paid to the block beneficiary, not burned |
Two consequences matter when you use this value:
- Always clamp to the floor. A quote below 20 Gwei is unusable. Transactions whose
maxFeePerGasis under the floor are dropped by the mempool without an error receipt and never appear in a block. - The next block's base fee is published in advance. Arc writes it into the parent header's
extra_dataas an 8-byte big-endian value, so you can read the upcoming base fee straight from the block header instead of extrapolating.
Because fees are dollar-denominated, show users the USDC cost rather than raw Gwei. See Arc's gas and fees reference for the current parameter set.
Code Examples
Error Handling
| Error Code | Message | Description |
|---|---|---|
| -32603 | Internal error | Node error |
Related Methods
eth_maxPriorityFeePerGas- Get priority fee (EIP-1559)eth_feeHistory- Get historical fee dataeth_estimateGas- Estimate gas needed
eth_estimateGas
Estimate gas required for transactions on Arc. Essential for optimizing transaction costs for crossborder settlement, merchant payments, institutional clearing, and USDC-denominated financial applications.
eth_maxPriorityFeePerGas
Get the suggested priority fee (tip) per gas for EIP-1559 transactions on Arc. Essential for gas estimation, fee optimization, and time-sensitive transaction pricing.