
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
24 June, 2022
13
13
0
Contributors
What is an Ethereum Improvement Proposal (EIP)?
Ethereum Improvement Proposals
the procedure entails a developer or group of developers changing the network, evaluated and discussed by the core developers who control Ethereum's Github code repository.What is EIP-1559?
Prerequisite
Step 1: Create an Alchemy account

How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
Step 2: Create an Alchemy App (and API key)
Create App
button as shown below.
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard

View Key
button, which will open a popup with our app's HTTP and Websocket URLs. In this tutorial, we will be using the WebSocket URL.Step 3: Project Setup and Installation
Step 4: Create a web3 client instance using Alchemy SDK
index.js
file using the following code snippet.Step 5: Get Fee History of the most recent 20 Blocks on Ethereum Mainnet
index.js
file with the code snippet below.
Step 6: Format the result
wei
will be converted to decimals denominated in Gwei
.formatOutput
function.
Step 7: Gas Price Webhook Setup and Installation
index.js
file, let us create a simple http
server using the following code snippet.http
server.
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
ngrok
tunnel we just created. Let us navigate to https://f73f-102-89-3-195.ngrok.io on our browser.
Note: Chrome browser flags such URL as a malicious or dangerous site.
Step 8: Set up and Test Webhook on Alchemy dashboard
Notify
tab on our Alchemy Dashboard.
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard

How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
Gas Price Webhook
with gas price thresholds we would like to be notified of, and Alchemy will send us notifications when the gas price passes our points.
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
TEST WEBHOOK
button, we should get a response in our terminal via the ngrok tunnel created.
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard

How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
ngrok
, we should see the webhooks roll in here: http://localhost:4040/inspect/http, as shown below.
How to Build an Ethereum Gas Price Tracker using EIP-1559 Standard
Conclusion
Reference
javascript
blockchain
web3
ethereum