Gas API
Gain access to the same Gas API used by MetaMask to power the gas fee estimation feature for millions of users.
What is the Gas API?
The Gas API is a powerful tool designed to provide real-time gas prices for supported networks. It serves as an oracle, offering up-to-date information on the computational costs associated with executing operations or transactions on Ethereum Virtual Machine (EVM) compatible chains.
The Gas API helps users determine the optimal time to execute a transaction based on current gas prices. This is especially important after the implementation of EIP-1559, which introduced more specific gas price parameters, making the calculation of transaction costs more complex.
Why use the Gas API?
Use the Gas API to gain real-time insights into the gas market. The API can help you make informed decisions about when to execute transactions and how much to pay for transaction fees, optimizing your transactions for speed and cost-effectiveness. The API allows you to access recommended gas prices based on your transaction's priority requirements, ensuring that your transactions get included in a block.
Using insights from the Gas API can save you time and money while ensuring that your transactions are processed quickly and efficiently.
See the following tutorials to learn how to use the Gas API:
- Mastering the Gas API: A Guide for Developers
- How to Build a Simple Gas Tracker App with Gas API and Next.js
Which networks are supported?
Refer to the supported networks section for an up-to-date list of supported networks and chain IDs.