Skip to main content

Noskey

Generate Nostr keys from the command line. One command creates nsec/npub, Bitcoin addresses, DIDs, and SSH keys.

Overview

Noskey is a comprehensive key generation tool that leverages the fact that Nostr keys (secp256k1) are compatible with Bitcoin, Taproot, and can derive other key formats. One seed, many identities.

Quick Start

# Generate a new identity
npx noskey

# Or install globally
npm install -g noskey
noskey

Output Formats

A single noskey command generates:

FormatDescription
Private Key (hex)Raw 32-byte secret key
nsecBech32-encoded private key (NIP-19)
Public Key (hex)Compressed secp256k1 public key
npubBech32-encoded public key (NIP-19)
did:nostrDecentralized identifier
Bitcoin AddressP2PKH mainnet address
Bitcoin TestnetTestnet3 address
Taproot (mainnet)bc1p... address
Taproot (testnet)tb1p... address
ed25519 Public KeyFor systems using ed25519
SSH Public KeyOpenSSH format public key
SSH Private Key PEMOpenSSH format private key
pubky Public KeyFor the Pubky protocol

CLI Options

Usage: noskey [options]

Options:
--version Show version number
-v, --vanity Generate vanity key (prefix match)
-p, --priv Import from hex private key
-s, --nsec Import from nsec
-h, --help Show help

Examples

Generate New Keys

$ npx noskey

Private Key: 3b4c5d6e7f...
nsec: nsec1...
Public Key: 02abc123...
npub: npub1...
did:nostr: did:nostr:z6Mk...
Bitcoin: 1A1zP1...
Taproot: bc1p...
SSH: ssh-ed25519 AAAA...

Vanity Keys

Generate a key with a custom prefix:

# Find an npub starting with "npub1sat"
npx noskey -v sat

# This may take a while depending on prefix length

Import Existing Key

# From hex private key
npx noskey -p 3b4c5d6e7f8a9b0c...

# From nsec
npx noskey -s nsec1abc123...

Use Cases

Nostr Identity

Your npub is your portable identity across all Nostr clients.

Bitcoin Receiving

Use the generated Bitcoin/Taproot addresses to receive funds with the same key.

SSH Authentication

Use the generated SSH key for Git or server access.

DID Identity

The did:nostr format provides a decentralized identifier compatible with DID standards.

Development

Quickly generate test keys for development and testing.

Security Notes

  • Store nsec securely — Anyone with your nsec controls your identity
  • Never share nsec — Only share your npub
  • Consider hardware wallets — For high-value keys, use a hardware signer
  • Backup carefully — Lost keys cannot be recovered

The Math

Nostr uses secp256k1 (same as Bitcoin):

  1. Generate 32 random bytes (private key)
  2. Multiply by generator point G (public key)
  3. Encode in various formats

This is why one key works across Nostr, Bitcoin, and other secp256k1 systems.

See Also