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

dashhd-cli

v1.0.2

Published

Browser, Node, Bundler, and CLI compatible Dash HD Wallet tools

Downloads

4

Readme

dashhd-cli

Commandline utility to traverse HD Keys from HD Wallet Seed and Extended (xprv, xpub) Key Paths.
(compatible with the [Hierarchical Deterministic Keys (BIP-44)][bip-44] and [BIP-32][bip-32] specs)

A fully-functional, production-ready reference implementation of Dash HD - suitable for learning DASH specs and protocols, and porting to other languages.

Overview: Seeds => XKeys => Keys

dashhd <./seed-or-key> [start-hdpath-or-index] [end]

Seed => Extended Key

dashhd ./seed.hex   "m/44'/5'/0'/0"
# XPrv
xprvA2L7qar7dyJNhxnE47gK5J6cc1oEHQuAk8WrZLnLeHTtnkeyP4w6Eo6Tt65trtdkTRtx8opazGnLbpWrkhzNaL6ZsgG3sQmc2yS8AxoMjfZ

# XPub
xpub6FKUF6P1ULrfvSrhA9DKSS3MA3digsd27MSTMjBxCczsfYz7vcFLnbQwjP9CsAfEJsnD4UwtbU43iZaibv4vnzQNZmQAVcufN4r3pva8kTz

Extended Key to Address Key

dashhd ./0-0-0.xprv 0
# WIF
XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK

# Address
XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9

Table of Contents

Install

npm install --location=global dashhd-cli@1
dashhd ./seed.hex "0'/0"

Or, use without installing:

npx -p dashhd-cli dashhd ./seed.hex "0'/0"

Usage

Note: Convert Recovery Phrases to Seeds with dashphrase.

Also, all example values below are derived from the Zoomonic Seed:

./seed.hex:

ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069

How HD Paths Work

You can use either the full HD Path (required for coins other than DASH), or abbreviate, starting with the HD Account:

m/44'/5'/0'/0    - absolute Extended Key path
         0'/0    - relavite Extended Key path (DASH only)

m/44'/5'/0'/0/0  - absolute Address Key path
         0'/0/0  - relative Address Key path (DASH only)

From Dash HD: HD Path:

The path that defines an HD Key - typically of the BIP-44 variety:

  • a Root (master), ex: m (depth 0, the Wallet Key, straight from the seed)
  • an Coin Key, ex: m/44'/5' (depth 2)
  • an Account, ex: m/44'/5'/0' (depth 3)
  • an X Key (XPrv or XPub), ex: m/44'/5'/0'/0 (depth 4, a.k.a. Use)
  • an Address Key, ex: m/44'/5'/0'/0/0 (depth 5, the end)
  • ' is used for "hardened" (parent) key segments,
    but not for "public" (shareable) child key segments

In general:

m/<purpose>'/<coin-type>'/<account>'/<use>/<index>

For DASH:

m/44'/5'/<account>'/<use>/<index>

(because we always use BIP-44 and our coin type is 5)

See also:

Wallet Seed to Extended Keys

  1. Convert your Recovery Phrase to a Seed with DashPhrase
  2. Derive Extended Keys for Account at index 2:
    # dashhd ./seed.hex       "/<account>'/<use>"
    dashhd ./seed.hex         "/2'/0"
    (the Use index will be 0 for most common use cases)
  3. The output will have an XPrv and XPub, like this:
    # starts with "xprv" (111 characters)
    xprvA1t6Pgks9siC1M6QTqstaDpK7GqJfiDZq4tpD6eKVyVf4iAb3LViw6jk1mp2XUawhpoYCCwrQphPpS9V36VhDLxP6QK5FGx5wR6iF8xMYHc
    # starts with "xpub" (111 characters)
    xpub6EsSoCHkzFGVDqAsZsQtwMm3fJfo5AwRCHpR1V3w4K2dwWVjasoyUu4Ds2XtjE9QY83pdNBtduc17UKQV46iQmAJFQ7NywC4ggdEi1Ki76a

More examples:

# Absolute HD Path
dashhd ./seed.hex "m/44'/5'/2'/0"

# Absolute HD Path with Relative Range
dashhd ./seed.hex "m/44'/5'/0'/0" "5'/0"

# Same as above, but with relative HD Path
dashhd ./seed.hex          "0'/0" "5'/0"

Wallet Seed to Address Keys

  1. Convert your Recovery Phrase to a Seed with DashPhrase
  2. Derive Address Keys for Address 3 of Account 2 (0-indexed):
    # dashhd ./seed.hex       "/<account>'/<use>/<index>"
    dashhd ./seed.hex         "/2'/0/3"
    (the Use index will be 0 for most common use cases)
  3. The output will have a WIF (longer) and Address, like this:
    # WIF (51 characters)
    HjSuSQ7F2dVqmzB4BLzEaLNrptzzVUBCXjo76us7AWQY954CWe3
    # Address (34 characters)
    XyvDv4Jz3cfXrbTvecymTe2MmXryokCEHi

More examples:

# Absolute HD Path
dashhd ./seed.hex "m/44'/5'/2'/0/3"

# Absolute HD Path with Relative Address Ranges
dashhd ./seed.hex "m/44'/5'/2'/0/3" "2'/0/5"

# Absolute HD Path with Relative Account + Address Ranges
dashhd ./seed.hex "m/44'/5'/0'/0/0" "2'/0/3"

# Same as above, but with relative HD Path
dashhd ./seed.hex          "2'/0/3" "2'/0/5"
dashhd ./seed.hex          "0'/0/0" "2'/0/3"

Extended Keys to Address Keys

Extended Keys come in a pair:

  • the person receiving payment generates the pair
    (they keep the XPrv to themselves)
  • the person paying accepts the XPub from the other
    (each payment will go incrementally to the next unused address)

Pay a Contact

If Alice wants to pay Bob, and the next unused is at index 3:

# dashhd ./payee.xpub <index>
dashhd   ./bob.xpub   3
# Address
XyvDv4Jz3cfXrbTvecymTe2MmXryokCEHi

Check & Spend a Payment

Bob must use the WIF (first, longer) to spend a a payment.
Before doing so he can check teh account with the Address (shorter).

# dashhd ./payer.xprv <index>
dashhd   ./alice.xprv 3
# WIF
HjSuSQ7F2dVqmzB4BLzEaLNrptzzVUBCXjo76us7AWQY954CWe3
# Address
XyvDv4Jz3cfXrbTvecymTe2MmXryokCEHi

Working with Ranges

You can specify a range to generate multiple Extended Keys or Address Keys at once.

Extended Key Ranges

# Absolute HD Path
dashhd ./seed.hex "m/44'/5'/0'/0" "m/44'/5'/2'/0"

# Absolute HD Path with Relative Range
dashhd ./seed.hex "m/44'/5'/0'/0"          "2'/0"

# Same as above, but with relative HD Path
dashhd ./seed.hex          "0'/0"          "2'/0"

The output will include the HD Path for easy identification:

m/44'/5'/2'/0:
xprvA1t6Pgks9siC1M6QTqstaDpK7GqJfiDZq4tpD6eKVyVf4iAb3LViw6jk1mp2XUawhpoYCCwrQphPpS9V36VhDLxP6QK5FGx5wR6iF8xMYHc
xpub6EsSoCHkzFGVDqAsZsQtwMm3fJfo5AwRCHpR1V3w4K2dwWVjasoyUu4Ds2XtjE9QY83pdNBtduc17UKQV46iQmAJFQ7NywC4ggdEi1Ki76a

Address Key Ranges

# Absolute HD Path
dashhd ./seed.hex "m/44'/5'/2'/0/0" "m/44'/5'/2'/0/5"

# Absolute HD Path with Relative Address Ranges
dashhd ./seed.hex "m/44'/5'/2'/0/2"          "2'/0/5"

# Absolute HD Path with Relative Account + Address Ranges
dashhd ./seed.hex          "0'/0/0"          "2'/0/2"

# Same as above, but with relative HD Path
dashhd ./seed.hex          "2'/0/2"          "2'/0/5"
dashhd ./seed.hex          "0'/0/0"          "2'/0/2"

The output will include the HD Path for easy identification:

m/44'/5'/2'/0/3:
XHjSuSQ7F2dVqmzB4BLzEaLNrptzzVUBCXjo76us7AWQY954CWe3
XyvDv4Jz3cfXrbTvecymTe2MmXryokCEHi

Fixtures

These are for testing and debugging HD Key libraries and HD wallets.

Libraries should support Recovery Phrase "secret"s - also known as salt or (misnomer) password.

However, in practice, most wallets don't ask the user and simply put an empty string as the secret.

Also, in practice, the XPrv and XPub Use is always designated as Receiving (External), not Change (internal).

For completeness, we offer fixtures for all of those features below.

Catmonic (empty secret)

Recovery Phrase:

cat swing flag economy stadium alone churn speed unique patch report train

Secret (Salt):

(empty string)

XPrvs, XPubs, WIFs, and Addresses:

See ./examples/ and ./FIXTURES.md.

Zoomonic (with secret salt)

Recovery Phrase:

zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong

Secret (Salt):

TREZOR

XPrvs, XPubs, WIFs, and Addresses:

m/44'/5'/0'/0   XPrv & XPub

                xprvA2L7qar7dyJNhxnE47gK5J6cc1oEHQuAk8WrZLnLeHTtnkeyP4w6Eo
                    6Tt65trtdkTRtx8opazGnLbpWrkhzNaL6ZsgG3sQmc2yS8AxoMjfZ
                xpub6FKUF6P1ULrfvSrhA9DKSS3MA3digsd27MSTMjBxCczsfYz7vcFLnb
                    QwjP9CsAfEJsnD4UwtbU43iZaibv4vnzQNZmQAVcufN4r3pva8kTz

m/44'/5'/0'/0/0 WIF & Address

                XCGKuZcKDjNhx8DaNKK4xwMMNzspaoToT6CafJAbBfQTi57buhLK
                XrZJJfEKRNobcuwWKTD3bDu8ou7XSWPbc9
m/44'/5'/1'/1   XPrv & XPub

                xprvA2ACWaqwADRtbkLsM6oQHzeWtqZVviBmKMKNRBFcwKGGRBgWHNeoZS
                    KzduFMFkqvNsV5LaqRT9XRibzgSAweAAsfMF35PWy6beK3aL1BwTU
                xpub6F9Yv6NpzazBpERLT8LQf8bFSsPzLAucgaEyDZfEVeoFHz1epuy47E
                    eUVCRTNVToM1zgFZMxiGs2AFc9cNqZE2UVwJod2zPkG7W4ZGRuwJJ

m/44'/5'/1'/1/1 WIF & Address
                XF9murLtNpJaZXbwMxqJ6BhigEtu9NxfBCJDBokCJcqFkYkz3itz
                XueHW2ELMxoXzXcaHMxmwVWhcADE1W5s8c
m/44'/5'/2'/0   XPrv & XPub

                xprvA1t6Pgks9siC1M6QTqstaDpK7GqJfiDZq4tpD6eKVyVf4iAb3LViw6
                    jk1mp2XUawhpoYCCwrQphPpS9V36VhDLxP6QK5FGx5wR6iF8xMYHc
                xpub6EsSoCHkzFGVDqAsZsQtwMm3fJfo5AwRCHpR1V3w4K2dwWVjasoyUu
                    4Ds2XtjE9QY83pdNBtduc17UKQV46iQmAJFQ7NywC4ggdEi1Ki76a

m/44'/5'/2'/0/3 WIF & Address

                XHjSuSQ7F2dVqmzB4BLzEaLNrptzzVUBCXjo76us7AWQY954CWe3
                XyvDv4Jz3cfXrbTvecymTe2MmXryokCEHi

m/44'/5'/2'/0/5 WIF & Address

                XCcWUUGUkCeYLteuYmocSy9UbSwbCZD2nNCxXW5DKSN3YKHEE6xx
                XgBR52CgtFEdvrbN7YdwUVP5HCxDMyWKqk

More Fixtures

See also:

Glossary

If you're new to all this, check out these glossaries:

LICENSE

MIT License

Copyright 2023 Dash Incubator
Copyright 2023 AJ ONeal