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

@getlea/keygen

v1.0.1

Published

A CLI tool for generating Lea Chain keysets.

Downloads

7

Readme

npm version GitHub license

lea-keygen Command-Line Usage

This guide provides detailed instructions for using the lea-keygen command-line tool to generate Lea Chain keysets.

Installation

For one-off commands, you can use npx without any installation:

npx @leachain/keygen <command>

Alternatively, you can install it globally to use the lea-keygen command directly:

npm install -g @leachain/keygen
lea-keygen <command>

Command Reference

The lea-keygen tool supports two main commands: new and verify.

new

Generates a new keyset.

Synopsis

lea-keygen new [options]

Options

  • --no-outfile: Prints the generated keyset to standard output (stdout) as a JSON array instead of saving it to a file.
  • --outfile <path>: Specifies a custom file path to save the keyset. If this is not provided, the keyset is saved to <address>.json in the current directory.
  • --force: If a keyset file already exists at the target path, this flag allows overwriting it. Without this flag, the tool will exit with an error to prevent accidental data loss.
  • --seed <hex>: Generates a keyset deterministically from a 32-byte (64-character) hexadecimal master seed. This is useful for recovering a keyset from a single, high-entropy source.

Examples

1. Generate a Keyset and Save to a File

This is the default behavior. It generates a new keyset and saves it to a file named after the derived public address.

Command:

npx @leachain/keygen new

Output (to stderr):

Public Address (bech32m): lea1q...
Public Address (hex):     ...
Keyset saved to: /path/to/project/lea1q....json

The resulting file will contain the full keyset with secure file permissions (600).

2. Generate a Keyset from a Seed

Use the --seed flag to generate a keyset from a 32-byte hex string. This allows for deterministic key creation.

Command:

npx @leachain/keygen new --seed 11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff
3. Generate a Keyset and Print to Console

Use the --no-outfile flag to prevent writing to a file and instead print the keyset to stdout.

Command:

npx @leachain/keygen new --no-outfile

Output (to stdout):

[
  [
    [ ... private key ... ],
    [ ... public key ... ]
  ],
  [
    [ ... private key ... ],
    [ ... public key ... ]
  ]
]

Output (to stderr):

Public Address (bech32m): lea1q...
Public Address (hex):     ...
Keyset generated to stdout.

verify

Displays the public address for a given keyset file.

Synopsis

lea-keygen verify <file_path>
  • <file_path>: The path to the keyset JSON file.

Description

This command reads a keyset file, derives the public address from it, and prints the address to standard output. This is useful for verifying the address of a wallet without needing to generate a new key.

Example

Command:

npx @leachain/keygen verify ./my-keys/main-wallet.json

Output (to stdout):

Address (bech32m): lea1q...
Address (hex):     ...

Module Usage

In addition to the CLI, you can use @leachain/keygen as a library in your Node.js applications.

Installation

npm install @leachain/keygen

Examples

1. Generate a Random Keyset

const { generateKeyset } = require('@leachain/keygen');

async function createNewWallet() {
    try {
        const { keyset, address, addressHex } = await generateKeyset();
        console.log('New Keyset:', keyset);
        console.log('Public Address (bech32m):', address);
        console.log('Public Address (hex):', addressHex);
    } catch (error) {
        console.error('Failed to generate keyset:', error);
    }
}

createNewWallet();

2. Generate a Keyset from a Master Seed

For deterministic key generation, provide a 32-byte Buffer as the master seed.

const { generateKeyset } = require('@leachain/keygen');
const crypto = require('crypto');

async function createDeterministicWallet() {
    try {
        // IMPORTANT: Use a cryptographically secure, high-entropy seed.
        const masterSeed = crypto.createHash('sha256').update('a very secret phrase').digest();

        const { keyset, address } = await generateKeyset(masterSeed);
        console.log('Generated Address:', address);
        // You can now save or use the keyset.
    } catch (error) {
        console.error('Failed to generate deterministic keyset:', error);
    }
}

createDeterministicWallet();

3. Usage with ES Modules (import)

The package also supports ES Module syntax.

import { generateKeyset } from '@leachain/keygen';
import crypto from 'crypto';

async function createDeterministicWallet() {
    try {
        // IMPORTANT: Use a cryptographically secure, high-entropy seed.
        const masterSeed = crypto.createHash('sha256').update('a very secret phrase').digest();

        const { keyset, address } = await generateKeyset(masterSeed);
        console.log('Generated Address:', address);
    } catch (error) {
        console.error('Failed to generate deterministic keyset:', error);
    }
}

createDeterministicWallet();

License

This project is licensed under the MIT License. See the LICENSE file for details.