A simple JavaScript-based gas fee estimator for Ethereum transactions using the EIP-1559 model. This tool calculates the estimated gas fees based on user inputs for the base fee, priority fee (tip), and gas limit.
EIP-1559 introduced a new fee structure for Ethereum, making gas fee estimation more predictable. This tool helps users estimate the total gas fees for their transactions by allowing them to input the base fee, priority fee (tip), and gas limit.
- Calculate gas fees using the EIP-1559 model
- Accepts user inputs for base fee, priority fee, and gas limit
- Outputs gas fees in both gwei and ETH
EIP-1559 includes three main components that affect gas fees:
- Base Fee: The minimum fee required to include a transaction in a block, which adjusts based on network demand.
- Priority Fee (Tip): An optional fee to incentivize miners to prioritize your transaction.
- Gas Limit: The maximum amount of gas units a transaction can consume.
For more details, refer to the official EIP-1559 documentation.
- A basic understanding of JavaScript
- A code editor like Visual Studio Code
No installation is required for this project. Simply copy the code and run it in your browser’s developer console, or integrate it into your web application.
-
Open the Script:
- Copy the provided JavaScript code from the
script.js
file.
- Copy the provided JavaScript code from the
-
Run the Script:
- Paste the code into your browser's developer console, or integrate it into your HTML file.
-
Enter Inputs:
- When prompted, enter the base fee (in gwei), priority fee (in gwei), and gas limit.
-
View Results:
- The total gas fee will be displayed in both gwei and ETH.
Example input:
Base Fee: 30 gwei
Priority Fee: 2 gwei
Gas Limit: 21000