npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chris.troutner/bch-js

v3.4.1

Published

Bitcoin Cash JavaScript Library based on BITBOX

Downloads

158

Readme

bch-js

Build Status Version Downloads/week License

Deprecation Warning: This repository has been moved to the Permissionless Software Foundation bch-js repository. This repository is deprecated. @chris.troutner/bch-js v3.4.1 is the last version published from this repository. @psf/bch-js v3.5.2+ is the continuation of the library.

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 Start Videos:

Here are two YouTube walk-through videos to help you get started:

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.
})

Gatsby

bch-js is included in this gatsby-ipfs-template for building uncensorable web apps that can interact with the blockchain. When building a Gatsby (or other front-end app that uses Webpack), you'll need to add these lines to your gatsby-node.js file, as per this issue:

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    node: {
      fs: 'empty'
    }
  })
}

This is because the new IPFS class in bch-js uses the fs library for uploading files, which is not supported by Gatsby.

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.

  • Full SLP tokens support: bch-js has full support for all SLP token functionality, including send, mint, and genesis transactions. It also fully support all aspects of non-fugible tokans (NFTs).

  • 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