eth_gasPrice and eth_feeHistory RPCs return values in USDC wei (18
decimals). The EWMA fee smoothing model keeps fees predictable—dramatic spikes
are unlikely. Display fees as $X.XX (or ~$0.01), never as “Gwei” or “ETH.”
Prerequisites
Before you begin:- You have an RPC endpoint for Arc.
- You are using an EIP-1559-compatible library (viem, ethers.js, or equivalent).
- You understand that Arc’s native currency is USDC, not ETH.
Steps
Step 1. Fetch the current gas price
Useeth_gasPrice for a single value or eth_feeHistory for historical base
fees and priority fee percentiles.
Step 2. Estimate gas for the transaction
Useeth_estimateGas to determine how much gas your transaction requires.
Step 3. Build EIP-1559 fee parameters
Arc supports EIP-1559 transactions. SetmaxFeePerGas and
maxPriorityFeePerGas:
The effective gas price is
baseFeePerGas + priorityFee. The base fee has a
minimum of 20 Gwei in USDC terms. Because Arc uses an EWMA (exponentially
weighted moving average) model to adjust the base fee gradually, fee spikes
are smoothed out and prices remain predictable.Step 4. Calculate the maximum fee in USD
Multiply the gas limit bymaxFeePerGas, then convert from 18-decimal USDC wei
to a dollar amount.
Step 5. Format fees for display
Show fees as a dollar amount. Use~ to indicate the value is an estimate.