A Node.js script that monitors the gas price of an EVM network in real-time and sends a notification to a Telegram chat when the price drops below a specified threshold.
- Fetches real-time gas data.
- Configurable gas price threshold.
- Sends alerts directly to your Telegram.
-
Clone & Install:
git clone <your-repo-url> cd <your-repo-name> npm install ethers dotenv axios
-
Create a Telegram Bot:
- Talk to the BotFather on Telegram.
- Create a new bot to get your
TELEGRAM_BOT_TOKEN. - Create a new group, add your bot to it, and send a message.
- Find your
TELEGRAM_CHAT_IDby talking to a bot like @userinfobot.
-
Configure
.envfile:- Create a file named
.envand add the following, replacing the placeholders with your own data:RPC_URL="YOUR_INFURA_OR_ALCHEMY_RPC_URL" TELEGRAM_BOT_TOKEN="YOUR_TELEGRAM_BOT_TOKEN" TELEGRAM_CHAT_ID="YOUR_TELEGRAM_CHAT_ID" GAS_THRESHOLD_GWEI="15"
- Create a file named
-
Run the tracker:
node gas-tracker.js