bch-api

Greenkeeper badge

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 BCH full node and various indexers.

This repository is intended to be paired with my alternative implementation of BITBOX SDK: bch-js.

Since this repo is being worked on by one person, as a hobby, updates will be slow. But the road map I have planned is as follows:

  • Replace the requirement for Insight API with Blockbook API for address and utxo based calls.

  • Remove rate limiting

  • Setup automated dependency management through Greenkeeper, and automated continuous-release with semantic versioning through Semantic Release.

  • Ensure all unit and integration tests are passing.

  • Update SLP token endpoints. Not totally sure of the scope here.

  • Add end-to-end tests.

Features

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

  • Address balance and UTXO queries for Blockbook and Bitcore added.
  • 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 10 requests per minute. 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

License

MIT

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