diff --git a/README.md b/README.md index 31764e7..9a9827f 100644 --- a/README.md +++ b/README.md @@ -24,34 +24,19 @@ Both bch-api and bch-js are part of the [Cash Stack](https://cashstack.info). Have questions? Need help? Join our community support: - [Telegram channel](https://t.me/bch_js_toolkit) -## 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](https://github.com/Permissionless-Software-Foundation/jwt-bch-api) and [this front end](https://github.com/Permissionless-Software-Foundation/jwt-bch-frontend). 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](https://github.com/Permissionless-Software-Foundation/bch-js-examples). -Rate limits are 20 requests per minute, but you can increase them to 100 with a [paid account](https://fullstack.cash/pricing). -You can bootstrap your own REST API server by downloading and installing the infrastructure listed on the [CashStrap](https://fullstack.cash/cashstrap) page. - ### Configure bch-js The live servers can be used by [bch-js](https://github.com/Permissionless-Software-Foundation/bch-js) by settings the `restURL` config property to one of these servers: -- BCHN Mainnet REST API server: https://bchn.fullstack.cash/v4/ -- ABC Mainnet REST API server: https://abc.fullstack.cash/v4/ -- Testnet3 REST API server: https://testnet3.fullstack.cash/v4/ +- BCH Mainnet REST API server: https://bchn.fullstack.cash/v5/ +- eCash Mainnet REST API server: https://abc.fullstack.cash/v5/ - Check server status: https://metrics.fullstack.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 on [this page](https://psfoundation.cash/blog/cash-stack). +described on [CashStack.info](https://cashstack.info). -This code targets the Ubuntu 18.04 LTS Linux OS or higher. +This hardware target for this software is a PC running Ubuntu 18.04 LTS Linux OS or higher. ### Development This is a standard node.js project. The installation is as follows: @@ -76,7 +61,7 @@ For a production environment, a Docker container is provided in the containers target the Ubuntu 18.04 LTS Linux OS. - Install Docker and Docker Compose by following the commands on -[this Dev Ops page](https://troutsblog.com/research/dev-ops/overview). +[this Dev Ops page](https://bafybeidpuq6pgpryd22wwykhqh2etw44pzofuncm5ldczk5v733tkwk55y.ipfs.dweb.link/docs/dev-ops/overview). - Customize the [bash script](docker/mainnet/start-local-mainnet.sh) for your installation. @@ -90,7 +75,13 @@ installation. `docker-compose up` ## Rate Limits -The rate limits for [api.fullstack.cash](https://api.fullstack.cash) are controlled by a JWT token. You can increase your rate limits by [purchasing a JWT token](https://https://fullstack.cash). If you're using bch-js, [check the readme for instructions on increasing rate limits](https://github.com/Permissionless-Software-Foundation/bch-js#api-key). For interacting with bch-api directly, you can then include the JWT token in the HTTP header like this: +Rate limiting of the REST API can be controlled in three different ways: + - JWT tokens for individual users + - Basic Authentication tokens for company-wide usage. + - Whitelisting for specific domain names + +### JWT Tokens +The rate limits for [api.fullstack.cash](https://api.fullstack.cash) are controlled by a JWT token. You can increase your rate limits by [purchasing a JWT token](https://fullstack.cash). If you're using bch-js, [check the readme for instructions on increasing rate limits](https://github.com/Permissionless-Software-Foundation/bch-js#api-key). For interacting with bch-api directly, you can then include the JWT token in the HTTP header like this: - `Authorization: Token ` @@ -103,12 +94,24 @@ 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](https://t.me/bch_js_toolkit) +### Basic Authentication +For private installations, Basic Authentication can be used to give everyone in an organization access to higher rate limits, while restricting use by the public. More than one Basic Authentication password can be generated by using the colon `:` to separate entries in the `PRO_PASS` environment variable. See the [bash script](docker/mainnet/start-local-mainnet.sh) for an example. -## IPFS -Copies of this repository will occasionally be uploaded and hosted on [IPFS](https://ipfs.io): +### Whitelists +Website domain names can be added to the `WHITELIST_DOMAINS` environment variable. Multiple domains can be separated with a comma `,`. Any web app making a request from that domain will be granted top-level rate limits. + +## Donate + +The open source software is developed and maintained by the [Permissionless Software Foundation](https://psfoundation.cash). If this library provides value to you, please consider making a donation to support the PSF developers: + +
+ +

bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr

+
+ + +## Censorship Resistance +Copies of this repository will occasionally be uploaded and hosted on the Filecoin blockchain, [IPFS](https://ipfs.io), and the [Radicle](https://radicle.xyz) p2p network. - v1.25.1: [QmXFzFJHenymhReDc9oGAxbpmvK2fJYnisQ2pJn3gGyKKX](https://ipfs.io/ipfs/QmXFzFJHenymhReDc9oGAxbpmvK2fJYnisQ2pJn3gGyKKX) diff --git a/diagrams/bch-api-dependency-graph.dia b/diagrams/bch-api-dependency-graph.dia index cb131ae..1193c5b 100644 Binary files a/diagrams/bch-api-dependency-graph.dia and b/diagrams/bch-api-dependency-graph.dia differ diff --git a/diagrams/bch-api-dependency-graph.png b/diagrams/bch-api-dependency-graph.png index f797a8f..4655852 100644 Binary files a/diagrams/bch-api-dependency-graph.png and b/diagrams/bch-api-dependency-graph.png differ diff --git a/diagrams/donation-qr.png b/diagrams/donation-qr.png new file mode 100644 index 0000000..a0efbbf Binary files /dev/null and b/diagrams/donation-qr.png differ diff --git a/start-dev-example.sh b/start-dev-example.sh index 68e9390..a074d1f 100755 --- a/start-dev-example.sh +++ b/start-dev-example.sh @@ -1,7 +1,7 @@ #!/bin/bash # Docker containers for the below infrastructure is described here: -# https://psfoundation.cash/blog/cash-stack +# https://CashStack.info # Pre-synced databases can be downloaded on the CashStrap page: # https://fullstack.cash/cashstrap @@ -20,20 +20,10 @@ export RPC_PASSWORD=password # double spends. #export RPC_SENDURL=http://$RPC_IP/ -# SLPDB -export SLPDB_PASS_GP=somelongpassword -export SLPDB_URL=http://:12300/ -# Use the same address as SLPDB_URL if you don't have a separate whitelist server. -export SLPDB_PASS_WL=somelongpassword -export SLPDB_WHITELIST_URL=http://:12300/ -# slp-api alternative SLP validator using slp-validate: -# https://github.com/Permissionless-Software-Foundation/slp-api -export SLP_API_URL=http://10.0.0.5:5001/ +# psf-slp-indxer +export SLP_INDEXER_API=http://:/ # Mainnet Fulcrum / ElectrumX -export FULCRUM_URL=192.168.0.6 -export FULCRUM_PORT=50002 -# Fulcrum API (used for /v5+ routes) export FULCRUM_API=http://172.17.0.1:3001/v1/ # Redis DB - Used for rate limiting - customize to your own Redis installation. @@ -46,7 +36,7 @@ export REDIS_HOST=172.17.0.1 export TOKENSECRET=somelongpassword # So that bch-api can call bch-js locally. -export LOCAL_RESTURL=http://127.0.0.1:3000/v4/ +export LOCAL_RESTURL=http://127.0.0.1:3000/v5/ # Basic Authentication password export PRO_PASS=somerandomepassword:someotherrandompassword:aThirdPassword