eth_gasPrice - Optimism RPC Method
Get current gas price on Optimism. Essential for transaction cost estimation for cross-chain DeFi, Superchain-interoperable dApps, and public goods funding recipients.
Returns the current gas price on Optimism in wei.
Why Optimism? Build on the heart of the Superchain powering 60%+ of Ethereum L2 transactions with $6B+ TVL with OP Stack modularity, Superchain interoperability, 17M+ daily transactions across 33 chains, and 20% of tokens for public goods.
Use Cases
The eth_gasPrice method is essential for:
- Transaction pricing - Set appropriate gas prices
- Cost estimation - Calculate transaction costs before sending
- Gas monitoring - Track network congestion
- DeFi operations - Optimize costs for cross-chain DeFi, Superchain-interoperable dApps, and public goods funding recipients
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 Optimism. Essential for optimizing transaction costs for cross-chain DeFi, Superchain-interoperable dApps, and public goods funding recipients.
eth_maxPriorityFeePerGas
Get the suggested priority fee (tip) per gas for EIP-1559 transactions on Optimism. Essential for gas estimation, fee optimization, and time-sensitive transaction pricing.