Pump.fun Token Creation
You can create tokens on pump.fun using the Managed or Local Trading APIs.
There is no additional fee for token creation. The standard trading fee of 0.5% is applied to the initial dev buy.
Examples below:
Local Trading Examples:
- Python
- JavaScript
import requests
import json
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction
from solders.keypair import Keypair
from solders.commitment_config import CommitmentLevel
from solders.rpc.requests import SendVersionedTransaction
from solders.rpc.config import RpcSendTransactionConfig
def send_local_create_tx():
signer_keypair = Keypair.from_base58_string('your-base58-private-key')
# Generate a random keypair for token
mint_keypair = Keypair()
# Define token metadata
form_data = {
'name': 'PPTest',
'symbol': 'TEST',
'description': 'This is an example token created via PumpPortal.fun',
'twitter': 'https://x.com/a1lon9/status/1812970586420994083',
'telegram': 'https://x.com/a1lon9/status/1812970586420994083',
'website': 'https://pumpportal.fun',
'showName': 'true'
}
# Read the image file
with open('./example.png', 'rb') as f:
file_content = f.read()
files = {
'file': ('example.png', file_content, 'image/png')
}
# Create IPFS metadata storage
metadata_response = requests.post("https://pump.fun/api/ipfs", data=form_data, files=files)
metadata_response_json = metadata_response.json()
# Token metadata
token_metadata = {
'name': form_data['name'],
'symbol': form_data['symbol'],
'uri': metadata_response_json['metadataUri']
}
# Generate the create transaction
response = requests.post(
"https://pumpportal.fun/api/trade-local",
headers={'Content-Type': 'application/json'},
data=json.dumps({
'publicKey': str(signer_keypair.pubkey()),
'action': 'create',
'tokenMetadata': token_metadata,
'mint': str(mint_keypair.pubkey()),
'denominatedInSol': 'true',
'amount': 1, # Dev buy of 1 SOL
'slippage': 10,
'priorityFee': 0.0005,
'pool': 'pump'
})
)
tx = VersionedTransaction(VersionedTransaction.from_bytes(response.content).message, [mint_keypair, signer_keypair])
commitment = CommitmentLevel.Confirmed
config = RpcSendTransactionConfig(preflight_commitment=commitment)
txPayload = SendVersionedTransaction(tx, config)
response = requests.post(
url="Your RPC endpoint - Eg: https://api.mainnet-beta.solana.com/",
headers={"Content-Type": "application/json"},
data=SendVersionedTransaction(tx, config).to_json()
)
txSignature = response.json()['result']
print(f'Transaction: https://solscan.io/tx/{txSignature}')
send_local_create_tx()
import { VersionedTransaction, Connection, Keypair } from '@solana/web3.js';
import bs58 from "bs58";
const RPC_ENDPOINT = "Your RPC Endpoint";
const web3Connection = new Connection(
RPC_ENDPOINT,
'confirmed',
);
async function sendLocalCreateTx(){
const signerKeyPair = Keypair.fromSecretKey(bs58.decode("your-wallet-private-key"));
// Generate a random keypair for token
const mintKeypair = Keypair.generate();
// Define token metadata
const formData = new FormData();
formData.append("file", await fs.openAsBlob("./example.png")), // Image file
formData.append("name", "PPTest"),
formData.append("symbol", "TEST"),
formData.append("description", "This is an example token created via PumpPortal.fun"),
formData.append("twitter", "https://x.com/a1lon9/status/1812970586420994083"),
formData.append("telegram", "https://x.com/a1lon9/status/1812970586420994083"),
formData.append("website", "https://pumpportal.fun"),
formData.append("showName", "true");
// Create IPFS metadata storage
const metadataResponse = await fetch("https://pump.fun/api/ipfs", {
method: "POST",
body: formData,
});
const metadataResponseJSON = await metadataResponse.json();
// Get the create transaction
const response = await fetch(`https://pumpportal.fun/api/trade-local`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"publicKey": 'your-wallet-public-key',
"action": "create",
"tokenMetadata": {
name: metadataResponseJSON.metadata.name,
symbol: metadataResponseJSON.metadata.symbol,
uri: metadataResponseJSON.metadataUri
},
"mint": mintKeypair.publicKey.toBase58(),
"denominatedInSol": "true",
"amount": 1, // dev buy of 1 SOL
"slippage": 10,
"priorityFee": 0.0005,
"pool": "pump"
})
});
if(response.status === 200){ // successfully generated transaction
const data = await response.arrayBuffer();
const tx = VersionedTransaction.deserialize(new Uint8Array(data));
tx.sign([mintKeypair, signerKeyPair]);
const signature = await web3Connection.sendTransaction(tx)
console.log("Transaction: https://solscan.io/tx/" + signature);
} else {
console.log(response.statusText); // log error
}
}
sendLocalCreateTx();
Managed Trading Examples:
- Python
- JavaScript
import requests
import json
from solders.keypair import Keypair
def send_create_tx():
# Generate a random keypair for token
mint_keypair = Keypair()
# Define token metadata
form_data = {
'name': 'PPTest',
'symbol': 'TEST',
'description': 'This is an example token created via PumpPortal.fun',
'twitter': 'https://x.com/a1lon9/status/1812970586420994083',
'telegram': 'https://x.com/a1lon9/status/1812970586420994083',
'website': 'https://pumpportal.fun',
'showName': 'true'
}
# Read the image file
with open('./example.png', 'rb') as f:
file_content = f.read()
files = {
'file': ('example.png', file_content, 'image/png')
}
# Create IPFS metadata storage
metadata_response = requests.post("https://pump.fun/api/ipfs", data=form_data, files=files)
metadata_response_json = metadata_response.json()
# Token metadata
token_metadata = {
'name': form_data['name'],
'symbol': form_data['symbol'],
'uri': metadata_response_json['metadataUri']
}
# Send the create transaction
response = requests.post(
"https://pumpportal.fun/api/trade?api-key=your-api-key",
headers={'Content-Type': 'application/json'},
data=json.dumps({
'action': 'create',
'tokenMetadata': token_metadata,
'mint': str(mint_keypair),
'denominatedInSol': 'true',
'amount': 1, # Dev buy of 1 SOL
'slippage': 10,
'priorityFee': 0.0005,
'pool': 'pump'
})
)
if response.status_code == 200: # successfully generated transaction
data = response.json()
print(f"Transaction: https://solscan.io/tx/{data['signature']}")
else:
print(response.reason) # log error
send_create_tx()
async function sendCreateTx(){
// Generate a random keypair for token
const mintKeypair = Keypair.generate();
// Define token metadata
const formData = new FormData();
formData.append("file", await fs.openAsBlob("./example.png")), // Image file
formData.append("name", "PPTest"),
formData.append("symbol", "TEST"),
formData.append("description", "This is an example token created via PumpPortal.fun"),
formData.append("twitter", "https://x.com/a1lon9/status/1812970586420994083"),
formData.append("telegram", "https://x.com/a1lon9/status/1812970586420994083"),
formData.append("website", "https://pumpportal.fun"),
formData.append("showName", "true");
// Create IPFS metadata storage
const metadataResponse = await fetch("https://pump.fun/api/ipfs", {
method: "POST",
body: formData,
});
const metadataResponseJSON = await metadataResponse.json();
// Send the create transaction
const response = await fetch(`https://pumpportal.fun/api/trade?api-key=your-api-key`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"action": "create",
"tokenMetadata": {
name: metadataResponseJSON.metadata.name,
symbol: metadataResponseJSON.metadata.symbol,
uri: metadataResponseJSON.metadataUri
},
"mint": bs58.encode(mintKeypair.secretKey),
"denominatedInSol": "true",
"amount": 1, // Dev buy of 1 SOL
"slippage": 10,
"priorityFee": 0.0005,
"pool": "pump"
})
});
if(response.status === 200){ // successfully generated transaction
const data = await response.json();
console.log("Transaction: https://solscan.io/tx/" + data.signature);
} else {
console.log(response.statusText); // log error
}
}
sendCreateTx();
Jito Bundle Examples:
- JavaScript
async function sendLocalCreateBundle(){
const signerKeyPairs = [
Keypair.fromSecretKey(bs58.decode("Wallet A base 58 private key here")),
Keypair.fromSecretKey(bs58.decode("Wallet B base 58 private key here")),
// use up to 5 wallets
];
const mintKeypair = Keypair.generate(); // generates a random keypair for token
let tokenMetadata = {
name: "TEST",
symbol: "AAA",
description: "This is an example token created via PumpPortal.fun",
twitter: "https://x.com/a1lon9/status/1812970586420994083",
telegram: "https://x.com/a1lon9/status/1812970586420994083",
website: "https://pumpportal.fun",
file: await fs.openAsBlob("./new-moon-face.png"),
};
let formData = new FormData();
formData.append("file", tokenMetadata.file),
formData.append("name", tokenMetadata.name),
formData.append("symbol", tokenMetadata.symbol),
formData.append("description", tokenMetadata.description),
formData.append("twitter", tokenMetadata.twitter || ""),
formData.append("telegram", tokenMetadata.telegram || ""),
formData.append("website", tokenMetadata.website || ""),
formData.append("showName", "true");
let metadataResponse = await fetch("https://pump.fun/api/ipfs", {
method: "POST",
body: formData,
});
let metadataResponseJSON = await metadataResponse.json();
const bundledTxArgs = [
{
"publicKey": signerKeyPairs[0].publicKey.toBase58(),
"action": "create",
"tokenMetadata": {name: tokenMetadata.name, symbol: tokenMetadata.symbol, uri: metadataResponseJSON.metadataUri},
"mint": mintKeypair.publicKey.toBase58(),
"denominatedInSol": "false",
"amount": 10000000,
"slippage": 10,
"priorityFee": 0.0001, // priority fee on the first tx is used for jito tip
"pool": "pump"
},
{
publicKey: signerKeyPairs[1].publicKey.toBase58(),
"action": "buy",
"mint": mintKeypair.publicKey.toBase58(),
"denominatedInSol": "false",
"amount": 10000000,
"slippage": 10,
"priorityFee": 0.00005, // priority fee after first tx is ignored
"pool": "pump"
},
// use up to 5 transactions
];
const response = await fetch(`https://pumpportal.fun/api/trade-local`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(bundledTxArgs)
});
if(response.status === 200){ // successfully generated transactions
const transactions = await response.json();
let encodedSignedTransactions = [];
let signatures = [];
for(let i = 0; i < bundledTxArgs.length; i++){
const tx = VersionedTransaction.deserialize(new Uint8Array(bs58.decode(transactions[i])));
if(bundledTxArgs[i].action === "create"){ // creation transaction needs to be signed by mint and creator keypairs
tx.sign([mintKeypair, signerKeyPairs[i]])
} else {
tx.sign([signerKeyPairs[i]]);
}
encodedSignedTransactions.push(bs58.encode(tx.serialize()));
signatures.push(bs58.encode(tx.signatures[0]));
}
try{
const jitoResponse = await fetch(`https://mainnet.block-engine.jito.wtf/api/v1/bundles`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "sendBundle",
"params": [
encodedSignedTransactions
]
})
});
console.log(jitoResponse);
} catch(e){
console.error(e.message);
}
for(let i = 0; i < signatures.length; i++){
console.log(`Transaction ${i}: https://solscan.io/tx/${signatures[i]}`);
}
} else {
console.log(response.statusText); // log error
}
}
sendLocalCreateBundle();