JSPM

blockcypher

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 544
  • Score
    100M100P100Q127755F
  • License MIT

A REST API client for BlockCypher

Package Exports

  • blockcypher

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (blockcypher) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Node.js CI

node-client

Node.js SDK for the BlockCypher Web services. See https://www.blockcypher.com/dev/bitcoin/ for detailed documentation.

To install, just use npm:

npm install blockcypher

Examples

bcypher = require('blockcypher');

var bcapi = new bcypher('btc','main',process.env.TOKEN);

function printResponse(err, data) {
  if (err !== null) {
    console.log(err);
  } else {
    console.log(data);
  }
}

//get chain info
bcapi.getChain(printResponse);
//get block height without any optional URL params
bcapi.getBlock(300000, printResponse);
//get block height with an optional "txstart" param, as outlined in docs here: http://dev.blockcypher.com/
bcapi.getBlock(300000, {txstart:2}, printResponse);

//let's try a post request, like making a new webhook
var webhook = {
    event: "unconfirmed-tx",
    address: "15qx9ug952GWGTNn7Uiv6vode4RcGrRemh",
    url: "https://my.domain.com/callbacks/new-tx"
};
bcapi.createHook(webhook, printResponse);

//Now let's list all of our webhooks
bcapi.listHooks(printResponse);