An open API service indexing awesome lists of open source software.

https://github.com/ytakzk/bitcoinjs-wrapper

bitcoinjs wrapper (under development)
https://github.com/ytakzk/bitcoinjs-wrapper

bitcoin bitcoinjs bitcoinjs-lib blockchain fintech

Last synced: about 1 month ago
JSON representation

bitcoinjs wrapper (under development)

Awesome Lists containing this project

README

          

# 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)
})
})
```