Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(solana): add vanity grinder + pump.fun create-coin cosign scripts

nirholasdda01ef055a3
diff --git a/.gitignore b/.gitignore
index f8b3c3888..238189dab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,3 +47,10 @@ experiments/*/build
# Reference repo clones (read-only)
forks/*/
.env.production
+
+# Solana keypair files — NEVER commit
+*-vanity.json
+*-mint.json
+test-mint.json
+www-vanity.json
+test-coin-metadata.json
diff --git a/pump-fun-skills/create-coin/package-lock.json b/pump-fun-skills/create-coin/package-lock.json
index a03bfcce4..be5319154 100644
--- a/pump-fun-skills/create-coin/package-lock.json
+++ b/pump-fun-skills/create-coin/package-lock.json
@@ -359,7 +359,6 @@
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.98.4.tgz",
"integrity": "sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/runtime": "^7.25.0",
"@noble/curves": "^1.4.2",
@@ -616,6 +615,20 @@
"node": ">=4.5"
}
},
+ "node_modules/bufferutil": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.1.0.tgz",
+ "integrity": "sha512-ZMANVnAixE6AWWnPzlW2KpUrxhm9woycYvPOo67jWHyFowASTEd9s+QN1EIMsSDtwhIxN4sWE1jotpuDUIgyIw==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "node-gyp-build": "^4.3.0"
+ },
+ "engines": {
+ "node": ">=6.14.2"
+ }
+ },
"node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
@@ -876,6 +889,20 @@
"integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",
"license": "MIT"
},
+ "node_modules/rpc-websockets/node_modules/utf-8-validate": {
+ "version": "6.0.6",
+ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.6.tgz",
+ "integrity": "sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "node-gyp-build": "^4.3.0"
+ },
+ "engines": {
+ "node": ">=6.14.2"
+ }
+ },
"node_modules/rpc-websockets/node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
@@ -1024,7 +1051,6 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=8.3.0"
},
diff --git a/scripts/cosign-send-coin.mjs b/scripts/cosign-send-coin.mjs
new file mode 100644
index 000000000..67f71710c
--- /dev/null
+++ b/scripts/cosign-send-coin.mjs
@@ -0,0 +1,107 @@
+#!/usr/bin/env node
+// Co-signs a partial-signed pump.fun create-coin tx (from build-create-coin-tx.mjs)
+// using a local Solana keypair file, then submits to the configured RPC.
+//
+// Usage: SOLANA_RPC_URL=... node scripts/cosign-send-coin.mjs \
+// --build-json /tmp/coin-build.json --keypair www-vanity.json --mint-keypair test-mint.json
+
+import { readFileSync } from 'node:fs';
+import { parseArgs } from 'node:util';
+import {
+ Connection,
+ Keypair,
+ VersionedTransaction,
+ PublicKey,
+} from '@solana/web3.js';
+
+const { values } = parseArgs({
+ options: {
+ 'build-json': { type: 'string' },
+ keypair: { type: 'string' },
+ 'mint-keypair': { type: 'string' },
+ 'dry-run': { type: 'boolean', default: false },
+ },
+ strict: true,
+});
+
+const buildPath = values['build-json'];
+const keypairPath = values.keypair;
+const mintKeypairPath = values['mint-keypair'];
+const dryRun = Boolean(values['dry-run']);
+if (!buildPath || !keypairPath || !mintKeypairPath) {
+ console.error('usage: --build-json <path> --keypair <path> --mint-keypair <path> [--dry-run]');
+ process.exit(1);
+}
+
+const rpcUrl = process.env.SOLANA_RPC_URL || process.env.NEXT_PUBLIC_SOLANA_RPC_URL;
+if (!rpcUrl) { console.error('set SOLANA_RPC_URL'); process.exit(1); }
+
+const build = JSON.parse(readFileSync(buildPath, 'utf8'));
+const signer = Keypair.fromSecretKey(new Uint8Array(JSON.parse(readFileSync(keypairPath, 'utf8'))));
+const mintKp = Keypair.fromSecretKey(new Uint8Array(JSON.parse(readFileSync(mintKeypairPath, 'utf8'))));
+if (mintKp.publicKey.toBase58() !== build.mintPublicKey) {
+ console.error(`mint keypair mismatch: file=${mintKp.publicKey.toBase58()} build=${build.mintPublicKey}`);
+ process.exit(1);
+}
+const txBytes = Buffer.from(build.transaction, 'base64');
+const tx = VersionedTransaction.deserialize(txBytes);
+
+const conn = new Connection(rpcUrl, 'confirmed');
+
+console.log('signer :', signer.publicKey.toBase58());
+console.log('mint :', build.mintPublicKey);
+console.log('rpc :', rpcUrl);
+console.log('init buy SOL :', (build.solLamports / 1e9).toFixed(6));
+console.log('tokenizedAgent:', build.tokenizedAgent, 'buybackBps:', build.buybackBps);
+
+const balance = await conn.getBalance(signer.publicKey);
+console.log('signer balance:', (balance / 1e9).toFixed(9), 'SOL');
+if (balance < build.solLamports + 0.01 * 1e9) {
+ console.error(`insufficient balance: need ~${(build.solLamports / 1e9 + 0.01).toFixed(4)} SOL, have ${(balance/1e9).toFixed(6)}`);
+ process.exit(2);
+}
+
+const accountKeys = tx.message.staticAccountKeys.map(k => k.toBase58());
+console.log('fee payer :', accountKeys[tx.message.header.numRequiredSignatures > 0 ? 0 : -1]);
+const numSigners = tx.message.header.numRequiredSignatures;
+console.log('required sigs:', numSigners);
+
+console.log('\nrefreshing blockhash + signing with [signer, mint]…');
+const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash('confirmed');
+tx.message.recentBlockhash = blockhash;
+tx.sign([signer, mintKp]);
+
+console.log('\nsimulating…');
+const sim = await conn.simulateTransaction(tx, { sigVerify: true, replaceRecentBlockhash: false });
+if (sim.value.err) {
+ console.error('SIM FAILED:', JSON.stringify(sim.value.err));
+ if (sim.value.logs) console.error('logs:\n' + sim.value.logs.join('\n'));
+ process.exit(3);
+}
+console.log(' units consumed:', sim.value.unitsConsumed);
+console.log(' ok ✓');
+
+if (dryRun) {
+ console.log('\n--dry-run: not sending. Re-run without --dry-run to submit.');
+ process.exit(0);
+}
+
+console.log('\nsending…');
+const sig = await conn.sendRawTransaction(tx.serialize(), {
+ skipPreflight: false,
+ maxRetries: 3,
+});
+console.log(' sig:', sig);
+
+console.log('\nconfirming…');
+const conf = await conn.confirmTransaction({ signature: sig, blockhash, lastValidBlockHeight }, 'confirmed');
+if (conf.value.err) {
+ console.error('CONFIRM FAILED:', JSON.stringify(conf.value.err));
+ console.error('explorer: https://solscan.io/tx/' + sig);
+ process.exit(4);
+}
+
+console.log('\n✦ launched');
+console.log(' mint: ', build.mintPublicKey);
+console.log(' pump.fun: https://pump.fun/coin/' + build.mintPublicKey);
+console.log(' solscan: https://solscan.io/tx/' + sig);
diff --git a/scripts/grind-vanity.mjs b/scripts/grind-vanity.mjs
new file mode 100644
index 000000000..b489d78d4
--- /dev/null
+++ b/scripts/grind-vanity.mjs
@@ -0,0 +1,117 @@
+#!/usr/bin/env node
+// Solana vanity address grinder (Node, parallel).
+// Usage: node scripts/grind-vanity.mjs <prefix> [--ignore-case] [--workers=N] [--out=path]
+
+import { Worker, isMainThread, parentPort, workerData } from 'node:worker_threads';
+import { writeFileSync } from 'node:fs';
+import { cpus } from 'node:os';
+import { Keypair } from '@solana/web3.js';
+
+if (isMainThread) {
+ const argv = process.argv.slice(2);
+ const positional = argv.filter((a) => !a.startsWith('--'));
+ const flags = Object.fromEntries(
+ argv.filter((a) => a.startsWith('--')).map((a) => {
+ const [k, v = 'true'] = a.replace(/^--/, '').split('=');
+ return [k, v];
+ }),
+ );
+
+ const prefix = positional[0];
+ if (!prefix) {
+ console.error('usage: node scripts/grind-vanity.mjs <prefix> [--ignore-case] [--workers=N] [--out=path]');
+ process.exit(1);
+ }
+ const ignoreCase = flags['ignore-case'] === 'true' || flags.i === 'true';
+ const workers = Math.max(1, Number(flags.workers) || cpus().length);
+ const outPath = flags.out || `${prefix.toLowerCase()}-${Date.now()}.json`;
+
+ const BASE58 = /^[1-9A-HJ-NP-Za-km-z]+$/;
+ if (!BASE58.test(prefix)) {
+ console.error(`error: "${prefix}" contains non-Base58 characters (avoid 0, O, I, l)`);
+ process.exit(1);
+ }
+
+ const startedAt = Date.now();
+ console.log(`grinding for prefix "${prefix}" (case-insensitive: ${ignoreCase}) on ${workers} workers…`);
+
+ const pool = [];
+ let totalAttempts = 0;
+ let lastReport = Date.now();
+ let done = false;
+
+ const stopAll = () => {
+ done = true;
+ for (const w of pool) {
+ try { w.terminate(); } catch {}
+ }
+ };
+
+ const onMatch = ({ publicKey, secretKey, attempts }) => {
+ if (done) return;
+ stopAll();
+ totalAttempts += attempts;
+ const durationMs = Date.now() - startedAt;
+ const rate = Math.round((totalAttempts / durationMs) * 1000);
+ writeFileSync(outPath, JSON.stringify(Array.from(secretKey)));
+ console.log('');
+ console.log(`✦ found: ${publicKey}`);
+ console.log(` attempts: ${totalAttempts.toLocaleString()}`);
+ console.log(` duration: ${(durationMs / 1000).toFixed(2)}s`);
+ console.log(` rate: ${rate.toLocaleString()}/s across ${workers} workers`);
+ console.log(` saved keypair → ${outPath}`);
+ console.log('');
+ console.log(`load with: solana-keygen pubkey ${outPath}`);
+ process.exit(0);
+ };
+
+ for (let i = 0; i < workers; i++) {
+ const w = new Worker(new URL(import.meta.url), {
+ workerData: { prefix, ignoreCase, workerId: i },
+ });
+ w.on('message', (msg) => {
+ if (msg.type === 'match') return onMatch(msg);
+ if (msg.type === 'progress') {
+ totalAttempts += msg.delta;
+ const now = Date.now();
+ if (now - lastReport > 500) {
+ const rate = Math.round((totalAttempts / (now - startedAt)) * 1000);
+ process.stdout.write(`\r ${totalAttempts.toLocaleString()} attempts · ${rate.toLocaleString()}/s `);
+ lastReport = now;
+ }
+ }
+ });
+ w.on('error', (err) => {
+ console.error(`worker ${i} crashed:`, err);
+ stopAll();
+ process.exit(1);
+ });
+ pool.push(w);
+ }
+} else {
+ const { prefix, ignoreCase } = workerData;
+ const target = ignoreCase ? prefix.toLowerCase() : prefix;
+ const len = prefix.length;
+ let attempts = 0;
+ const REPORT_EVERY = 2000;
+
+ while (true) {
+ const kp = Keypair.generate();
+ attempts++;
+ const addr = kp.publicKey.toBase58();
+ const head = addr.slice(0, len);
+ const match = ignoreCase ? head.toLowerCase() === target : head === target;
+ if (match) {
+ parentPort.postMessage({
+ type: 'match',
+ publicKey: addr,
+ secretKey: Array.from(kp.secretKey),
+ attempts,
+ });
+ break;
+ }
+ if (attempts % REPORT_EVERY === 0) {
+ parentPort.postMessage({ type: 'progress', delta: REPORT_EVERY });
+ }
+ }
+}