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

escrow-bitcoin

v0.0.6

Published

A service to make possible escrow transactions using BTC (Bitcoin)

Downloads

16

Readme

escrow-bitcoin

travis-ci.org Coverage Status

NPM

A service to make possible escrow transactions using BTC (Bitcoin)

Create Escrow wallet

const Escrow = require("escrow-bitcoin");

// Will be used soon
var escrow;

/**
 * Create a Escrow Wallet
 * 
 * @param {Number} amount - Amount to escrow (in satoshis)
 * @param {Networks} [network=bitcore.Networks.testnet] - Network to make transaction
 * @returns {Object} (with privateKey, adress and URI to request payment)
 */
Escrow.createEscrowAddress(1200, Escrow.Networks.livenet).then(function(escrowResult){
  escrow = escrowResult;
  console.log(escrow);
  // {
  //   privateKey:  <PrivateKey: 6b5b3c47ea2c0c0dd278f0b667da441176beb31e345284dcb2fe0748cbe85969, network: livenet>,
  //   address: <Address: myqWz9x2QsQQHKQtV56PyD4Myw34igxdin, type: pubkeyhash, network: testnet>,
  //   URI: "bitcoin:mkaFycfbM3SuZ4mFJVeNjQv58a4KkYAUPk?amount=0.000012" //can be used to QRCode
  // }
});

/* ... */

Save escrow PrivateKey in a secure place, this information is necessary to make a transaction from escrow wallet. Give the address and/or URI to who need to escrow the bitcoins.

When if escrow wallet had the necessary balance (you can verify with blockchain.info API or other services), make a transaction to send Bitcoins to who need receive them.

Testnet Blockchain

Livenet Blockchain

Send a transaction


/* ... */

//Address to
var addressTo = "mkaFycfbM3SuZ4mFJVeNjQv58a4KkYAUPk"

/**
 * Make Escrow wallet send bitcoin 
 * 
 * @param {Address} escrowAddress - Address to withdraw
 * @param {PrivateKey} escrowPrivateKey - PrivateKey from Address to withdraw to sign transaction
 * @param {Address} addressTo - Address to send
 * @param {Number} amount - Amount (in satoshis)
 * @param {Networks} [network=bitcore.Networks.testnet] - Network to make transaction
 * @returns string (transaction id)
 */
new Escrow(escrow.address, escrow.privateKey, addressTo, 1200, Escrow.Networks.livenet).then(function(transactionId){
    console.log(transactionId)
    // fabb99ef2e45e71cbc8eba3de15bf5729e8b502c22c4b52af04e98c49493d65e
})

Use transactionId to verify in blockchain.info API (or other services) to see the status of the transaction (incoming BTC should appears instantly)

Testnet Blockchain

Livenet Blockchain

Next steps

Contact

logo

Tiago Marques

Co-Founder & Head of Apps Development

[email protected]