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

crypto-address-format

v0.0.2

Published

Universal format validation for crypto wallet addresses.

Readme

crypto-address-format

Universal format validation for crypto wallet addresses.

crypto-address-format provides lightweight validators for common cryptocurrency address formats. It is suitable for frontend, backend, and edge environments.

Installation

npm install crypto-address-format
# or
pnpm add crypto-address-format
# or
yarn add crypto-address-format
# or
bun add crypto-address-format

Basic Usage

import {validateBTC} from 'crypto-address-format';

const address = 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4';
const result = validateBTC(address);

console.log(result);

Note: Always validate a cleaned string. Trim leading and trailing whitespace before passing user input to any validator, otherwise a valid address may fail validation.

Validators

validateBTC(address)

Validates Bitcoin mainnet addresses.

What it checks:

  • legacy Base58 addresses starting with 1 or 3
  • native SegWit bc1... Bech32 addresses
  • Taproot bc1p... Bech32m addresses
  • checksum and encoding rules for Base58Check, BIP-173, and BIP-350

More info:

  • returns P2PKH, P2SH, Bech32, or Bech32m when valid
  • rejects mixed-case Bech32 addresses
  • intended for Bitcoin mainnet addresses
import {validateBTC} from 'crypto-address-format';

const address = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
const result = validateBTC(address);

validateETH(address)

Validates Ethereum addresses.

What it checks:

  • 0x prefix and exact 20-byte hex length
  • valid hexadecimal characters
  • EIP-55 checksum for mixed-case addresses

More info:

  • accepts lowercase and uppercase hex addresses
  • verifies checksum when a mixed-case EIP-55 address is used
  • returns the normalized lowercase address when valid
  • suitable for Ethereum and EVM-style hex address format validation
import {validateETH} from 'crypto-address-format';

const address = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e';
const result = validateETH(address);

Result Format

Validators return a ValidationResult:

type ValidationResult =
  | {isValid: true; type: string; address: string}
  | {isValid: false; error: string};

License

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


Made with ❤️ by Fantasy