in-solana by Supanode

Integrating With Pump.fun

TL;DR

  • - Pump.fun is a Solana-based token launchpad with a bonding curve mechanism
  • - Monitor new token creations via Geyser gRPC or logsSubscribe on the Pump.fun program
  • - Buying/selling uses the Pump.fun program's buy/sell instructions directly

Pump.fun is a token launchpad on Solana that allows anyone to create and trade tokens using a bonding curve. Tokens start on the bonding curve and migrate to a DEX (typically Raydium) when they reach a market cap threshold. Developers integrate with Pump.fun to automate token creation, build trading bots, and monitor new launches.

Architecture overview

Pump.fun consists of:

  1. Bonding curve program: the on-chain program that handles token creation, buying, and selling along a mathematically-defined price curve.
  2. Migration logic: when a token’s bonding curve reaches the threshold, liquidity migrates to a DEX.
  3. Frontend: the pump.fun website for manual interaction.

All on-chain operations can be performed programmatically without the frontend.

Monitoring new token launches

Via Geyser gRPC

Subscribe to account creation events for the Pump.fun program:

const stream = client.subscribe({
  transactions: {
    pumpfun: {
      accountInclude: [PUMPFUN_PROGRAM_ID],
    },
  },
});

for await (const tx of stream) {
  // Check if this is a token creation transaction
  if (isCreateInstruction(tx)) {
    const tokenMint = extractMint(tx);
    console.log("New token:", tokenMint);
  }
}

Via logsSubscribe

connection.onLogs(
  new PublicKey(PUMPFUN_PROGRAM_ID),
  (logs) => {
    if (logs.logs.some((l) => l.includes("create"))) {
      console.log("New token creation:", logs.signature);
    }
  },
  "confirmed",
);

Buying tokens

To buy a token on the bonding curve, send a buy instruction to the Pump.fun program with the token mint, amount of SOL to spend, and your token account.

Key accounts required:

  • Your wallet (signer, payer).
  • The token mint.
  • The bonding curve account (PDA derived from the mint).
  • Your associated token account for the mint.
  • The Pump.fun fee account.

Slippage protection: calculate the expected token amount from the bonding curve math and set a minimum acceptable amount.

Selling tokens

The sell instruction mirrors buying: specify the token amount to sell and receive SOL from the bonding curve. The price you receive depends on the current position on the curve.

Bonding curve math

Pump.fun uses a constant product bonding curve. The price increases as more tokens are bought:

price = virtualSolReserves / virtualTokenReserves

After each buy:

  • virtualSolReserves increases.
  • virtualTokenReserves decreases.
  • Price increases.

After each sell, the opposite occurs.

Migration event

When the bonding curve reaches the configured market cap threshold:

  1. Remaining tokens and SOL are withdrawn from the bonding curve.
  2. A DEX pool (typically Raydium) is created with the liquidity.
  3. The bonding curve is closed.
  4. Trading continues on the DEX.

Monitor for migration by watching the bonding curve account’s data — when the complete flag is set, migration has occurred.

Infrastructure requirements

StrategyMinimum RPCRecommended
Monitoring launchesShared RPC + WebSocketGeyser gRPC
Manual buyingShared RPCStaked RPC
Sniping new tokensStaked RPC + JitoGeyser gRPC + staked + Jito
Market makingDedicated node + GeyserColocated + Geyser

For competitive sniping (buying in the first seconds after launch), low-latency Geyser gRPC feeds and staked connections are essential. Jito bundles provide ordering guarantees.

Risk considerations

  • Bonding curve tokens are highly volatile. Price can drop to near-zero.
  • Many tokens are created solely for speculation. Do your own research.
  • Migration does not guarantee liquidity. Post-migration, liquidity depends on the DEX pool depth.
  • Frontrunning risk. Your buy transactions are visible on the network. Use Jito bundles for transaction privacy.

FAQ

Do I need Pump.fun’s API to interact with the program? No. All operations are on-chain. You can build and send transactions directly to the Pump.fun program. The API and frontend are convenience layers.

Can I create a token via the program directly? Yes. The create instruction on the Pump.fun program creates a new token with a bonding curve. You can specify token metadata (name, symbol, image URI).

What happens to my tokens after migration? Your tokens remain in your wallet. After migration, you trade them on the DEX instead of the bonding curve. The token mint is the same.

How quickly do new tokens appear? Token creation is a single transaction. With Geyser gRPC monitoring, you can detect new tokens within 1–2 seconds of the creation transaction confirming.

Updated: