https://github.com/makevoid/blockchain-info-api-basic
Simple API around Blockchain.info to: get address balance, get UTXOs, and push transactions.
https://github.com/makevoid/blockchain-info-api-basic
Last synced: 4 months ago
JSON representation
Simple API around Blockchain.info to: get address balance, get UTXOs, and push transactions.
- Host: GitHub
- URL: https://github.com/makevoid/blockchain-info-api-basic
- Owner: makevoid
- Created: 2015-04-27T00:46:38.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T20:46:45.000Z (over 3 years ago)
- Last Synced: 2025-05-08T08:04:14.675Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://github.com/makevoid/blockchain-api
- Size: 1.06 MB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
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:
```js
const bcApi = require('blockchain-api-basic')
const balance = bcApi.balance
const utxos = bcApi.utxos
const pushTx = bcApi.pushTx
```
- **balance(address)**
Retreives the balance of a given address
```js
;(async () => {
const bal = await balance(address)
console.log("balance:", bal)
// => balance: 9754600 (satoshis)
})()
```
- **utxos(address)**
Retrieves all the unspent transaction outputs for a given address:
```js
const outputs = await utxos(address)
console.log("UTXOs:", outputs)
// => UTXOs: [ { tx_hash: ... }, {...} ]
```
(note I'm omitting async from this example)
- **pushTx(tx_hash)**
```js
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 format
const response = await pushtx(rawTX)
console.log("push tx response:", response)
```
---
Enjoy!
@makevoid