npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@visualkey/find-rare-keys

v1.1.0

Published

A WebAssembly (WASM) module for generating and searching for rare secp256k1 cryptographic keys, designed for integration with the VisualKey app.

Readme

VisualKey Rare Key Finder (WASM)

A WebAssembly (WASM) module for generating and searching for rare cryptographic keys, designed specifically for integration with the VisualKey app.
Built with Rust, compiled to WASM, and ready for seamless use in JavaScript/TypeScript frontends.

Features

  • Generates random secp256k1 private keys
  • Computes Ethereum addresses
  • Calculates the rarity level (number of leading zero bits) of addresses
  • Batch search for rare keys with a configurable threshold
  • Finds an address matching a custom bitmask
  • Exposes a simple WASM interface for use in a web worker or the main thread

Usage

1. Build the WASM package

wasm-pack build --target web --out-dir pkg

2. Import and initialize in JavaScript/TypeScript

import init, { generate_rare_keys_batch, find_address_with_mask } from 'find-rare-keys';

// Make sure to provide the correct path to the WASM file
await init({ module_or_path: '/assets/find_rare_keys_bg.wasm' });

const foundKeys = generate_rare_keys_batch(levelThreshold, batchSize);

// Example usage of find_address_with_mask:
const valueMask = new Uint8Array(20); // desired address bits
const careMask = new Uint8Array(20);  // which bits to care about (1 = must match, 0 = don't care)
const batchSize = 10000;              // number of attempts per call
const mask = new Uint8Array(44);
mask.set(valueMask, 0);
mask.set(careMask, 20);
mask.set(new Uint8Array([
  (batchSize >> 24) & 0xFF,
  (batchSize >> 16) & 0xFF,
  (batchSize >> 8) & 0xFF,
  batchSize & 0xFF
]), 40);

const result = find_address_with_mask(mask);
if (result) {
  // result.private_key and result.address are Uint8Arrays
}

3. Example: Using in a Web Worker

import init, { generate_rare_keys_batch } from 'find-rare-keys';

onmessage = async ({ data }) => {
  await init({ module_or_path: '/assets/find_rare_keys_bg.wasm' });
  const foundKeys = generate_rare_keys_batch(data.levelThreshold, 1000);
  postMessage(foundKeys);
};

API

generate_rare_keys_batch(levelThreshold: number, batchSize: number): Array<{ privateKey, address, level }>

Finds keys with addresses that have at least levelThreshold leading zero bits.

find_address_with_mask(mask: Uint8Array): { privateKey, address } | null

Finds a private key whose address matches a custom bitmask.

  • mask: A 44-byte Uint8Array:
    • Bytes 0..20: valueMask (desired address bits)
    • Bytes 20..40: careMask (which bits to match: 1 = must match, 0 = don't care)
    • Bytes 40..44: batchSize (big-endian u32, number of attempts per call)
  • Returns: An object { private_key, address } if found, or null if not found in the batch.

Why a single mask parameter?
Due to limitations and subtle pitfalls in how WebAssembly and wasm-bindgen handle multiple complex arguments (such as multiple Uint8Arrays or a mix of arrays and numbers), passing all required data as a single packed buffer ensures robust and predictable interop between JavaScript and Rust.
When multiple arrays or mixed types are passed as separate parameters, memory allocation and glue code issues can cause arguments after the first to be received incorrectly (e.g., as zero-length arrays or zeros).
By combining all inputs into a single Uint8Array, we avoid these issues and guarantee correct data transfer.

Note:
Ethereum addresses are always 160 bits (20 bytes), so both valueMask and careMask must be exactly 20 bytes each to fully specify which bits of the address to match or ignore.

Example

const valueMask = new Uint8Array(20); // e.g., [0,0,0,0,...]
const careMask = new Uint8Array(20);  // e.g., [255,255,0,0,...] (only first two bytes must match)
const batchSize = 10000;
const mask = new Uint8Array(44);
mask.set(valueMask, 0);
mask.set(careMask, 20);
mask.set(new Uint8Array([
  (batchSize >> 24) & 0xFF,
  (batchSize >> 16) & 0xFF,
  (batchSize >> 8) & 0xFF,
  batchSize & 0xFF
]), 40);

const result = find_address_with_mask(mask);

if (result) {
  // result.private_key and result.address
}

Installation in Frontend Projects

To use this package in your frontend project:

1. Install via npm

Install the package from the npm registry:

npm install @visualkey/find-rare-keys

2. Import and Use in Your App

import init, { generate_rare_keys_batch } from '@visualkey/find-rare-keys';

await init({ module_or_path: '/path/to.wasm' });
const foundKeys = generate_rare_keys_batch(levelThreshold, batchSize);

License

This project is licensed under the MIT License.