Get started
Quickstart
Install the SDK, create a coin, and send your first buy and sell in a few minutes.
This page takes you from an empty project to a coin created, bought and sold on the bonding curve. It uses the TypeScript SDK; every step has a Rust equivalent linked at the end.
1. Install
npm install @pump-fun/pump-sdk @solana/web3.js @solana/spl-token bn.js
Add @pump-fun/pump-swap-sdk when you also need to trade graduated coins on the AMM.
2. Create a coin
create_v2 mints a Token-2022 coin with decimals = 6. Omit quoteMint to pair the coin with
SOL.
import { PUMP_SDK } from "@pump-fun/pump-sdk";
import { Keypair } from "@solana/web3.js";
const mintKeypair = Keypair.generate();
const createInstruction = await PUMP_SDK.createV2Instruction({
mint: mintKeypair.publicKey,
name: "Name",
symbol: "symbol",
uri: "<your ipfs uri>",
creator,
user,
mayhemMode: false,
cashback: false,
});
The mint keypair must sign the transaction alongside user. See
Coin creation for the full account table and the USDC-paired variant.
3. Buy
Every buy_v2 needs a feeRecipient and a buybackFeeRecipient, each picked from the published
address lists — pick a random one per transaction to spread load across accounts.
import { PUMP_SDK } from "@pump-fun/pump-sdk";
import { NATIVE_MINT, TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
import BN from "bn.js";
const buyInstruction = await PUMP_SDK.getBuyV2InstructionRaw({
user,
mint,
creator,
amount: new BN(100_000 * 10 ** 6), // base tokens to receive
quoteAmount: new BN(1_000_000_000), // max quote to spend, fees included
tokenProgram: TOKEN_2022_PROGRAM_ID,
quoteMint: NATIVE_MINT,
quoteTokenProgram: TOKEN_PROGRAM_ID,
feeRecipient,
buybackFeeRecipient,
});
amount is exact and quoteAmount is the slippage cap. Coins created before Token-2022 use
TOKEN_PROGRAM_ID as the base tokenProgram.
4. Sell
const sellInstruction = await PUMP_SDK.getSellV2InstructionRaw({
user,
mint,
creator,
amount: new BN(100_000 * 10 ** 6), // base tokens to sell
quoteAmount: new BN(0), // min quote to receive, after fees
tokenProgram: TOKEN_2022_PROGRAM_ID,
quoteMint: NATIVE_MINT,
quoteTokenProgram: TOKEN_PROGRAM_ID,
feeRecipient,
buybackFeeRecipient,
});
Use a realistic quoteAmount floor in production — 0 accepts any price.
5. Set a compute budget
Used CUs depend on PDA bump seeds and on the size of the logged amounts, so they cannot be predicted without simulating. Simulating before every trade slows submission and increases the chance of slippage errors, so prepend a static limit instead:
import { ComputeBudgetInstruction } from "@solana/web3.js";
const computeIx = ComputeBudgetInstruction.setComputeUnitLimit({ units: 100_000 });
See the FAQ for the reasoning behind the 100_000 recommendation.
6. Claim what you earned
- Traders on cashback coins accrue rewards in their
UserVolumeAccumulatorand claim withclaim_cashback_v2. - Creators accrue fees in a creator vault and sweep them with
collect_creator_fee_v2, pluscollect_coin_creator_feeonce the coin has graduated to PumpSwap.
Rust
The Rust client mirrors these builders: create_v2_and_buy_instruction, buy_v2_instructions,
sell_v2_instructions, claim_cashback_v2_instruction and
collect_creator_fee_v2_instructions. Each instruction page carries the Rust snippet next to the
TypeScript one.
[dependencies]
pump-rust-client = "*"
Before you go live
- Price against effective quote reserves on PumpSwap, not the raw vault balance — see PumpSwap.
- Compute fees from the market-cap tiers in the Fee program rather than hardcoding basis points; tier changes then cost you nothing.
- Raise slippage tolerance temporarily while you verify your fee math end to end.