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:
- Creating token metadata on IPFS
- Deploying the token using the metadata URI
Access Requirements
- Valid API key (visit https://app.callstatic.com for tier information)
- Rate limits vary by subscription tier
Token Creation Process
Step 1: Create Token Metadata
First, upload your token's image and metadata to IPFS:
- TypeScript
- Python
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();
}
import requests
def create_token_metadata(
name: str,
symbol: str,
description: str,
image_path: str,
socials: dict = None
):
# Prepare form data
form_data = {
'name': name,
'symbol': symbol,
'description': description,
'showName': 'true'
}
# Add social links if provided
if socials:
if 'twitter' in socials: form_data['twitter'] = socials['twitter']
if 'telegram' in socials: form_data['telegram'] = socials['telegram']
if 'website' in socials: form_data['website'] = socials['website']
# Prepare image file
files = {
'file': ('image.png', open(image_path, 'rb'), 'image/png')
}
response = requests.post(
"https://Pump.Fun/api/ipfs",
data=form_data,
files=files
)
if response.status_code != 200:
raise Exception(f"Failed to upload metadata: {response.text}")
return response.json()
Step 2: Deploy Token
After creating the metadata, use the returned URI to deploy your token:
- TypeScript
- Python
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
};
}
}
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction
from solders.transaction import VersionedMessage
from solders.commitment_config import CommitmentLevel
from solders.rpc.requests import SendVersionedTransaction
from solders.rpc.config import RpcSendTransactionConfig
import requests
class PumpFunTokenCreator:
def __init__(self, rpc_endpoint: str, api_key: str):
self.rpc_endpoint = rpc_endpoint
self.api_key = api_key
def deploy_token(
self,
signer_keypair: Keypair,
name: str,
symbol: str,
description: str,
image_path: str,
socials: dict = None,
initial_liquidity_lamports: str = "0",
slippage: float = 1.5,
priority_fee_micro_lamports: int = 1000
):
# Create mint keypair
mint_keypair = Keypair()
# Upload metadata and get URI
metadata_response = create_token_metadata(
name,
symbol,
description,
image_path,
socials
)
# Create token with metadata URI
response = requests.post(
"https://api.callstaticrpc.com/pumpfun/v1/transactions/getCreateInstruction",
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
},
json={
'signer': str(signer_keypair.pubkey()),
'tokenMetadata': {
'name': name,
'symbol': symbol,
'uri': metadata_response['metadataUri']
},
'mint': str(mint_keypair.pubkey()),
'amount': initial_liquidity_lamports,
'slippage': slippage,
'priorityFee': priority_fee_micro_lamports
}
)
if response.status_code != 200:
raise Exception(f"Failed to generate transaction: {response.text}")
# Parse response content into message
message = VersionedMessage.deserialize(bytes(response.content))
# Create new transaction from message and sign with both keypairs
tx = VersionedTransaction(message)
tx.sign([signer_keypair])
config = RpcSendTransactionConfig(
preflight_commitment=CommitmentLevel.Confirmed
)
tx_payload = SendVersionedTransaction(tx, config)
response = requests.post(
url=self.rpc_endpoint,
headers={"Content-Type": "application/json"},
data=tx_payload.to_json()
)
tx_signature = response.json()['result']
return {
'signature': tx_signature,
'mint': str(mint_keypair.pubkey()),
'metadataUri': metadata_response['metadataUri']
}
Complete Usage Example
Here's how to create a token with all metadata and initial liquidity:
- TypeScript
- Python
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}`);
creator = PumpFunTokenCreator(
'YOUR_RPC_ENDPOINT',
'YOUR_API_KEY'
)
# Create token with metadata and initial liquidity
result = creator.deploy_token(
Keypair.from_base58_string('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
)
print(f"Transaction: https://solscan.io/tx/{result['signature']}")
print(f"Token Mint: {result['mint']}")
print(f"Metadata URI: {result['metadataUri']}")
Best Practices
-
Metadata Preparation
- Use high-quality images
- Provide comprehensive token descriptions
- Include relevant social links
- Verify metadata before deployment
-
Token Deployment
- Store mint address and metadata URI
- Monitor transaction status
- Implement proper error handling
- Consider initial liquidity carefully
-
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:
- 🚀 Prepare token metadata
- 📊 Deploy your token
- 💧 Add initial liquidity
- 🔄 Monitor token performance
Need Help?
For additional support:
- Email us at [email protected]
- Visit our Support Portal