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

undercoin

v0.0.5-b

Published

Bitcoin utility belt

Downloads

2

Readme

undercoin

Bitcoin utility belt

usage

npm install undercoin

In node or browser

const undercoin = require('undercoin')

api

For functions that accept a testnet parameter, said parameter needs be just true (otherwise the function will default to mainnet).

newAddress
undercoin.newAddress(testnet)
Creates a new Bitcoin address.

undercoin.newAddress() // 3FM1J7HkVcZeHTcWadxCN9UyTLYDpUxjJn

Note that no private key is provided (you can never spend funds sent to this address).

newKeypair
undercoin.newKeypair(testnet)
Creates a new Bitcoin keypair; an object containing a private and public key

undercoin.newKeypair() 
// {
//   private : 12b9a63d4b0d355b2b26d62a56bc165bae2850785d0584d28f1d6db86c66616e,
//   public : 03ec7db1055f42f6ea1baf2206ffe90d354a18654774fa4cbc8c36390dfdab73ee
// }

newWIF
undercoin.newWIF(testnet)
Creates a new WIF

undercoin.newWIF() 
// KxvdPD4tYwiiDsjMTNNgDiXWx2jK4p3mnLhaATx5NzaMPwMakquy

addressFromWIF
undercoin.addressFromWIF(wif, testnet)
Output a public Bitcoin address from a WIF

undercoin.addressFromWIF(wif)
// 1AoUMgXS3YV5LcJCuCjNzXEctL73cR8FgJ

getAddress
undercoin.getAddress(testnet, callback)
Get a (recent) address on the blockchain

undercoin.getAddress((err, address) => console.log(address))
// 3FM1J7HkVcZeHTcWadxCN9UyTLYDpUxjJn

isSegwit undercoin.isSegwit(address) Determines if address is Segwit (Bech32) or not.

undercoin.isSegwit('bc1qx9lplhcemust5q7vjejmfaglg8h6knu7a92r5p')
// true

feeEstimate Get an estimate on the fee required to complete a transaction within x hours

Conversion functions

The following conversion functions are directly from fmtbtc, see also that repo for more conversions beyond this selection below:

btc2sat
undercoin.btc2sat(btcAmount)
Converts BTC to satoshis

undercoin.btc2sat(1) // '100000000'

sat2btc
undercoin.sat2btc(satoshis)
Converts satoshis to BTC

undercoin.sat2btc(15000000) // '0.15'

btc2msat
undercoin.btc2msat(btcAmount)
Converts BTC to 1/1000th of a satoshi

undercoin.btc2msat(1) // '100000000000'

msat2btc
undercoin.msat2btc(mSatoshis)
Converts mSatoshis to BTC.

undercoin.msat2btc(1) // '0.00000000001'

msat2sat
undercoin.msat2sat(mSatoshis)
Converts mSatoshis to regular satoshis.

undercoin.msat2sat(1000) // '1'

sat2msat
undercoin.msat2sat(satoshis)
Converts satoshis to mSatoshis.

undercoin.sat2msat(1) // '1000'

MIT