Simple API around Blockchain.info to: get address balance, get UTXOs, and push transactions.
Install
npm i --save blockchain-api-basic
Usage
Require the api:
const bcApi = const balance = bcApibalanceconst utxos = bcApiutxosconst pushTx = bcApipushTx
- balance(address)
Retreives the balance of a given address
;async { const bal = await console // => balance: 9754600 (satoshis)}
- utxos(address)
Retrieves all the unspent transaction outputs for a given address:
const outputs = await console// => UTXOs: [ { tx_hash: ... }, {...} ]
(note I'm omitting async from this example)
- pushTx(tx_hash)
const rawTX = "...." // your raw tx - for example you can create a transaction by using bitcoinjslib or bitcore and then serialize the transaction to get the raw tx in hex formatconst response = await console
Enjoy!
@makevoid