Coder Social home page Coder Social logo

samrock5000 / bch-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from permissionless-software-foundation/bch-api

0.0 0.0 0.0 5.73 MB

The REST API powering FullStack.cash

License: MIT License

JavaScript 97.31% Shell 1.15% Dockerfile 0.32% HTML 0.72% Pug 0.50%

bch-api's Introduction

bch-api

License js-standard-style

This is a REST API server, written in node.js JavaScript, using Express.js framework. 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 for building Bitcoin Cash apps.

Cash Stack Network Diagram

Both bch-api and bch-js are part of the 'Cash Stack' 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:

  • Fine grain access is controlled with a JWT token using this back end auth server and this front end. Can be used to monetize access to the REST API.
  • Typescript removed and ES8 JavaScript used instead.
  • npm audit fix frequently run to fix dependencies.

Live Demo

You can test a live demo of the REST API by running the bch-js examples. Rate limits are 20 requests per minute, but you can increase them to 100 with a paid account. You can bootstrap your own REST API server by downloading and installing the infrastructure listed on the CashStrap page.

Configure bch-js

The live servers can be used by bch-js by settings the restURL config property to one of these servers:

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 on this page.

This code targets the Ubuntu 18.04 LTS Linux OS or higher.

Development

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

  • Clone this repository:

git clone https://github.com/Permissionless-Software-Foundation/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

Rate Limits

The rate limits for api.fullstack.cash are controlled by a JWT token. You can increase your rate limits by purchasing a JWT token. If you're using bch-js, check the readme for instructions on increasing rate limits. For interacting with bch-api directly, you can then include the JWT token in the HTTP header like this:

  • Authorization: Token <JWT token>

cURL example

Here is an example using curl for using the JWT token when making a call to the REST API:

export BCHJSTOKEN=eyJhbGciOiJ....

curl "https://bchn.fullstack.cash/v4/electrumx/balance/bitcoincash:qr69kyzha07dcecrsvjwsj4s6slnlq4r8c30lxnur3" -X GET -H "Content-Type: application/json" -H "Authorization: Token ${BCHJSTOKEN}"

Support

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

IPFS

Copies of this repository will occasionally be uploaded and hosted on IPFS:

License

MIT a

bch-api's People

Contributors

christroutner avatar greenkeeper[bot] avatar danielhumgon avatar rkalis avatar zh avatar samrock5000 avatar bytesofman avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.