btc-provider

0.1.0 • Public • Published

Bitcoin provider

Makes it easy to work with a bitcoin wallet.

Install

npm i --save btc-provider

Include

var BitcoinProvider = require("btc-provider").default;

or for ES-2015

import BitcoinProvider from 'btc-provider'

Initialize

const bitcoinProvider = new BitcoinProvider('testnet'); // or mainnet

Usage

Create private key

const privateKey = bitcoinProvider.createPrivateKey();

Create private key from mnemonic

const privateKey = bitcoinProvider.createPrivateKeyFromMnemonic(mnemonic);

let mnemonic = 'absurd green cannon quarter call spray upper diet defense convince live assist'
or 
let mnemonic = bitcoinProvider.generateMnemonic()

Create public key

const publicKey = bitcoinProvider.createPublicKey(privateKey);

Get balance

const balance = bitcoinProvider.getBalance(publicKey);

Create transaction

bitcoinProvider.createTransaction(from, to, amount, minerFeePerByte, privateKey).then(transaction=>{
    console.log(transaction);
});
from - your public key 
to - address of the recipient
amount - amount in btc
minerFeePerByte - default equal 0.028 Satoshis
privateKey - your private key

Package Sidebar

Install

npm i btc-provider

Weekly Downloads

10

Version

0.1.0

License

ISC

Unpacked Size

3.68 MB

Total Files

592

Last publish

Collaborators

  • vlad88vlad