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

xpub-create

v2.1.2

Published

Create a BIP32 extended public key

Downloads

13

Readme

xpub-Create

Create a BIP32 extended public key

npm

Creates a Base58 encoded extended public key (xpub) for use in a BIP32 hierarchical deterministic wallet.

Install

npm install xpub-create

Usage

You should familiarise yourself with BIP32 to understand what these arguments represent.

const createXpub = require('xpub-create');

const xpub = xpubCreate({
  depth: 3,
  childNumber: 2147483648,
  chainCode: '84cf7d9029cdd9fcadbb3717fd92ec0db7d7d9787c57c13c08fc887c389b566b',
  publicKey: '048bcdcf59f046b13f1eb35b608d1211265fde8cc44fc7a5a7f7107c5cf238095328a0e0d7be17c7d3e48490e8c6433af6d2c3dacc687f3fecaa98a3d05f17de97'
});
// => 'xpub6CgMcBZk66ayM9ESh7QtBmRKJbsa6rBeBH2k4aQZQJGossryP5r2N2nQS4hBMG1wb8igPoH53bxtzTBaeMqJkbu8bxsih1gGkoAn23Nr8VP'

Pass in version bytes for a different network:

const xpubCreate = require('xpub-create');

const tpub = xpubCreate({
  networkVersion: xpubCreate.testnet,
  depth: 3,
  childNumber: 2147483648,
  chainCode: '84cf7d9029cdd9fcadbb3717fd92ec0db7d7d9787c57c13c08fc887c389b566b',
  publicKey: '048bcdcf59f046b13f1eb35b608d1211265fde8cc44fc7a5a7f7107c5cf238095328a0e0d7be17c7d3e48490e8c6433af6d2c3dacc687f3fecaa98a3d05f17de97'
});
// => 'tpubDD3z8RPRoNYRcwRJ9JPyPgkgdiyE6Eghiud3R8ThkD2hdAXgTJh7WUTEg6mxskyBP3Fb1NnwahnwgdgC3DgYe3MRfZd2NYLWLkmBn7UWZXk'

Tip

If you're working with ledgerjs you can pass the output of getWalletPublicKey() almost directly in.

API

xpubCreate(options)

Returns a Base58 encoded extended public key.

options

Type: Object

An object containing the following properties of the derivation path.

Consult BIP32 for an in-depth explanation on these properties.

networkVersion

Type: number Default: 0x0488B21E (mainnet)

Network version bytes.

depth

Type: number Default: undefined

The depth of the derived key.

childNumber

Type: number Default: undefined

The child number.

chainCode

Type: string Default: undefined

The chain code.

publicKey

Type: string Default: undefined

The public key in compressed or uncompressed form.

xpubCreate.mainnet

Mainnet (xpub) version bytes: 0x0488B21E

xpubCreate.testnet

Testnet (tpub) version bytes: 0x043587CF

License

MIT © Luke Childs