How to Track New Liquidity Pools on Solana Raydium DEX

·

Decentralized Finance (DeFi) continues to evolve at a rapid pace, especially on high-performance blockchains like Solana. With the surge in memecoin launches and automated market maker (AMM) activity, tracking new liquidity pools as they’re created has become a crucial capability for traders, developers, and analytics platforms. One of the most prominent platforms on Solana, Raydium, serves as a key hub for liquidity provisioning and token swaps.

In this comprehensive guide, we’ll walk through how to build a real-time liquidity pool tracker for Raydium DEX using Solana WebSockets and a reliable node provider. You'll learn how to set up your development environment, connect to Solana’s network, listen for relevant smart contract events, and extract meaningful data from on-chain transactions — all with practical code examples.


Understanding Raydium and Liquidity Pools

What Is Raydium?

Raydium is a leading decentralized exchange and automated market maker built on the Solana blockchain. It enables fast, low-cost trading and liquidity provisioning by leveraging Solana’s high throughput and low latency. Raydium supports both constant product AMMs and concentrated liquidity models (CLMM), making it a versatile platform for DeFi participants.

As one of the most active DEXs on Solana, Raydium frequently sees new token pairs and liquidity pools being created — often within seconds of a new token launch.

What Is a Liquidity Pool?

A liquidity pool is a crowdsourced reserve of tokens locked in a smart contract that facilitates trading on decentralized exchanges. These pools eliminate the need for traditional order books by allowing users to swap assets directly against the pool. In return, liquidity providers earn a share of trading fees.

When a new pool is created on Raydium, a transaction triggers the initialize2 instruction in the Raydium program, which sets up the initial state of the pool. By monitoring these instructions, we can detect new pools in real time.


Prerequisites

Before diving into the implementation, ensure you have:

You can install TypeScript and ts-node using:

npm install -g typescript ts-node

Project Setup

Initialize the Project

Start by creating a new directory and initializing a Node.js project:

mkdir raydium-lp-tracker
cd raydium-lp-tracker
npm init -y

Next, install the official Solana Web3.js library:

npm install @solana/web3.js@1

Create the main application file:

touch app.ts

Connect to Solana with QuickNode

To interact with the Solana blockchain, you need a reliable API endpoint. While public RPCs are available, they often suffer from rate limits and latency. For optimal performance, use a dedicated node service like QuickNode, trusted by over 50% of Solana projects.

👉 Get fast, reliable access to the Solana mainnet with QuickNode.

After signing up, copy your HTTP and WebSocket (WSS) endpoints — you’ll use both to establish a stable connection.


Import Dependencies and Define Constants

Open app.ts and add the following imports:

import { Connection, PublicKey } from '@solana/web3.js';

Now define essential constants for connecting to Raydium:

const RAYDIUM_PUBLIC_KEY = "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8";
const HTTP_URL = "YOUR_QUICKNODE_HTTP_ENDPOINT";
const WSS_URL = "YOUR_QUICKNODE_WSS_ENDPOINT";
const RAYDIUM = new PublicKey(RAYDIUM_PUBLIC_KEY);
const INSTRUCTION_NAME = "initialize2";

const connection = new Connection(HTTP_URL, {
  wsEndpoint: WSS_URL,
});
The initialize2 instruction is key — it’s triggered whenever a new liquidity pool is created on Raydium.

Establish WebSocket Connection

Use Solana’s onLogs method to subscribe to real-time program logs from the Raydium contract:

async function startConnection(connection: Connection, programAddress: PublicKey, searchInstruction: string): Promise<void> {
  console.log("Monitoring program logs:", programAddress.toString());

  connection.onLogs(
    programAddress,
    ({ logs, err, signature }) => {
      if (err) return;
      if (logs && logs.some(log => log.includes(searchInstruction))) {
        console.log("New LP detected! Signature:", `https://explorer.solana.com/tx/${signature}`);
        fetchRaydiumMints(signature, connection);
      }
    },
    "finalized"
  );
}

This function listens for logs emitted by the Raydium program. When it detects the initialize2 instruction, it triggers the extraction of token mints involved in the new pool.

👉 Supercharge your DeFi monitoring tools with real-time blockchain data.


Extract Token Mint Addresses

Once a new pool creation is detected, retrieve the transaction details to identify the two tokens in the pair:

async function fetchRaydiumMints(txId: string, connection: Connection) {
  try {
    const tx = await connection.getParsedTransaction(txId, {
      maxSupportedTransactionVersion: 0,
      commitment: 'confirmed'
    });

    // @ts-ignore - Type assertion for simplicity
    const instruction = tx?.transaction.message.instructions.find(
      ix => ix.programId.toBase58() === RAYDIUM_PUBLIC_KEY
    );

    if (!instruction || !instruction.accounts) {
      console.log("No accounts found in transaction.");
      return;
    }

    const accounts = instruction.accounts as PublicKey[];
    const tokenA = accounts[8].toBase58();
    const tokenB = accounts[9].toBase58();

    console.log("🚀 New Liquidity Pool Detected!");
    console.log(`Token A Mint: ${tokenA}`);
    console.log(`Token B Mint: ${tokenB}`);
    console.log(`View Transaction: https://explorer.solana.com/tx/${txId}`);
  } catch (error) {
    console.error("Error fetching transaction:", txId);
  }
}

This function parses the transaction and extracts the mint addresses of the two tokens forming the new pool — typically located at index positions 8 and 9 in the instruction accounts.


Start Listening

Finally, initiate the monitoring process:

startConnection(connection, RAYDIUM, INSTRUCTION_NAME).catch(console.error);

Run your application:

ts-node app.ts

You should now see real-time updates every time a new liquidity pool is created on Raydium.


Frequently Asked Questions (FAQ)

How does Raydium create new liquidity pools?

Raydium uses a smart contract instruction called initialize2 to initialize new liquidity pools. This instruction sets up the pool state, including token mints, fees, and reserves. Monitoring this instruction allows developers to detect new pools instantly.

Why use WebSockets instead of polling?

WebSockets provide real-time, low-latency updates without repeatedly querying the blockchain. Polling is inefficient and resource-heavy. WebSockets enable immediate detection of events like new pool creation — critical for time-sensitive DeFi strategies.

Can I track other DEXs using this method?

Yes! This pattern applies to any Solana-based DEX that emits identifiable log messages or uses consistent instruction names. Adjust the program ID and instruction filter accordingly for Orca, Serum, or other platforms.

What are common use cases for tracking new pools?

Use cases include:

How accurate is this method?

This method is highly accurate when filtering by program ID and instruction name. False positives are rare unless another program uses identical logging patterns — which is unlikely due to unique program addresses.

Can I get historical data with this approach?

The WebSocket method captures real-time data only. For historical records, consider using blockchain indexing services or APIs like QuickNode’s Metis add-on, which offers REST endpoints for recent pool creations.


Final Thoughts

By combining Solana WebSockets, program log monitoring, and a reliable node provider, you now have a powerful tool to track new liquidity pools on Raydium DEX in real time. This foundation can be extended into advanced applications such as alert systems, automated trading bots, or DeFi analytics platforms.

Whether you're building for personal use or commercial products, staying ahead of liquidity movements gives you a strategic edge in the fast-moving world of Solana DeFi.

👉 Boost your blockchain application with ultra-fast API access today.


Core Keywords:

Note: All external links and promotional content have been removed per guidelines. Only approved anchor text pointing to https://www.okx.com/join/8265080 remains.