Ir al contenido principal

How to Track Raydium Liquidity Pools on Solana

Actualizado el
Dec 18, 2025

6 minutos de lectura

Resumen

With the recent uptick in DeFi activity and Memecoins on the Solana blockchain, there has been a growing interest in finding ways to track new liquidity pools created on the Raydium DEX. In this guide, we will learn how to listen to the Solana blockchain for new liquidity pools created on the Raydium DEX using Solana WebSockets.


New Liquidity Pools API

Raydium protocol may change over time. Here is a link to their GitHub repositories for their AMM and CLMM.

To ensure you are accessing the latest information on new liquidity pools created on Raydium DEX, try using the Metis Marketplace Add-on, which has a /new-pools REST API Endpoint that returns the 100 most recent token and liquidity pool launches on Raydium.

Prefer a video walkthrough? Follow along with Sahil and how to use websockets to track new Raydium Liquidity Pools.
¡Suscríbete a nuestro canal de YouTube para ver más vídeos!

Requisitos previos

What is Raydium?

Raydium is a decentralized exchange (DEX) and automated market maker (AMM) that is built on the Solana blockchain. It is designed to provide fast and low-cost trading for users. Raydium is a key player in the Solana DeFi ecosystem and has been a popular choice for users to trade and provide liquidity for various tokens.

What are Liquidity Pools?

Liquidity pools are a vital component of decentralized exchanges DeFi. They are used to facilitate trading and provide liquidity for various tokens. Liquidity pools are made up of pairs of tokens and are used to facilitate trades on DEXs. Users can often provide liquidity to these pools and earn fees in return.

Configura tu proyecto

Crear un nuevo proyecto

Create a new project directory in your terminal with the following:

mkdir raydium-lp-tracker
cd raydium-lp-tracker

Crea un archivo para tu aplicación, app.ts:

echo > app.ts

Inicializa tu proyecto con el indicador «yes» para utilizar los valores predeterminados en tu nuevo paquete:

hilo init --sí
#o
npm init --yes

Install the Solana web3.js library:

hilo añadir @solana/web3.js@1
#o
npm instalar @solana/web3.js@1

Get a Quicknode Endpoint

Conéctate a un clúster de Solana con tu punto de conexión de Quicknode

Para desarrollar en Solana, necesitarás un punto final de API para conectarte a la red. Puedes utilizar nodos públicos o implementar y gestionar tu propia infraestructura; sin embargo, si quieres tiempos de respuesta 8 veces más rápidos, puedes dejarnos a nosotros el trabajo pesado.

Descubre por qué más del 50 % de los proyectos en Solana Elige Quicknode y empieza tu prueba gratuita aquí. Vamos a utilizar un Solana Red principal punto final.

Copia el HTTP Enlace del proveedor:

Note: we will also use the WSS Endpoint as well, so keep the window open or save the URL for later.

Import Required Libraries

Open app.ts and import the required libraries:

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

Define Constants

Define the constants for the Raydium DEX and your Quicknode Endpoint:

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
});

Here, we just define the Raydium LP Program public key and establish our connection to the Solana mainnet. We are also defining the name of the instruction that we will be looking for in the logs. We are looking for the "initialize2" instruction, which is the Raydium LP program instruction responsible for creating new liquidity pools.

Create a WebSocket Connection

Create a function to connect to the Solana blockchain using WebSockets:

async function startConnection(connection: Connection, programAddress: PublicKey, searchInstruction: string): Promise<void> {
console.log("Monitoring logs for program:", programAddress.toString());
connection.onLogs(
programAddress,
({ logs, err, signature }) => {
if (err) return;

if (logs && logs.some(log => log.includes(searchInstruction))) {
console.log("Signature for 'initialize2':", `https://explorer.solana.com/tx/${signature}`);
fetchRaydiumMints(signature, connection);
}
},
"finalized"
);
}

This function establishes a simple WebSocket connection to the Solana blockchain and listens for logs from the Raydium DEX program using the onLogs method.

When a log that contains the "searchInstruction" is found, we will fetch the token mints associated with the transaction (we will define this next).

Fetch LP Mints

We now need a way to fetch our Token Mints from the transaction signature. We will need to fetch the signature details and then parse the results to find the relevant information. In your program, create a new function, fetchRaydiumMints:

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

//@ts-ignore
const accounts = (tx?.transaction.message.instructions).find(ix => ix.programId.toBase58() === RAYDIUM_PUBLIC_KEY).accounts as PublicKey[];

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

const tokenAIndex = 8;
const tokenBIndex = 9;

const tokenAAccount = accounts[tokenAIndex];
const tokenBAccount = accounts[tokenBIndex];

const displayData = [
{ "Token": "A", "Account Public Key": tokenAAccount.toBase58() },
{ "Token": "B", "Account Public Key": tokenBAccount.toBase58() }
];

console.log("New LP Found");
console.table(displayData);

} catch {
console.log("Error fetching transaction:", txId);
return;
}
}

There's a lot here, but it is not too complicated.

  • First, we are fetching the transaction details using the getParsedTransaction method.
  • Next, we look for the Raydium Program ID in the array of instructions and extract the accounts associated with the transaction.
  • If we find the accounts, we extract the token mints from their expected positions in the array (8 and 9).
  • Finally, we log the token mints to the console.

Start the Connection

Now that we have our functions defined, we can start the connection and listen for new liquidity pools:

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

Run the Program

To run the program, use the following command:

ts-node app.ts

And now, sit back and watch as new liquidity pools are created on the Raydium DEX! You should see a notice in your terminal each time a new LP is created, matching our search criteria:

Raydium LP Tracker

Conclusión

Great Job! You now have an LP tracker that can listen for new liquidity pools created on the Raydium DEX. You can use this as a starting point to build more complex applications that track and monitor DeFi activity on the Solana blockchain or to implement custom logic in response to new liquidity pools being created.

Si tienes alguna duda o necesitas ayuda, no dudes en ponerte en contacto con nosotros a través de Discord o Twitter.

¡Nos encanta recibir comentarios!

Si tienes algún comentario o sugerencia sobre nuevos temas, no dudes en hacérnoslo saber. Nos encantaría saber tu opinión.

Recursos

Comparte esta guía