Launch a token on the Pump bonding curve in under 50 lines of code.
- Node.js 18+
- A funded Solana wallet (devnet or mainnet)
@pump-fun/pump-sdkinstalled
npm install @pump-fun/pump-sdk @solana/web3.js bn.jsimport { Connection, Keypair, PublicKey } from "@solana/web3.js";
import { PUMP_SDK, OnlinePumpSdk } from "@pump-fun/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
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 "@pump-fun/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();