ytakzk / bitcoinjs-wrapper

bitcoinjs wrapper (under development)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitcoinjs-wrapper

bitcoinjs wrapper (under development)

const bitcoin = require('./bitcoin')
const CONFIG  = require('./config')
const api     = require('./api_service')

const secretKey = 'secret-key'
const user      = bitcoin.create(secretKey)
const address   = user['address']
const wif       = user['wif']

console.log(address, wif)

// get balance
api.fetchBalance(address).then(function (balance) {
  console.log(balance)
})

// get utxo
api.fetchUTXO(address).then(function (utxos) {
  console.log(utxos)
})

// transfer bitcoins
api.fetchUTXO(address).then(function (utxos) {

  rawtx = bitcoin.createTransaction(secretKey, 'mwCwTceJvYV27KXBc3NJZys6CjsgsoeHmf', 10000, 1000, utxos)
  api.transaction(rawtx).then(function (value) {
    console.log(value)
  })
})

About

bitcoinjs wrapper (under development)

License:MIT License


Languages

Language:JavaScript 90.0%Language:HTML 10.0%