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

dashkeys-cli

v1.1.0

Published

Dash Keys CLI - generate, validate, and convert WIFs and PayAddress (Private Keys and Public Key Hashes)

Downloads

12

Readme

dashkeys-cli

CLI Reference Tools for converting and validating DASH Private Keys and Payment Addresses

Features

  • [x] Validate Base58Check addresses
    • WIF (Wallet Import Format for Private Keys)
    • PayAddr
  • [x] WIF to Addr
  • [x] Addr (Base58Check) to PubKeyHash (PKH)
  • [x] Output as text or JSON
  • [x] API

See Dash HD for Extended Private Key (xprv) and Extended Public Key (xpub) features.

Install

  1. Install node.js
    # Mac, Linux
    curl -sS https://webi.sh/node | sh
    # Windows 10+
    curl.exe https://webi.ms/node | powershell
  2. Install dashkeys-cli via npm
    npm install --location=global dashkeys-cli

Usage

See dashkeys help for the most up-to-date info:

dashkkeys help

Usage:
    dashkeys address <./file.wif>    convert WIF to Pay Addr
    dashkeys generate                create WIF [DEV TOOL]
    dashkeys inspect <addr-or-file>  decode base58check
    dashkeys verify <addr-or-file>   validate checksum

    dashkeys help     show this menu
    dashkeys version  show version

Global Flags:
    --json             machine-friendly json to stdout
    --unsafe           no private key mask, accept as string

Convert WIF to Payment Address

From a file:

# File contents: XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK
dashkeys address ./XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9.wif
Pay Addr is XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9

From a string (unsafe), as JSON:

dashkeys address --json --unsafe 'XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK'
{
  "address": "XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9"
}

Verify an Addr (string) or WIF (file)

Verify a PubKeyHash:

dashkeys verify 'XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9'
Pay Addr string is valid
(Pub Key Hash: ae14c8728915b492d9d77813bd8fddd91ce70948)

Verify a WIF file:

# File contents: XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK
dashkeys verify ./XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9.wif
Private Key file valid

Inspect a Key

Inspect a PubKeyHash (as json):

dashkeys inspect --json 'XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9'
{
  "valid": true,
  "version": "4c",
  "pubKeyHash": "ae14c8728915b492d9d77813bd8fddd91ce70948",
  "check": "ce08541e",
  "compressed": true
}

Inspect a WIF (masked):

# File contents: XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK
dashkeys inspect --json ./XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9.wif
{
  "address": "XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9",
  "valid": true,
  "version": "cc",
  "privateKey": "1d************************************************************50",
  "compressed": true,
  "check": "ec533f80",
  "publicKey": "0245ddd5edaa25313bb88ee0abd359f6f58ac38ed597d33a981f1799903633d902",
  "pubKeyHash": "ae14c8728915b492d9d77813bd8fddd91ce70948",
  "pubKeySha256": "8e5abfc42a6d7529b860ce2b4b8889380db893438dc96430f597ddb455e85fdd"
}

Inspect a WIF (unmasked):

# File contents: XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK
dashkeys inspect --json --unmask ./XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9.wif
{
  "address": "XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9",
  "valid": true,
  "version": "cc",
  "privateKey": "1d2a6b22fcb5a29a5357eaf27b1444c623e5e580b66ac5f1109e2778a0ffb950",
  "compressed": true,
  "check": "ec533f80",
  "publicKey": "0245ddd5edaa25313bb88ee0abd359f6f58ac38ed597d33a981f1799903633d902",
  "pubKeyHash": "ae14c8728915b492d9d77813bd8fddd91ce70948",
  "pubKeySha256": "8e5abfc42a6d7529b860ce2b4b8889380db893438dc96430f597ddb455e85fdd"
}

note: the _xy* debug fields show incorrect values that are common mistakes - to help those developing their own PubKeyHash or Base58Check key library in other languages.

Generate a Key

Note: This is just for DEVELOPMENT. Generally speaking, you should use generate recoverable keys using Dash Wallet or Dash HD instead.

(there's nothing wrong with these keys - they're fully tested, they're just not HD keys)

dashkeys generate
Saved new private key to './XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9.wif'

The name of the file is the Pay Addr (Base58Check-encoded Public Key Hash) and the contents are the WIF (private key).

The leading X for each is because they are base58check-encoded.

API

See DashKeys.js.

Fixtures

For troubleshooting, debugging, etc, the keys used in this example come from the canonical Dash "Zoomonic":

Passphrase (Mnemonic)  :  zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong
Secret (Salt Password) :  TREZOR
HD Path                :  m/44'/5'/0'/0/0:
WIF                    :  XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK
Addr                   :  XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9

Correct PubKeyHash Values

dashkeys inspect --unmask ./examples/m44_5_0_0-0.wif
    Version:     cc
    Private Key: 1d2a6b22fcb5a29a5357eaf27b1444c623e5e580b66ac5f1109e2778a0ffb950
    Compressed:  01
    Pay Addr:    XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9
    Check:       ec533f80
    Valid:       true

Private Key (Debug Info):

PrivateKey:   cc011d2a6b22fcb5a29a5357eaf27b1444c623e5e580b66ac5f1109e2778a0ffb950
  --------
  Version:    cc
  Comp Flag:  01 (Compressed)
  Priv Key:   1d2a6b22fcb5a29a5357eaf27b1444c623e5e580b66ac5f1109e2778a0ffb950
  --------
WIF:          XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK

Public Key Hash (Debug Info):

PubKey:       0245ddd5edaa25313bb88ee0abd359f6f58ac38ed597d33a981f1799903633d902
  --------
  Comp Flag:  02 (Quadrant 2)
  X:          45ddd5edaa25313bb88ee0abd359f6f58ac38ed597d33a981f1799903633d902
  SHA256:     8e5abfc42a6d7529b860ce2b4b8889380db893438dc96430f597ddb455e85fdd
  *RMD160:    54408a877b83cb9706373918a430728f72f3d001 (*not used)
  PubKeyHash: ae14c8728915b492d9d77813bd8fddd91ce70948
  Check:      ce08541e
  Version:    4c
  --------
Pay Address:    XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9

LICENSE

Copyright (c) 2023 Dash Incubator
Copyright (c) 2023 AJ ONeal

MIT License