Launching a token
How token launches work
Creating a token launch
import {
TxVersion,
LAUNCHPAD_PROGRAM,
getPdaLaunchpadConfigId,
CpmmCreatorFeeOn,
} from '@raydium-io/raydium-sdk-v2'
import { initSdk } from './config'
import { Keypair, PublicKey } from '@solana/web3.js'
import { NATIVE_MINT } from '@solana/spl-token'
import BN from 'bn.js'
const createToken = async () => {
const raydium = await initSdk()
// Generate a new mint keypair
const tokenKeypair = Keypair.generate()
// Derive global config (SOL-quoted, constant product)
const configId = getPdaLaunchpadConfigId(
LAUNCHPAD_PROGRAM,
NATIVE_MINT,
0,
0
).publicKey
const { execute, extInfo } = await raydium.launchpad.createLaunchpad({
programId: LAUNCHPAD_PROGRAM,
// Token configuration
mintA: tokenKeypair.publicKey,
decimals: 6,
name: 'My token',
symbol: 'MTK',
uri: 'https://arweave.net/metadata.json',
// Platform (optional)
platformId: new PublicKey('your-platform-id'),
// Global config
configId,
// Migration destination
migrateType: 'cpmm',
// Bonding curve parameters
supply: new BN('1000000000000000'),
totalSellA: new BN('793100000000000'),
totalFundRaisingB: new BN('85000000000'),
// Vesting (optional)
totalLockedAmount: new BN('0'),
cliffPeriod: new BN('0'),
unlockPeriod: new BN('0'),
// Initial buy (optional)
createOnly: true,
buyAmount: new BN('0'),
slippage: new BN(100),
// Post-migration creator fee
creatorFeeOn: CpmmCreatorFeeOn.OnlyTokenB,
// Transaction settings
txVersion: TxVersion.V0,
extraSigners: [tokenKeypair],
})
const { txIds } = await execute({ sendAndConfirm: true, sequentially: true })
console.log('Pool id:', extInfo.address.poolId.toBase58())
console.log('Token mint:', tokenKeypair.publicKey.toBase58())
}Parameter reference
Token configuration
Parameter
Type
Required
Description
Platform and global config
Parameter
Type
Required
Description
Bonding curve parameters
Parameter
Type
Required
Description
Vesting parameters (optional)
Parameter
Type
Required
Description
Initial buy parameters (optional)
Parameter
Type
Required
Description
Post-migration settings
Parameter
Type
Required
Description
Value
Description
Referral parameters (optional)
Parameter
Type
Required
Description
Token-2022 launches
Important notes for Token-2022 launches
Getting available configs
From API
Direct derivation
Common configurations
Quote token
Curve type
Description
Pool lifecycle
Status
Value
Description
Deriving the pool id
Next steps
Last updated
Was this helpful?