DEV Community

TateLyman
TateLyman

Posted on • Originally published at devtools-site-delta.vercel.app

Building a Whale Alert System for Solana in Node.js

What Are Whale Alerts?

Whale alerts track large token movements on-chain. When a wallet moves millions of dollars worth of SOL or tokens, it often signals upcoming price action.

Building It

Here's the core architecture for a Solana whale tracker in Node.js:

const { Connection, PublicKey } = require('@solana/web3.js');

const WHALE_THRESHOLD_SOL = 100; // Alert on 100+ SOL movements
const WATCHED_WALLETS = new Map(); // wallet -> label

async function monitorWallet(connection, wallet, label) {
  const pubkey = new PublicKey(wallet);

  connection.onAccountChange(pubkey, async (accountInfo) => {
    const balanceSOL = accountInfo.lamports / 1e9;
    console.log(`[WHALE] ${label}: Balance changed to ${balanceSOL} SOL`);

    // Check recent transactions
    const sigs = await connection.getSignaturesForAddress(pubkey, { limit: 1 });
    if (sigs.length > 0) {
      const tx = await connection.getParsedTransaction(sigs[0].signature);
      analyzeTransaction(tx, label);
    }
  });
}

function analyzeTransaction(tx, label) {
  if (!tx?.meta) return;

  const preBalances = tx.meta.preBalances;
  const postBalances = tx.meta.postBalances;
  const diff = (postBalances[0] - preBalances[0]) / 1e9;

  if (Math.abs(diff) >= WHALE_THRESHOLD_SOL) {
    const action = diff > 0 ? 'RECEIVED' : 'SENT';
    console.log(`🐋 ${label} ${action} ${Math.abs(diff).toFixed(2)} SOL`);
    // Send alert via Telegram, Discord webhook, etc.
  }
}
Enter fullscreen mode Exit fullscreen mode

Full Implementation

My Solana DeFi Toolkit includes a production-ready whale tracker with:

  • Multi-wallet monitoring — track unlimited wallets
  • Token transfer detection — not just SOL, any SPL token
  • Telegram notifications — instant alerts to your phone
  • Historical analysis — track patterns over time

Also in the Toolkit

The DeFi Toolkit includes 10 production Node.js scripts:

  1. Wallet Monitor — real-time balance tracking
  2. Token Scanner — analyze any SPL token
  3. Jupiter Swap — execute swaps programmatically
  4. Pump.fun Monitor — track new token launches
  5. Whale Tracker — large movement alerts
  6. Portfolio Tracker — multi-wallet P&L
  7. Bulk Transfer — batch SOL/token sends
  8. Airdrop Checker — check eligibility across protocols
  9. NFT Holder Snapshot — export holder lists
  10. RPC Benchmark — test endpoint performance

Free Bot Alternative

If you just want whale alerts without running code, my Telegram bot has a /whale command that does it all for you.


Get the toolkit: devtools-site-delta.vercel.app/sol-defi-toolkit

Top comments (0)