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 🙏

© 2025 – Pkg Stats / Ryan Hefner

kaspa-simple-wallet

v1.0.6

Published

Watch-only Kaspa address derivation from KPUB/XPUB (Kaspium compatible)

Readme

Kaspa Simple Wallet

A production-safe JavaScript SDK for generating Kaspa addresses from extended public keys (KPUB/XPUB). Supports all major Kaspa wallet formats: Kaspium, Kasware (12/24-word), and Legacy KDX.

🔒 Security

Production builds are SAFE for public use - they only expose watch-only functions that work with public extended keys. No private keys or mnemonics are ever required or exposed.

What's Safe:

  • ✅ Generating addresses from KPUB/XPUB/TPUB (public keys only)
  • ✅ Detecting wallet formats
  • ✅ Converting between KPUB and XPUB formats
  • ✅ All processing happens in the browser (no server calls)

What's NOT Exposed in Production:

  • ❌ Wallet generation from mnemonics
  • ❌ Private key operations
  • ❌ Console logging of sensitive data

🚀 Use Cases

Frontend JS Projects

Safe for any frontend project - The production build is safe for public use.

  • ✅ No network calls
  • ✅ All processing in browser
  • ✅ Watch-only (public keys only)
  • ✅ No telemetry or tracking

Example:

// User provides their KPUB (public key - safe to share)
const kpub = "kpub2HhT43oHcjLUWbVdiqfspNUHKD4n2qaUTvVZ23FDtWAYp3JcB7ahsWMKTMqocvhmift3debvEnhWwA2TgY4icXdQCPRCW38b3gxUUbTT6DB";

// Generate 10 addresses (watch-only, safe)
const result = await kaspaWallet.generateAddressesUniversal(kpub, 0, 10);
console.log(result.addresses); // Array of kaspa: addresses

Important: Always instruct users to use their extended public key (KPUB/XPUB) - NEVER their mnemonic/seed phrase.

Best Practices

  1. Only use public extended keys - KPUB, XPUB, or TPUB formats
  2. Never ask for mnemonics - This SDK doesn't need them in production
  3. Avoid global namespace conflicts - If loading via <script>, consider custom namespacing:
    window.myAppKaspa = kaspaWallet; // Create your own namespace

📦 Install / Publish

npm install
npm run build  # Production build (safe, watch-only)
npm run build-debug  # Development build (includes sensitive APIs for testing)

Publish to npm

This package ships both the browser bundle and an ESM bundle:

  • build/kaspa-wallet.js (IIFE for direct <script> use)
  • build/kaspa-wallet.esm.js (ESM for modern bundlers)

The npm manifest includes only: build/kaspa-wallet.js, build/kaspa-wallet.esm.js, LICENSE, README.md.

Source code: Full source code is available on GitHub for review and auditing. The npm package contains pre-bundled code to ensure clean installations without dependency conflicts.

npm version patch   # or minor/major
npm publish --access public

🔧 Usage

Generate Addresses from KPUB/XPUB

// Works with any Kaspa extended public key format
const kpub = "kpub2HhT43oHcjLUWbVdiqfspNUHKD4n2qaUTvVZ23FDtWAYp3JcB7ahsWMKTMqocvhmift3debvEnhWwA2TgY4icXdQCPRCW38b3gxUUbTT6DB";

// Generate 5 addresses starting from index 0
const result = await kaspaWallet.generateAddressesUniversal(kpub, 0, 5);

result.addresses.forEach(addr => {
    console.log(`Address ${addr.index}: ${addr.address}`);
    console.log(`Path: ${addr.path}`);
});

Detect Wallet Format

const format = kaspaWallet.detectKPUBFormat(kpub);
console.log(format); // 'kaspium', 'standard', or 'testnet'

const walletInfo = kaspaWallet.detectWalletType(kpub);
console.log(walletInfo); // { wallet: 'kaspium', format: 'kpub', ... }

Convert KPUB to XPUB

const xpub = kaspaWallet.convertKaspiumKPUB(kpub);
console.log(xpub); // Standard XPUB format

🛠️ Supported Wallet Formats

  • Kaspium (KPUB format) - m/44'/111111'/0'
  • Kasware 24-word (XPUB) - m/44'/111111'/0'
  • Kasware 12-word (XPUB) - m/44'/972/0'
  • Legacy KDX (XPUB) - m/44'/972/0'
  • Testnet (TPUB) - Supported for address generation

📝 Development

For development/testing, use the debug build which includes additional functions:

npm run build-debug

Development build exposes:

  • generate() - Generate new wallet (testing only)
  • generateKPUBForWallet() - Generate KPUB from mnemonic (testing only)
  • test* functions - Testing helpers

Never use debug builds in production or with real user data.

⚠️ Security Warnings

  1. Only use extended public keys (KPUB/XPUB/TPUB) - Never ask users for mnemonics or private keys
  2. Production build is safe - Development builds expose sensitive APIs - only use for testing
  3. No server dependencies - All operations run in the browser
  4. Other scripts can access - window.kaspaWallet is globally accessible (acceptable for public-key operations)

📄 License

See LICENSE file for details.