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

mx-bitcoin-address

v0.0.7

Published

Bitcoin addresses generator

Downloads

42

Readme

mx-bitcoin-address

Bitcoin addresses generator

Installation

npm i --save mx-bitcoin-address

Usage

var generator = require('mx-bitcoin-address');

var keys = generator.fromRandom();
//var keys = generator.fromString('your long password phrase here');
//var keys = generator.fromHex('0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D');

console.log(keys.getPrivateKeyBuffer());
console.log(keys.getPrivateKeyWif());
console.log(keys.getPublicKeyBuffer());
console.log(keys.getCompressedPublicKeyBuffer());
console.log(keys.getAddress());

API

Note: generator throws PrivKeyLessCurveError if generated private key larger then
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 and PrivKeyGreaterZeroError if private key is 0.
It's rare cases, but you should wrap static methods in try catch:

var generator = require('mx-bitcoin-address');

function generateFromRandom() {
    try {
        return generator.fromRandom()
    } catch (e) {
        if (e instanceof generator.PrivKeyGreaterZeroError || e instanceof generator.PrivKeyLessCurveError) {
            return generateFromRandom();
        } else {
            return e;        
        }
    }
}

Static

fromRandom()

Generates key pair from random number

fromString(string password)

Generates key pair from string (brainwallet, not safe). Uses double sha256.
Throws PasswordMustBeStringError if password is not a string.
Throws PasswordIsEmptyError if password length is 0.

fromHex(string hex)

Generates key pair from hex string (string must contain hex chars only and be 64 chars length)
Throws InvalidHexStringError if hex string in wrong format

fromBuffer(buffer)

Generates key pair from buffer (buffer must be 32 bytes length) Throws WrongBufferLengthError if buffer is not 32 bytes length

Instance

getPrivateKeyBuffer(): Buffer

Returns buffer with your generated private key

getPrivateKeyWif(): string

Returns string with your private key in WIF format

getPublicKeyBuffer(): Buffer

Returns buffer with your generated public key

getCompressedPublicKeyBuffer(): Buffer

Returns buffer with compressed public key

getAddress(): string

Returns your generated bitcoin address

Errors list

PrivKeyGreaterZeroError

PrivKeyLessCurveError

PasswordMustBeStringError

PasswordIsEmptyError

InvalidHexStringError

WrongBufferLengthError

WrongBufferLengthError

Tests

npm i -g jasmine
npm test