> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Pump.fun Program ID, IDL & Buy/Sell Instructions

> Official Pump.fun Solana program ID 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P, Anchor IDL, and buy/sell/create instruction discriminators for web3.js and Rust.

Reference for the **Pump.fun bonding curve** Solana program: official program ID, Anchor IDL, and Anchor instruction discriminators for `buy`, `sell`, and `create`. Use this when building web3.js clients, Anchor integrations, or instruction parsers.

For graduated tokens on PumpSwap, see the [Pump.fun AMM program](/guides/pumpfun-amm). For indexed market data without raw instruction building, use the [Pump.fun API guide](/guides/pumpfun).

<Info>
  Prefer not to hand-build instructions? [Raptor Swap API](/raptor/overview) routes buys and sells across Pump.fun bonding curves and PumpSwap automatically.
</Info>

## Official program IDs

| Program                      | Address                                       | Role                                          |
| ---------------------------- | --------------------------------------------- | --------------------------------------------- |
| **Pump.fun (bonding curve)** | `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P` | Create tokens, buy/sell on the curve, migrate |
| **Pump.fun AMM (PumpSwap)**  | `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA` | Post-graduation constant-product pools        |
| **Pump Fees**                | `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ` | Fee config used by buy/sell                   |

Base58 is case-sensitive. The official bonding-curve ID uses a **lowercase `r`** after `EF8` (`6EF8rrecth…`), not `6EF8rRecth…`.

### Well-known PDAs

| Account           | Seeds                     | Address                                        |
| ----------------- | ------------------------- | ---------------------------------------------- |
| `global`          | `["global"]`              | `4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf` |
| `event_authority` | `["__event_authority"]`   | PDA of the Pump program                        |
| `bonding_curve`   | `["bonding-curve", mint]` | Per-token curve account                        |

Solana Tracker market filters: `pumpfun` (bonding curve), `pumpfun-amm` (graduated / PumpSwap).

***

## Anchor IDL

Download the official Anchor IDL (mirrored from [pump-fun/pump-public-docs](https://github.com/pump-fun/pump-public-docs)):

* **JSON IDL:** [/idl/pump.json](/idl/pump.json)
* Upstream: [idl/pump.json](https://github.com/pump-fun/pump-public-docs/blob/main/idl/pump.json)

```javascript theme={null}
import idl from "./idl/pump.json" assert { type: "json" };
// or: const idl = require("./idl/pump.json");

console.log(idl.address);
// 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
```

Load the same file with `@coral-xyz/anchor` (`Program`, `BorshInstructionCoder`) for typed buy/sell calls, or keep using raw discriminators with `@solana/web3.js` as shown below.

***

## Instruction discriminators

Anchor discriminators are the first **8 bytes** of `sha256("global:<instruction_name>")`. Match these when parsing transactions or building instructions manually.

| Instruction        | Discriminator (bytes)                     | Hex                  |
| ------------------ | ----------------------------------------- | -------------------- |
| `buy`              | `[102, 6, 61, 18, 1, 218, 235, 234]`      | `0x66063d1201daebea` |
| `sell`             | `[51, 230, 133, 164, 1, 127, 131, 173]`   | `0x33e685a4017f83ad` |
| `create`           | `[24, 30, 200, 40, 5, 28, 7, 119]`        | `0x181ec828051c0777` |
| `create_v2`        | `[214, 144, 76, 236, 95, 139, 49, 180]`   | `0xd6904cec5f8b31b4` |
| `buy_exact_sol_in` | `[56, 252, 116, 8, 158, 223, 205, 95]`    | `0x38fc74089edfcd5f` |
| `buy_v2`           | `[184, 23, 238, 97, 103, 197, 211, 61]`   | `0xb817ee6167c5d33d` |
| `sell_v2`          | `[93, 246, 130, 60, 231, 233, 64, 178]`   | `0x5df6823ce7e940b2` |
| `migrate`          | `[155, 234, 231, 146, 236, 158, 162, 30]` | `0x9beae792ec9ea21e` |

`buy` / `sell` on the **AMM** reuse the same sighashes — always check the **program ID** (`6EF8rrecth…` vs `pAMMBay…`) when classifying trades.

On mainnet, many curve swaps use `buy_exact_sol_in` (`0x38fc74089edfcd5f`) rather than classic `buy`. Parsers should handle both.

### Detect buy vs sell in Rust

```rust theme={null}
const BUY: [u8; 8] = [102, 6, 61, 18, 1, 218, 235, 234];
const SELL: [u8; 8] = [51, 230, 133, 164, 1, 127, 131, 173];
const CREATE: [u8; 8] = [24, 30, 200, 40, 5, 28, 7, 119];

fn classify(data: &[u8]) -> Option<&'static str> {
    let disc = data.get(..8)?;
    if disc == BUY { Some("buy") }
    else if disc == SELL { Some("sell") }
    else if disc == CREATE { Some("create") }
    else { None }
}
```

***

## `buy` instruction

**Args**

| Arg            | Type         | Meaning                         |
| -------------- | ------------ | ------------------------------- |
| `amount`       | `u64`        | Token amount out (base units)   |
| `max_sol_cost` | `u64`        | Slippage cap in lamports        |
| `track_volume` | `OptionBool` | `{ 0 }` = false, `{ 1 }` = true |

**Accounts**

| #  | Account                     | Writable | Signer |
| -- | --------------------------- | -------- | ------ |
| 0  | `global`                    |          |        |
| 1  | `fee_recipient`             | ✓        |        |
| 2  | `mint`                      |          |        |
| 3  | `bonding_curve`             | ✓        |        |
| 4  | `associated_bonding_curve`  | ✓        |        |
| 5  | `associated_user`           | ✓        |        |
| 6  | `user`                      | ✓        | ✓      |
| 7  | `system_program`            |          |        |
| 8  | `token_program`             |          |        |
| 9  | `creator_vault`             | ✓        |        |
| 10 | `event_authority`           |          |        |
| 11 | `program`                   |          |        |
| 12 | `global_volume_accumulator` |          |        |
| 13 | `user_volume_accumulator`   | ✓        |        |
| 14 | `fee_config`                |          |        |
| 15 | `fee_program`               |          |        |

Read `fee_recipient` (and the `fee_recipients` array) from the `global` account. Pass `fee_program` = `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`.

***

## `sell` instruction

**Args**

| Arg              | Type  | Meaning                      |
| ---------------- | ----- | ---------------------------- |
| `amount`         | `u64` | Token amount in (base units) |
| `min_sol_output` | `u64` | Slippage floor in lamports   |

**Accounts**

| #  | Account                    | Writable | Signer |
| -- | -------------------------- | -------- | ------ |
| 0  | `global`                   |          |        |
| 1  | `fee_recipient`            | ✓        |        |
| 2  | `mint`                     |          |        |
| 3  | `bonding_curve`            | ✓        |        |
| 4  | `associated_bonding_curve` | ✓        |        |
| 5  | `associated_user`          | ✓        |        |
| 6  | `user`                     | ✓        | ✓      |
| 7  | `system_program`           |          |        |
| 8  | `creator_vault`            | ✓        |        |
| 9  | `token_program`            |          |        |
| 10 | `event_authority`          |          |        |
| 11 | `program`                  |          |        |
| 12 | `fee_config`               |          |        |
| 13 | `fee_program`              |          |        |

***

## `create` instruction

**Args:** `name: string`, `symbol: string`, `uri: string`, `creator: pubkey`\
**Discriminator:** `[24, 30, 200, 40, 5, 28, 7, 119]`

Newer launches often use `create_v2` (Token-2022 / Mayhem / cashback fields). Prefer matching live transactions or the IDL when integrating creation flows.

***

## Buy / sell with `@solana/web3.js`

Encode the Anchor discriminator, then little-endian `u64` args. `OptionBool` is a single byte (`0` or `1`).

```javascript theme={null}
import {
  PublicKey,
  TransactionInstruction,
  SystemProgram,
} from "@solana/web3.js";
import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from "@solana/spl-token";
import bs58 from "bs58";

export const PUMP_PROGRAM_ID = new PublicKey(
  "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
);
export const PUMP_FEE_PROGRAM_ID = new PublicKey(
  "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"
);
export const GLOBAL = new PublicKey(
  "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"
);

const BUY_DISC = Buffer.from([102, 6, 61, 18, 1, 218, 235, 234]);
const SELL_DISC = Buffer.from([51, 230, 133, 164, 1, 127, 131, 173]);

function u64le(n) {
  const b = Buffer.alloc(8);
  b.writeBigUInt64LE(BigInt(n));
  return b;
}

export function bondingCurvePda(mint) {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("bonding-curve"), mint.toBuffer()],
    PUMP_PROGRAM_ID
  )[0];
}

export function eventAuthorityPda() {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("__event_authority")],
    PUMP_PROGRAM_ID
  )[0];
}

export function creatorVaultPda(creator) {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("creator-vault"), creator.toBuffer()],
    PUMP_PROGRAM_ID
  )[0];
}

export function feeConfigPda() {
  // seeds: ["fee_config", pump_program_id] on the fee program
  return PublicKey.findProgramAddressSync(
    [Buffer.from("fee_config"), PUMP_PROGRAM_ID.toBuffer()],
    PUMP_FEE_PROGRAM_ID
  )[0];
}

/** Build a Pump.fun bonding-curve buy instruction */
export function buildBuyIx({
  mint,
  user,
  feeRecipient,
  creator, // bonding_curve.creator
  amount, // tokens out
  maxSolCost, // lamports
  trackVolume = false,
}) {
  const bondingCurve = bondingCurvePda(mint);
  const associatedBondingCurve = getAssociatedTokenAddressSync(
    mint,
    bondingCurve,
    true
  );
  const associatedUser = getAssociatedTokenAddressSync(mint, user);
  const [globalVolume] = PublicKey.findProgramAddressSync(
    [Buffer.from("global_volume_accumulator")],
    PUMP_PROGRAM_ID
  );
  const [userVolume] = PublicKey.findProgramAddressSync(
    [Buffer.from("user_volume_accumulator"), user.toBuffer()],
    PUMP_PROGRAM_ID
  );

  const data = Buffer.concat([
    BUY_DISC,
    u64le(amount),
    u64le(maxSolCost),
    Buffer.from([trackVolume ? 1 : 0]),
  ]);

  return new TransactionInstruction({
    programId: PUMP_PROGRAM_ID,
    keys: [
      { pubkey: GLOBAL, isSigner: false, isWritable: false },
      { pubkey: feeRecipient, isSigner: false, isWritable: true },
      { pubkey: mint, isSigner: false, isWritable: false },
      { pubkey: bondingCurve, isSigner: false, isWritable: true },
      { pubkey: associatedBondingCurve, isSigner: false, isWritable: true },
      { pubkey: associatedUser, isSigner: false, isWritable: true },
      { pubkey: user, isSigner: true, isWritable: true },
      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
      { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
      { pubkey: creatorVaultPda(creator), isSigner: false, isWritable: true },
      { pubkey: eventAuthorityPda(), isSigner: false, isWritable: false },
      { pubkey: PUMP_PROGRAM_ID, isSigner: false, isWritable: false },
      { pubkey: globalVolume, isSigner: false, isWritable: false },
      { pubkey: userVolume, isSigner: false, isWritable: true },
      { pubkey: feeConfigPda(), isSigner: false, isWritable: false },
      { pubkey: PUMP_FEE_PROGRAM_ID, isSigner: false, isWritable: false },
    ],
    data,
  });
}

/** Build a Pump.fun bonding-curve sell instruction */
export function buildSellIx({
  mint,
  user,
  feeRecipient,
  creator,
  amount,
  minSolOutput,
}) {
  const bondingCurve = bondingCurvePda(mint);
  const associatedBondingCurve = getAssociatedTokenAddressSync(
    mint,
    bondingCurve,
    true
  );
  const associatedUser = getAssociatedTokenAddressSync(mint, user);

  const data = Buffer.concat([SELL_DISC, u64le(amount), u64le(minSolOutput)]);

  return new TransactionInstruction({
    programId: PUMP_PROGRAM_ID,
    keys: [
      { pubkey: GLOBAL, isSigner: false, isWritable: false },
      { pubkey: feeRecipient, isSigner: false, isWritable: true },
      { pubkey: mint, isSigner: false, isWritable: false },
      { pubkey: bondingCurve, isSigner: false, isWritable: true },
      { pubkey: associatedBondingCurve, isSigner: false, isWritable: true },
      { pubkey: associatedUser, isSigner: false, isWritable: true },
      { pubkey: user, isSigner: true, isWritable: true },
      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
      { pubkey: creatorVaultPda(creator), isSigner: false, isWritable: true },
      { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
      { pubkey: eventAuthorityPda(), isSigner: false, isWritable: false },
      { pubkey: PUMP_PROGRAM_ID, isSigner: false, isWritable: false },
      { pubkey: feeConfigPda(), isSigner: false, isWritable: false },
      { pubkey: PUMP_FEE_PROGRAM_ID, isSigner: false, isWritable: false },
    ],
    data,
  });
}

// Identify buy/sell from a confirmed transaction
export function parsePumpInstructionData(dataBase58) {
  const data = Buffer.from(bs58.decode(dataBase58));
  const disc = data.subarray(0, 8);
  if (disc.equals(BUY_DISC)) {
    return {
      name: "buy",
      amount: data.readBigUInt64LE(8),
      maxSolCost: data.readBigUInt64LE(16),
    };
  }
  if (disc.equals(SELL_DISC)) {
    return {
      name: "sell",
      amount: data.readBigUInt64LE(8),
      minSolOutput: data.readBigUInt64LE(16),
    };
  }
  return null;
}
```

<Warning>
  Live mainnet instructions often append **remaining accounts** after the IDL list (commonly +2 on `buy` / `buy_exact_sol_in` / `sell` for cashback or bonding-curve-v2 flows). Token-2022 mints use `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb` instead of the legacy token program. Always cross-check a recent successful transaction and the latest [/idl/pump.json](/idl/pump.json) before shipping. For Token-2022 / multi-quote flows, prefer `buy_v2` / `sell_v2` from the IDL.
</Warning>

### Easier path: Raptor Swap API

```javascript theme={null}
const res = await fetch("https://swap-v2.solanatracker.io/swap", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    wallet: "YOUR_WALLET_ADDRESS",
    from: "So11111111111111111111111111111111111111112",
    to: "TOKEN_MINT_ADDRESS",
    amount: 0.1,
    slippage: 15,
    priorityFee: 0.0005,
  }),
});
const { txn } = await res.json();
// Sign and send txn
```

See [Swap API](/guides/swap-api) and [Raptor overview](/raptor/overview).

***

## Stream & index with Solana Tracker

Skip running your own indexer — use Solana Tracker products that already decode Pump.fun and PumpSwap:

| Product                                                           | Use for                                                                   |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [Pump.fun API](https://www.solanatracker.io/pumpfun-api)          | Indexed launches, curves, trades, holders                                 |
| [Data API](https://www.solanatracker.io/data-api)                 | REST: `/tokens/latest`, `/search?launchpad=pumpfun`, graduating/graduated |
| [Datastream](https://www.solanatracker.io/data-api)               | WebSocket rooms: `latest`, `graduating:pumpfun:50`, `pumpfun:curve:50`    |
| [Memescope](https://www.solanatracker.io/memescope)               | Live launch / final-stretch / migrated UI                                 |
| [Raptor](https://www.solanatracker.io/raptor)                     | Buy/sell routing on curve + AMM                                           |
| [Yellowstone gRPC](https://www.solanatracker.io/yellowstone-grpc) | Raw program tx/account streams                                            |
| [Solana RPC](https://www.solanatracker.io/solana-rpc)             | `getTransaction` / `getProgramAccounts` against these program IDs         |

Docs:

* [Pump.fun & bonding curves](/guides/pumpfun) — lifecycle with Data API + Datastream
* [gRPC buy/sell detection](/yellowstone-grpc/examples/pumpfun-transactions) — decode with the IDL
* [gRPC account streaming](/yellowstone-grpc/examples/pumpfun-accounts) — bonding curve state
* [Pump.fun AMM program](/guides/pumpfun-amm) — PumpSwap `buy` / `sell`

<CardGroup cols={2}>
  <Card title="Pump.fun AMM" href="/guides/pumpfun-amm" icon="water" iconType="duotone">
    PumpSwap program ID, IDL, and buy/sell discriminators.
  </Card>

  <Card title="Pump.fun lifecycle" href="/guides/pumpfun" icon="fire" iconType="duotone">
    Discover, track curves, graduations, and swap via Solana Tracker.
  </Card>

  <Card title="Yellowstone buy/sell" href="/yellowstone-grpc/examples/pumpfun-transactions" icon="bolt" iconType="duotone">
    Real-time instruction parsing over gRPC.
  </Card>

  <Card title="Raptor Swap" href="/raptor/overview" icon="arrows-rotate" iconType="duotone">
    Execute Pump.fun and PumpSwap swaps without building IXs.
  </Card>
</CardGroup>
