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)
- Host: GitHub
- URL: https://github.com/ytakzk/bitcoinjs-wrapper
- Owner: ytakzk
- License: mit
- Created: 2017-07-21T12:03:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-02T02:43:08.000Z (almost 9 years ago)
- Last Synced: 2025-01-28T19:35:20.128Z (over 1 year ago)
- Topics: bitcoin, bitcoinjs, bitcoinjs-lib, blockchain, fintech
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
})
})
```