2020-08-08 10:27:34 -07:00
2019-06-18 13:25:19 -07:00
2020-03-30 18:24:23 -07:00
2020-11-08 12:35:18 -08:00
2020-11-08 12:54:28 -08:00
2020-02-07 17:12:18 -08:00
2020-03-21 08:57:25 -07:00

bch-api

Build Status

This is a fork and alternative implementation of the rest.bitcoin.com repository. The purpose of this code is to create a REST API server that provides a common interface for working with a Bitcoin Cash full node and various indexers. See this article to learn about the 'Cash Stack'. Visit FullStack.cash, sign up for a free account, and use this REST API right away with the bch-js JavaScript library.

This repository is intended to be paired with bch-js, an npm JavaScript library, and an alternative implementation of BITBOX SDK.

Both bch-api and bch-js are part of the full stack of BCH software.

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

Features

The following features set this repository apart from rest.bitcoin.com:

  • Address balance and UTXO queries use the Blockbook indexer instead of Insight.
  • Fine grain access is controlled with a JWT token using this back end auth server and this front end.
  • Default rate limits are set to 3 RPM for anonymous connections, 10 RPM for free accounts, up to 100 RPM if a full-access JWT token is used.
  • Typescript removed and ES8 JavaScript used instead.
  • npm audit run on all dependencies.
  • Greenkeeper implemented for automatic dependency management and security updates.

Live Demo

You can test a live demo of the REST API by running the bch-js examples. Rate limits are 3 requests per minute, but you can increase them to 10 with a free account. This is fast enough to try out the examples but these servers are not intended as a freemium service. You can run your own REST server by purchasing the hard drive at bchjs.cash.

Installation

There are two installation paths, depending if you want a development or production environment. You'll also need to set up the underlying infrastructure described this page.

This code targets the Ubuntu 18.04 LTS Linux OS.

Development

This is a standard node.js project. The installation is as follows:

  • Clone this repository:

git clone https://github.com/christroutner/bch-api && cd bch-api

  • Install dependencies:

npm install

  • Customize the start-dev-example.sh shell script to point to the required infrastructure. Start the bch-api REST API by running this script:

./start-dev-example.sh

Production

For a production environment, a Docker container is provided in the docker directory. One for mainnet and one for testnet. Again, these containers target the Ubuntu 18.04 LTS Linux OS.

  • Install Docker and Docker Compose by following the commands on this Dev Ops page.

  • Customize the bash script for your installation.

  • Build the Docker container with:

docker-compose build --no-cache

  • Run the Docker container with:

docker-compose up

Support

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

License

MIT

S
Description
Readme
6.4 MiB
Languages
JavaScript 97.4%
Shell 1.1%
HTML 0.7%
Pug 0.5%
Dockerfile 0.3%