Skip to main content

Token Creation Guide

What you'll learn
  • How to create token metadata on IPFS
  • Upload token images and metadata
  • Create new tokens on Pump.Fun
  • Set up initial liquidity

Introduction

This guide explains the complete token creation process including metadata storage and token deployment. The process involves two main steps:

  1. Creating token metadata on IPFS
  2. Deploying the token using the metadata URI
Access Requirements

Token Creation Process

Step 1: Create Token Metadata

First, upload your token's image and metadata to IPFS:

import { promises as fs } from 'fs';

async function createTokenMetadata(
name: string,
symbol: string,
description: string,
imagePath: string,
socials: {
twitter?: string,
telegram?: string,
website?: string
}
) {
const formData = new FormData();

// Add image file
const imageFile = await fs.openAsBlob(imagePath);
formData.append("file", imageFile);

// Add metadata
formData.append("name", name);
formData.append("symbol", symbol);
formData.append("description", description);
formData.append("showName", "true");

// Add social links if provided
if (socials.twitter) formData.append("twitter", socials.twitter);
if (socials.telegram) formData.append("telegram", socials.telegram);
if (socials.website) formData.append("website", socials.website);

const response = await fetch("https://Pump.Fun/api/ipfs", {
method: "POST",
body: formData,
});

if (!response.ok) {
throw new Error(`Failed to upload metadata: ${response.statusText}`);
}

return await response.json();

}

Step 2: Deploy Token

After creating the metadata, use the returned URI to deploy your token:

import { 
Connection,
VersionedTransaction,
VersionedMessage,
Keypair
} from '@solana/web3.js';
import bs58 from 'bs58';

class PumpFunTokenCreator {
private apiKey: string;
private connection: Connection;

constructor(rpcEndpoint: string, apiKey: string) {
this.connection = new Connection(rpcEndpoint, 'confirmed');
this.apiKey = apiKey;
}

async deployToken(
signerKeypair: Keypair,
name: string,
symbol: string,
description: string,
imagePath: string,
socials: {
twitter?: string,
telegram?: string,
website?: string
} = {},
initialLiquidityLamports: string = "0",
slippage: number = 1.5,
priorityFeeMicroLamports: number = 1000
) {
// Create mint keypair
const mintKeypair = Keypair.generate();

// Upload metadata and get URI
const metadataResponse = await createTokenMetadata(
name,
symbol,
description,
imagePath,
socials
);

// Create token with metadata URI
const response = await fetch(
'https://api.callstaticrpc.com/pumpfun/v1/transactions/getCreateInstruction',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.apiKey}`
},
body: JSON.stringify({
signer: signerKeypair.publicKey.toString(),
tokenMetadata: {
name,
symbol,
uri: metadataResponse.metadataUri
},
mint: mintKeypair.publicKey.toString(),
amount: initialLiquidityLamports,
slippage,
priorityFee: priorityFeeMicroLamports
})
}
);

if (!response.ok) {
throw new Error(`API error: ${response.statusText}`);
}

const result = await response.json();
if (!result.success || !result.data) {
throw new Error('Failed to generate transaction');
}

const message = VersionedMessage.deserialize(
new Uint8Array(result.data)
);

const transaction = new VersionedTransaction(message);

transaction.sign([signerKeypair]);

const signature = await this.connection.sendTransaction(transaction);

return {
signature,
mint: mintKeypair.publicKey.toString(),
metadataUri: metadataResponse.metadataUri
};
}

}

Complete Usage Example

Here's how to create a token with all metadata and initial liquidity:

const creator = new PumpFunTokenCreator(
'YOUR_RPC_ENDPOINT',
'YOUR_API_KEY'
);

// Create token with metadata and initial liquidity
const result = await creator.deployToken(
Keypair.fromSecretKey(bs58.decode('your-wallet-private-key')),
'PPTest',
'TEST',
'This is an example token created via Pump.Fun',
'./example.png',
{
twitter: 'https://x.com/example',
telegram: 'https://t.me/example',
website: 'https://example.com'
},
'1000000000', // 1 SOL initial liquidity
1.5, // 1.5% slippage
1000 // 1000 microlamports priority fee
);

console.log(`Transaction: https://solscan.io/tx/${result.signature}`);
console.log(`Token Mint: ${result.mint}`);
console.log(`Metadata URI: ${result.metadataUri}`);

Best Practices

  1. Metadata Preparation

    • Use high-quality images
    • Provide comprehensive token descriptions
    • Include relevant social links
    • Verify metadata before deployment
  2. Token Deployment

    • Store mint address and metadata URI
    • Monitor transaction status
    • Implement proper error handling
    • Consider initial liquidity carefully
  3. Security

    • Never share private keys
    • Store API keys securely
    • Validate all input data
    • Use environment variables for sensitive data

Next Steps

Now that you understand the complete token creation process, you can:

  1. 🚀 Prepare token metadata
  2. 📊 Deploy your token
  3. 💧 Add initial liquidity
  4. 🔄 Monitor token performance
Need Help?

For additional support: