跳到正文
cccskills
免费在 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.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md2.9 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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)

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

1password

免费

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.

中文简介正在准备中。当前显示原文说明。

x402agent/SolanaOS92026年7月23日 更新

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.

中文简介正在准备中。当前显示原文说明。

x402agent/SolanaOS92026年7月23日 更新

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

中文简介正在准备中。当前显示原文说明。

x402agent/SolanaOS92026年7月23日 更新

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

中文简介正在准备中。当前显示原文说明。

x402agent/SolanaOS92026年7月23日 更新

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

中文简介正在准备中。当前显示原文说明。

x402agent/SolanaOS92026年7月23日 更新

blucli

免费

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

中文简介正在准备中。当前显示原文说明。

x402agent/SolanaOS92026年7月23日 更新

查看 x402agent 的全部技能

报告此技能的问题