Launch a token on the Pump bonding curve in under 50 lines of code.
- Node.js 18+
- A funded Solana wallet (devnet or mainnet)
@nirholas/pump-sdkinstalled
npm install @nirholas/pump-sdk @solana/web3.js bn.jsimport { Connection, Keypair, PublicKey } from "@solana/web3.js";
import { PUMP_SDK, OnlinePumpSdk } from "@nirholas/pump-sdk";
// Connect to Solana devnet (use mainnet-beta for production)
const connection = new Connection("https://api.devnet.solana.com", "confirmed");
const onlineSdk = new OnlinePumpSdk(connection);
// Load your wallet keypair
const creator = Keypair.generate(); // Replace with your funded keypairEvery Pump token needs a unique mint address. Generate one:
const mint = Keypair.generate();
console.log("Token mint address:", mint.publicKey.toBase58());Use createV2Instruction (the v1 createInstruction is deprecated):
const createIx = await PUMP_SDK.createV2Instruction({
mint: mint.publicKey,
name: "My First Token",
symbol: "MFT",
uri: "https://example.com/metadata.json", // Your token metadata URI
creator: creator.publicKey,
user: creator.publicKey,
mayhemMode: false,
cashback: false,
});mint— The new token's mint address (you must sign with this keypair)name/symbol/uri— Standard SPL token metadatacreator— The address that receives creator fees from tradinguser— The wallet paying for the transactionmayhemMode— Whentrue, enables special Mayhem mode mechanicscashback— Whentrue, enables cashback rewards on this token
The uri should point to a JSON file following the Metaplex token metadata standard:
{
"name": "My First Token",
"symbol": "MFT",
"description": "A token created with the Pump SDK",
"image": "https://example.com/token-image.png"
}Host this JSON on IPFS, Arweave, or any public URL. The image should be a square PNG or SVG (recommended 512×512).
import {
TransactionMessage,
VersionedTransaction,
} from "@solana/web3.js";
const { blockhash } = await connection.getLatestBlockhash("confirmed");
const message = new TransactionMessage({
payerKey: creator.publicKey,
recentBlockhash: blockhash,
instructions: [createIx],
}).compileToV0Message();
const tx = new VersionedTransaction(message);
tx.sign([creator, mint]); // Both creator AND mint must sign
const signature = await connection.sendTransaction(tx);
console.log("Token created! Tx:", signature);Important: The mint keypair must sign the transaction — this proves you own the mint address.
const bondingCurve = await onlineSdk.fetchBondingCurve(mint.publicKey);
console.log("Token total supply:", bondingCurve.tokenTotalSupply.toString());
console.log("Bonding curve complete:", bondingCurve.complete);
console.log("Creator:", bondingCurve.creator.toBase58());import { Connection, Keypair, TransactionMessage, VersionedTransaction } from "@solana/web3.js";
import { PUMP_SDK, OnlinePumpSdk } from "@nirholas/pump-sdk";
async function createToken() {
const connection = new Connection("https://api.devnet.solana.com", "confirmed");
const creator = Keypair.generate(); // Use your funded keypair
const mint = Keypair.generate();
// Build the instruction
const createIx = await PUMP_SDK.createV2Instruction({
mint: mint.publicKey,
name: "My First Token",
symbol: "MFT",
uri: "https://example.com/metadata.json",
creator: creator.publicKey,
user: creator.publicKey,
mayhemMode: false,
cashback: false,
});
// Send transaction
const { blockhash } = await connection.getLatestBlockhash("confirmed");
const message = new TransactionMessage({
payerKey: creator.publicKey,
recentBlockhash: blockhash,
instructions: [createIx],
}).compileToV0Message();
const tx = new VersionedTransaction(message);
tx.sign([creator, mint]);
const signature = await connection.sendTransaction(tx);
console.log("Token created!", signature);
}
createToken();- Tutorial 2: Buy Tokens from the Bonding Curve
- Tutorial 4: Create and Buy in One Transaction
- Tutorial 5: Bonding Curve Math Deep Dive — Understand pricing
- Tutorial 7: Set Up Fee Sharing — Split creator fees with your team