Local Trade API
The non-custodial way to trade Solana memecoins through an API. Your wallet stays on your computer - we never see your private key. You submit your trade through your own RPC.
What you need
- A Solana wallet - its private key in base58. (Phantom: Settings → Show Secret Recovery Phrase → Show Private Key.)
- Some SOL in that wallet - enough for the trade plus a small amount of network fees.
- A Solana RPC endpoint to actually submit the trade. The public one (
https://api.mainnet-beta.solana.com) works for testing but gets rate-limited; for real use grab a free or paid RPC from Helius, Triton, QuickNode, or similar. - Node.js or Python installed if you want to run the snippet below as-is.
Example
- JavaScript
- Python
import { Connection, Keypair, VersionedTransaction } from "@solana/web3.js";
import bs58 from "bs58";
const conn = new Connection("https://api.mainnet-beta.solana.com"); // your own RPC
const wallet = Keypair.fromSecretKey(bs58.decode(process.env.WALLET_SECRET));
// 1. Ask pumpdata to build an unsigned transaction.
const res = await fetch("https://api.pumpdata.fun/api/local-trade", {
method: "POST",
headers: { "content-type": "application/json", "accept": "application/json" },
body: JSON.stringify({
action: "buy", // "buy" or "sell"
publicKey: wallet.publicKey.toBase58(),
mint: "<token mint>", // base58 token mint
amount: 0.01, // SOL when amountInSol=true, tokens otherwise
amountInSol: true, // true → amount is SOL; false → tokens
slippage: 10, // percent
priorityFee: 0.0001, // SOL
pool: "pump", // dex selector
}),
});
const { tx } = await res.json();
// 2. Sign locally - your private key never leaves this script.
const txObj = VersionedTransaction.deserialize(Buffer.from(tx, "base64"));
txObj.sign([wallet]);
// 3. Submit via your own RPC.
const sig = await conn.sendRawTransaction(txObj.serialize());
console.log("https://solscan.io/tx/" + sig);
import base64, requests, base58
from solana.rpc.api import Client
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction
client = Client("https://api.mainnet-beta.solana.com") # your own RPC
wallet = Keypair.from_bytes(base58.b58decode(WALLET_SECRET))
# 1. Ask pumpdata to build an unsigned transaction.
res = requests.post(
"https://api.pumpdata.fun/api/local-trade",
headers={"accept": "application/json"},
json={
"action": "buy", # "buy" or "sell"
"publicKey": str(wallet.pubkey()),
"mint": "<token mint>", # base58 token mint
"amount": 0.01, # SOL when amountInSol=True, tokens otherwise
"amountInSol": True, # True → amount is SOL; False → tokens
"slippage": 10, # percent
"priorityFee": 0.0001, # SOL
"pool": "pump", # dex selector
},
)
tx_b64 = res.json()["tx"]
# 2. Sign locally - your private key never leaves this script.
raw = VersionedTransaction.from_bytes(base64.b64decode(tx_b64))
signed = VersionedTransaction(raw.message, [wallet])
# 3. Submit via your own RPC.
sig = client.send_raw_transaction(bytes(signed)).value
print(f"https://solscan.io/tx/{sig}")
How it works
- You ask pumpdata for a trade. We build an unsigned transaction.
- You sign the transaction on your machine, with your own wallet.
- You submit the signed transaction through your own RPC.
If something goes wrong
You'll get a response like { "error": "..." } with a short message. Usual causes: a wrong wallet address, a wrong token mint, or not enough SOL.
If you want pumpdata to sign and submit on your behalf, see the Lightning Transactions page - that's the managed-wallet flow with one-click execution.