Need private packages and team management tools?Check out npm Teams »

@chris.troutner/bch-js

2.3.11 • Public • Published

bch-js

Build Status Version Downloads/week License

bch-js is a JavaScript npm library for creating web and mobile apps for interacting with the Bitcoin Cash (BCH) blockchain. It can be used for free, but requires an account on FullStack.cash for increased rate limits. Find out more from this article

Quick Links

Quick Notes

  • Install library: npm install @chris.troutner/bch-js

  • Instantiate the library in your code:

const BCHJS = require("@chris.troutner/bch-js")
let bchjs = new BCHJS()

// testnet
bchjs = new BCHJS({ restURL: 'https://tapi.fullstack.cash/v3/' })

This is a fork of the BITBOX SDK (which is maintained by Bitcoin.com). This library is intended to be paired with the bch-api REST API.

If you need a backward-compatible instance of this library, you can use a 'shim'. Do it like this:

const BCHJS = require("@chris.troutner/bch-js")
const bitbox = BCHJS.BitboxShim({ restURL: 'https://api.fullstack.cash/v3/' })

API Key

The bch-api REST API hosted by FullStack.cash uses JWT tokens to pay for increased rate limits when interacting with the back end server. See this article if you want to understand the system-as-a-whole. The JWT token can be fed to bch-js implicitly or explicitly.

  • Implicitly: bch-js will detect your JWT token by setting the BCHJSTOKEN environment variable.
  • Explicitly: You can directly feed in the JWT token with the apiToken property when instantiating the library. Here is an example:
const BCHJS = require("@chris.troutner/bch-js")
let bchjs = new BCHJS({
  restURL: 'https://api.fullstack.cash/v3/',
  apiToken: 'eyJhbGciO...' // Your JWT token here.
})

Features

This library sets itself apart from BITBOX with the following features:

  • ECMAScript 2017 standard JavaScript used instead of TypeScript. Works natively with node.js v10 or higher.

  • slp-sdk features are integrated into this library too. Currently only simple token sending is supported. If you need SLP token functionality, you should use slp-sdk, slp-cli-wallet.

  • Semantic Release for continuous delivery using semantic versioning.

  • Greenkeeper automatic dependency management for automatically maintaining the latest, most secure dependencies.

  • IPFS uploads of all files and dependencies, to backup dependencies in case they are ever inaccessible from GitHub or npm.

Documentation:

Full documentation for this library can be found here:

Original documentation on BITBOX is available at:

bch-js uses APIDOC so that documentation and working code live in the same repository. To generate the documentation:

  • npm run docs
  • Open the generated docs/index.html file in a web browser.

Support

Have questions? Need help? Join our community support Telegram channel

IPFS Releases

I will periodically publish IPFS releases of this repository, including all dependencies in the node_modules folder. This ensures working copies of this repository can be retrieved in case there is any drift in dependency files, or if dependencies are pulled from npm or GitHub.

  • Initial fork on 5/9/2019:

    • without node_modules folder: QmQFHfbBQdEHfhtiRLbXtX1NcgnfL45hZb7TbQimTXAuzG (4 MB)
    • with node_modules folder: QmXq9Ds6Qdkg9xbRhcF8pay9KabA6QN2y7bx3wvSqiXifk (107 MB)
  • v1.0.0 - refactored to pure JavaScript:

    • without node_modules folder: QmNjFsiTZRMAUa9rZpXqZqivv9JLaNicwLSPHjyLB7PVDk (1 MB)
    • with node_modules folder: Qma9ScApwBtuL7dpdSk7jpBFTxbqRdiR921WjyP75SU7bT (100 MB)

License

MIT

Keywords

none

Install

npm i @chris.troutner/bch-js

DownloadsWeekly Downloads

78

Version

2.3.11

License

MIT

Unpacked Size

1.03 MB

Total Files

108

Last publish

Collaborators

  • avatar