Skip to content
cccskills
FreePublished on GitHub

pump-ts-vanity

Educational single-threaded TypeScript vanity address generator for Solana using @solana/web3.js with async iteration, event-loop yielding, streaming generator API, and best-effort memory zeroization.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md2.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

TypeScript Vanity Generator — Educational Reference Implementation

Single-threaded TypeScript vanity address generator using @solana/web3.js with async iteration, event-loop yielding, and streaming generator API.

Architecture

CLI / Library API
        │
   VanityGenerator
        │
   async generator loop
        │
   Keypair.generate() per iteration
        │
   AddressMatcher.matches()
        │
   yield on match / yield progress

Library API (3 Usage Patterns)

// 1. Async generator (streaming)
for await (const result of generateVanityAddress({ prefix: 'pump' })) {
    console.log(result.address);
    break; // stop after first match
}

// 2. First match (promise)
const result = await findVanityAddress({ prefix: 'pump' });

// 3. Batch generation
const results = await findVanityAddresses({ prefix: 'So', count: 5 });

Event-Loop Yielding

async function* generateVanityAddress(config: VanityConfig) {
    let attempts = 0;
    while (true) {
        attempts++;
        if (attempts % 1000 === 0) {
            await new Promise(resolve => setImmediate(resolve));
        }
        const keypair = Keypair.generate();
        const address = keypair.publicKey.toBase58();
        if (matcher.matches(address)) {
            yield { keypair, address, attempts };
        }
    }
}

Yields to the event loop every 1,000 iterations to prevent blocking.

Performance Comparison

FeatureRustTypeScript
Speed100K+ keys/sec~5K keys/sec
ParallelismRayon (multi-core)Single-threaded
Memory safetyZeroize traitBest-effort fill(0)
Use caseProductionEducational/prototyping

Best-Effort Security

// Zeroize secret key after use
const secretKey = keypair.secretKey;
try {
    // ... use keypair
} finally {
    secretKey.fill(0);
}

JavaScript's garbage collector may copy/relocate buffers, so fill(0) is best-effort.

Patterns to Follow

  • Use @solana/web3.js Keypair.generate() — never custom RNG
  • Yield to event loop periodically in async generators
  • Call secretKey.fill(0) after use (best-effort zeroization)
  • Validate Base58 patterns before starting generation
  • Use setImmediate or setTimeout(0) for yielding, not process.nextTick

Common Pitfalls

  • Single-threaded — orders of magnitude slower than Rust for long prefixes
  • GC may relocate buffers before fill(0) — no guaranteed memory cleanup in JS
  • Base58 is case-sensitive — validate user input patterns
  • Keypair.generate() returns 64-byte array (32 secret + 32 public)

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.

The English summary is being prepared. Showing the original description.

x402agent/SolanaOS9Updated Jul 23, 2026

Manage Apple Notes via the `memo` CLI on macOS (create, view, edit, delete, search, move, and export notes). Use when a user asks SolanaOS to add a note, list notes, search notes, or manage note folders.

The English summary is being prepared. Showing the original description.

x402agent/SolanaOS9Updated Jul 23, 2026

Manage Apple Reminders via remindctl CLI (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.

The English summary is being prepared. Showing the original description.

x402agent/SolanaOS9Updated Jul 23, 2026

Create, search, and manage Bear notes via grizzly CLI.

The English summary is being prepared. Showing the original description.

x402agent/SolanaOS9Updated Jul 23, 2026

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

The English summary is being prepared. Showing the original description.

x402agent/SolanaOS9Updated Jul 23, 2026

blucli

Free

BluOS CLI (blu) for discovery, playback, grouping, and volume.

The English summary is being prepared. Showing the original description.

x402agent/SolanaOS9Updated Jul 23, 2026

See all skills by x402agent

Report a problem with this skill