mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
Merge pull request #191 from Permissionless-Software-Foundation/ct-unstable
Updating README
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Permissionless Software Foundation
|
||||
Copyright (c) 2022 Permissionless Software Foundation developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -3,48 +3,41 @@
|
||||
[](https://github.com/Permissionless-Software-Foundation/bch-js/blob/master/LICENSE.md)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
This is a REST API server, written in node.js JavaScript, using [Express.js](https://expressjs.com/) 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](https://psfoundation.cash/blog/cash-stack) to learn about the 'Cash Stack'. Visit [FullStack.cash](https://fullstack.cash), sign up for a free account, and use this REST API right away with the [bch-js](https://github.com/Permissionless-Software-Foundation/bch-js) JavaScript library.
|
||||
This is a REST API server, written in node.js JavaScript, using the [Express.js](https://expressjs.com/) framework. The purpose of this code is to create a REST API server that provides a common interface for developers to build blockchain-based business applications. This software works with the Bitcoin Cash (BCH) and eCash (XEC) blockchains.
|
||||
- High-level documentation is available on [CashStack.info](https://cashstack.info).
|
||||
|
||||
This repository is intended to be paired with [bch-js](https://github.com/Permissionless-Software-Foundation/bch-js), an npm JavaScript library for building Bitcoin Cash apps.
|
||||
While developers are encouraged to run and manage their own infrastructure, cloud-based infrastructure is available via [FullStack.cash](https://fullstack.cash). Free and paid tiers are available. You can use this REST API right away with the [bch-js](https://github.com/Permissionless-Software-Foundation/bch-js) JavaScript library.
|
||||
|
||||

|
||||
This repository is intended to be paired with [bch-js](https://github.com/Permissionless-Software-Foundation/bch-js), an npm JavaScript library for building Bitcoin Cash apps. [Code examples](https://github.com/Permissionless-Software-Foundation/bch-js-examples) for common use-cases are available, and the [minimal-slp-wallet](https://www.npmjs.com/package/minimal-slp-wallet) is a front end JavaScript library that incorporates bch-js and provides basic wallet functionality.
|
||||
|
||||
Both bch-api and bch-js are part of the 'Cash Stack' [full stack of BCH software](https://troutsblog.com/research/bitcoin-cash/how-to-bch-full-stack-developer).
|
||||

|
||||
|
||||
- [API Documentation](https://fullstack.cash/documentation)
|
||||
- [Example Code](https://fullstack.cash/examples)
|
||||
## Documentation
|
||||
All the software above is part of the [Cash Stack](https://cashstack.info).
|
||||
|
||||
- [CashStack](https://cashstack.info) high-level documentation.
|
||||
- [bch-api REST API reference](https://api.fullstack.cash/docs/)
|
||||
- [bch-js JavaScript API reference](https://bchjs.fullstack.cash/)
|
||||
- [bch-js example code](https://github.com/Permissionless-Software-Foundation/bch-js-examples)
|
||||
- [Additional documentation on FullStack.cash](https://fullstack.cash/documentation)
|
||||
- [Additional examples on FullStack.cash](https://fullstack.cash/examples)
|
||||
|
||||
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.
|
||||
- [Telegram channel](https://t.me/bch_js_toolkit)
|
||||
|
||||
### 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:
|
||||
@@ -69,7 +62,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.
|
||||
@@ -80,10 +73,16 @@ installation.
|
||||
|
||||
- Run the Docker container with:
|
||||
|
||||
`docker-compose up`
|
||||
`docker-compose up -d`
|
||||
|
||||
## 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 organization-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 (without bch-js), you can then include the JWT token in the HTTP header like this:
|
||||
|
||||
- `Authorization: Token <JWT token>`
|
||||
|
||||
@@ -96,15 +95,26 @@ 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. See the [bash script](docker/mainnet/start-local-mainnet.sh) for an example.
|
||||
|
||||
## Donate
|
||||
|
||||
This 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:
|
||||
|
||||
<div align="center">
|
||||
<img src="./diagrams/donation-qr.png" />
|
||||
<p>bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr</p>
|
||||
</div>
|
||||
|
||||
|
||||
## 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)
|
||||
|
||||
## License
|
||||
[MIT](./LICENSE.md)
|
||||
a
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
+4
-14
@@ -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://<SLPDB IP>: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://<SLPDB IP>: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://<ip>:<port>/
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user