Build a Real-Time Hyperliquid Whale Tracker Bot with GetBlock
A step by step guide on how to build an Hyperliquid Whale Tracker Bot using GetBlock API
Whales are entities, such as DAOs or companies, that hold a large amount of a particular cryptocurrency, sufficient to influence the market price through their transactions. Their trade alone can either deflate or inflate the market price. While some whales engage in large trades that have a natural market effect, others may intentionally try to manipulate the market for profit. The Whale Tracking Bot is a bot that monitors on-chain activities of whales. It reports their transactions to you, thereby providing a clear analysis to inform predictions about potential market movements.
In this guide, you will learn:
Create a Telegram bot using Botfather
Get a GetBlock API access token
Build the Hyperliquid whale tracker bot that:
Tracks all trades on Hyperliquid as they happen
Identifies large trades based on configurable thresholds
Detects whale walls in the orderbook
Tracks and profiles recurring whale addresses
Sends an instant alert to your phone via Telegram
Utilizes smart batching to avoid Telegram API limits
Provides periodic summaries of whale activity
Prerequisites
Basic knowledge of JavaScript
Step 1. Create Telegram Bot
Bot Token:
Open Telegram and search for
@BotFatherSend
/newbotand follow instructionsCopy the token provided and save it in
.envfile
Chat ID:
Search for
@raw_data_botin TelegramSend
/startCopy your user ID
Step 2. Set up Development Environment
Before you begin, you need to set up your development environment:
Step 3. Getting your HyperEVM Websocket Token
Log in to your GetBlock account
On your dashboard, scroll and click on Get Endpoint
Select the HyperEVM Mainnet network
Under API Interface, select WebSocket
Click on Create to get your endpoint
Keep your endpoint safe, as it contains an access token
Project Structure
Create the following files to have a basic structure for your project:
Step 4. Set up Environment Variables
Update the .env file in the root of your project and add the following variables:
Step 5. Build Whale Tracker Bot
1. Import dependencies:
Import the dependencies and load the environment variables from .env file
2. Set up configuration settings:
Set up configuration settings for your application, including environment variables and other constants.
3. Create the Main Class with Private Fields:
Why private fields?
#prefix makes fields private (ES2022 feature)Prevents external code from modifying internal state
Better encapsulation and code organization
4. Connect to Hyperliquid WebSocket:
Event handlers:
open- Triggered when the connection is establishedmessage- Receives data from the servererror- Handles connection errorsclose- Handles disconnection
5. Subscribe to Data Streams:
Subscription types:
allMids- Current market prices for all symbolstrades- Real-time trade executionsl2Book- Level 2 orderbook (buy/sell walls)
6. Handle Incoming Messages:
Message routing:
Parse JSON data from WebSocket
Route to the appropriate handler based on
channeltypeGraceful error handling with try-catch
7. Update Price Cache
Why cache prices?
Used for calculating USD value of trades
Avoids repeated API calls
Provides a fallback when price data is missing
8. Analyze Trades for Whales
Trade data structure:
coin- Market symbol (BTC, ETH, etc.)side- 'B' for buy, 'A' for ask/sellpx- Price (as string)sz- Size/quantity (as string)user- Wallet address of traderhash- Transaction hashtid- Trade ID
9. Track Whale Addresses
Whale profile includes:
Total trading volume (cumulative)
Number of trades executed
First and last seen timestamps
Set of markets they trade in
10. Analyze Orderbook for Whale Walls
Orderbook structure:
levels[0]- Bid side (buy orders)levels[1]- Ask side (sell orders)Each level is
[price, size]array
Whale walls:
Large limit orders in the orderbook
Can act as support (bids) or resistance (asks)
Indicate where whales are defending price levels
11. Send Trade Notifications
Notification features:
Color-coded emojis (green=buy, red=sell)
Shortened wallet address for readability
Historical stats for known whales
Special highlight for mega trades ($500k+)
Optional Telegram integration
12. Implement Telegram Batching
Why batch alerts?
Telegram has rate limits (1 message/second)
Batching prevents hitting limits during high activity
Combines multiple alerts into one clean summary
Configurable interval (default: 10 seconds)
13. Implement Telegram Queue System
Queue system benefits:
Messages are queued and processed sequentially
Respects Telegram's rate limits
Automatic retry on 429 errors
Non-blocking (uses async/await)
14. Test Telegram Connection
Connection test:
Validates bot token on startup
Shows bot username
Sends test message
Provides helpful error messages
15. Implement Auto-Reconnection
Reconnection strategy:
Exponential backoff (delays increase)
Maximum 5 attempts
Caps at 30 seconds between tries
Separate handling for different connections
16. Generate Statistics Dashboard
Statistics include:
Total number of whale trades detected
Number of unique whale addresses
Top 10 whales ranked by volume
Individual whale profiles with activity metrics
17. Create the Start Method
Startup sequence:
Display configuration
Test Telegram connection
Connect to Hyperliquid WebSocket
Optionally connect to HyperEVM
Start periodic statistics reporting
18. Initialize and Run the Bot
Proper shutdown:
Closes WebSocket connections properly
Prevents data loss or hanging connections
Running and Testing the Application
Open your terminal and run the following command:
Expected result in console:
Expected result in Telegram:

Troubleshooting
You may run into a WebSocket 503 Error:
This means that your WebSocket endpoint is incorrect. Check your
.envfile and ensure it's in this pattern:
Then, restart the server.
Conclusion
In this guide, you have successfully learn and built a Hyperliquid Whale Tracker Bot that monitors and alerts all whale trade activities — from major buys to large sell-offs — and even detects whale walls in the order book.
By integrating the GetBlock WebSocket API, you can rest assured of fast, reliable, and real-time data delivery, ensuring you never miss significant market movements.
Last updated
Was this helpful?