How to Stream and Parse PumpSwap Transactions on Solana

·

Introduction to Real-Time PumpSwap AMM Transaction Monitoring

Real-time data is crucial for Solana applications tracking dynamic markets like decentralized exchanges. gRPC streaming offers a high-performance method to receive instant on-chain updates. Previously, Pump.fun tokens migrated to DEXs like Raydium; now, they transition to Pump AMM. Monitoring activity on this new platform requires efficient, low-latency data streams, making Solana gRPC streaming a vital tool for real-time observation.

This guide explores how to stream and parse PumpSwap transactions on Pump.fun's newly launched AMM.


Prerequisites

Before starting, ensure you have:

  1. Authentication:

    • gRPC Endpoint: Region-specific URL (available in your Shyft Dashboard).
    • gRPC Token: Access token purchased via the Shyft Dashboard.
  2. Backend Setup:

    • A server-side application (e.g., NodeJS, Python, Go) to handle gRPC data (browsers don’t support gRPC natively).

Step-by-Step Implementation

1. Initialize the Yellowstone Client

Configure the gRPC client with your endpoint and token:

const client = new Client(
  'Your_Shyft_gRPC_Endpoint', 
  'Your_Shyft_Access_Token',
  undefined,
);

2. Define Subscription Requests

Specify the data to stream using a SubscribeRequest:

const req: SubscribeRequest = {
  transactions: {
    pumpFun: {
      accountInclude: [PUMPSWAP_AMM.toBase58()], // PumpSwap AMM program ID
      accountExclude: [],
    },
  },
  commitment: CommitmentLevel.PROCESSED, // Can also use "confirmed" or "finalized"
};

3. Handle the Data Stream

Capture and process incoming transactions:

async function handleStream(client: Client, args: SubscribeRequest) {
  const stream = await client.subscribe();
  stream.on("data", (data) => {
    const txn = TransactionFormatter.formatTransactionFromJson(data.transaction);
    console.log("Parsed Transaction:", txn);
  });
  stream.write(args);
}

4. Decode Transactions

Use Shyft’s parser (or a custom one) to humanize raw data:

import { SolanaParser } from "@shyft-to/solana-transaction-parser";
const PUMP_FUN_IX_PARSER = new SolanaParser([]);
PUMP_FUN_IX_PARSER.addParserFromIdl(
  PUMP_FUN_AMM_PROGRAM_ID.toBase58(),
  pumpFunAmmIdl as Idl
);
const parsedIxs = PUMP_FUN_IX_PARSER.parseTransactionData(tx.message);

FAQs

Q1: Why use gRPC over traditional RPC?

A: gRPC offers lower latency and real-time streaming, critical for DeFi applications.

Q2: Can I stream PumpSwap data without a backend?

A: No, gRPC requires a server-side environment (e.g., NodeJS, Python).

Q3: How do I filter transactions for specific AMMs?

A: Use accountInclude in your SubscribeRequest to target the PumpSwap program ID.

👉 Explore more Solana development tools


Conclusion

By leveraging gRPC streaming and Shyft’s transaction parser, developers gain instant, actionable insights into PumpSwap AMM activity. This setup is ideal for building responsive applications or analytics tools.

For the complete code, visit the GitHub repository.

👉 Join the Shyft Discord for support


Additional Resources