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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@root/base58check

v1.0.1

Published

Base58Check & WIF for PubKeyHash and PrivateKeys

Downloads

20

Readme

@root/base58check

Base58Check & WIF for Public Key Hash addresses and Private Keys

Usage

Can convert Public Key Hashes and Private Keys between Hex, Base58Check, and WIF.

CLI

npm install -g @root/base58check
# base58check <key> [version]

base58check XfMBLVNyzPxEELVUUsg7AJAHWKiV9do7Pj
# {
#   "version": "4c",
#   "pubKeyHash": "3320974335dc4888b501e965fe5ff3c4421c09c4"
# }

base58check 3320974335dc4888b501e965fe5ff3c4421c09c4 4c
# XfMBLVNyzPxEELVUUsg7AJAHWKiV9do7Pj

Node.js

npm install --save @root/base58check
let Base58Check = require("base58check").Base58Check;

let b58c = Base58Check.create();

// Public Key Hash
let pkh = `XfMBLVNyzPxEELVUUsg7AJAHWKiV9do7Pj`;
let parts = await b58c.verify(pkh);
/*
    {
      "version": "4c",
      "pubKeyHash": "3320974335dc4888b501e965fe5ff3c4421c09c4",
      "check": "9e5443ee"
    }
 */

// Private Key
let wif = "XE7KZ98bqtbomihJqkuRzi6DusLAXegQFBmnATDAUVSCxtcbigHb";
let parts = await b58c.verify(wif);
/*
    {
      "version": "cc",
      "privateKey": "543519e8a781d6986377df6ec18c76fceb270697f16f204408af72edc4fe70de",
      "compressed": true,
      "check": "24aeb2e6"
    }
 */

Options

You can enforce your instance of Base58Check to verify and generate a particular version of coin, or to use a different Base58 dictionary.

Base58Check.create({
  pubKeyHashVersion: `4c`, // Dash (`00` for Bitcoin)
  privateKeyVersion: `cc`, // Dash (`80` for Bitcoin)
  dictionary: `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,
});

Base58Check Summary

  • 1 byte Version
  • 16 bytes "Compressed" Public Key Hash
  • 4 bytes Checksum
XxJ7EZT2VyJ821LeAzoT9aDDSuempCikd3

4c ed060e9316ea54396038b7ef703c0616025ddc55 03368b2e

{
  version: '4c',
  pubKeyHash: 'ed060e9316ea54396038b7ef703c0616025ddc55',
  check: '03368b2e'
}

WIF (Wallet Import Format)

  • 1 byte Version
  • 32 bytes Private Key
  • 1 byte (Optional) Has Compressed Public Key
  • 4 bytes Checksum
XJxvA5cC4zi3DYeMVUgHunF3nt5UajjXAvJaHnZRMunPNjyKmGfB

cc e51245e19bfc59800445c91d6623a8225f5e521d339fca2a5bbe71fb973dac0f (01) 90d16dc2

{
  version: 'cc',
  privateKey: 'e51245e19bfc59800445c91d6623a8225f5e521d339fca2a5bbe71fb973dac0f',
  compressed: true,
  check: '90d16dc2'
}