2021-07-13 16:42:39 -07:00
# ipfs-bch-wallet-service
2021-07-13 12:34:51 -07:00
[](http://standardjs.com) [](https://github.com/semantic-release/semantic-release)
2021-07-13 16:42:39 -07:00
This is a censorship-resistant, IPFS-based microservice that provides access for wallets to access the Bitcoin Cash (BCH) blockchain. It leverages [bch-js ](https://github.com/Permissionless-Software-Foundation/bch-js ).
2021-07-13 12:34:51 -07:00
2021-07-21 15:10:05 -07:00
- [Decentralized Blockchain Service Providers ](https://youtu.be/m_33rRXEats ) YouTube video demos this software.
2021-07-28 13:28:53 -07:00
- [JSON RPC and REST API Documentation ](https://ipfs-bch-wallet-service.fullstack.cash/ )
2021-07-21 15:10:05 -07:00
2021-07-13 16:42:39 -07:00
## About This Repository
2021-07-13 12:34:51 -07:00
2021-07-13 16:42:39 -07:00
This repository is forked from the [ipfs-service-provider ](https://github.com/Permissionless-Software-Foundation/ipfs-service-provider ) repository. That code has been customized to provide BCH blockchain access for wallets. This server-side node.js app provides both REST API over HTTP and JSON RPC over IPFS endpoints for wallets to access the blockchain through.
2021-07-13 12:34:51 -07:00
2021-07-13 16:42:39 -07:00
As part of the end-to-end testing, a virtual client can be started that will interrogate every endpoint provided by this API server. This client can be forked by developers to write their own apps that use this IPFS-based service.
2021-07-13 12:34:51 -07:00
2021-07-13 16:53:30 -07:00
## Roadmap
This repository is one step in a longer path. Here are the major milestones of this path:
2021-07-13 16:55:26 -07:00
- Add wallet-based calls to ipfs-bch-wallet-service (this repository).
2021-07-13 16:53:30 -07:00
- Create a miniature version of bch-js that makes calls over JSON RPC (bch-js-ipfs).
- Given a variable, minimal-slp-wallet could call bch-js or bch-js-ipfs for network calls.
- Fork slp-cli-wallet and add `daemon` feature to spin up IPFS node and work with bch-js-ipfs.
2021-07-13 12:34:51 -07:00
## Requirements
2024-08-20 07:32:30 -07:00
- node ** ^20.16.0**
- npm ** ^10.8.1**
- Docker ** ^24.0.7**
2022-01-03 11:35:26 -08:00
- Docker Compose ** ^1.27.4**
2021-07-13 12:34:51 -07:00
## Installation
2021-09-17 11:17:10 -07:00
### Development Environment
2022-01-03 11:35:26 -08:00
**Note:** This software now uses an external go-ipfs IPFS node. The instructions below have not been updated to reflect this.
2021-09-17 11:17:10 -07:00
A development environment will allow you modify the code on-the-fly and contribute to the code base of this repository. [PM2 ](https://www.npmjs.com/package/pm2 ) is recommended for running this code base as an IPFS Circuit Relay.
2021-09-17 17:41:08 -07:00
- [Video: Installing ipfs-service-provider ](https://youtu.be/Z0NsboIVN44 )
- [Step-by-step installation instructions ](https://gist.github.com/christroutner/3304a71d4c12a3a3e1664a438f64d9d0 )
2021-07-13 12:34:51 -07:00
```bash
2021-07-13 16:42:39 -07:00
git clone https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service
cd ipfs-bch-wallet-service
2021-12-14 21:25:00 -07:00
./install-mongo.sh
2021-07-13 12:34:51 -07:00
npm install
2022-01-18 12:14:51 -08:00
cd shell-scripts
2021-09-18 11:34:23 -07:00
./ipfs-bch-wallet-service.sh
2021-04-09 08:39:53 -07:00
```
2021-09-17 11:17:10 -07:00
### Production Environment
2022-01-03 11:35:26 -08:00
The [docker ](./production/docker ) directory contains a Dockerfile for building a production deployment.
2021-09-17 11:17:10 -07:00
```
2022-05-16 12:31:53 -07:00
docker-compose pull
2021-09-17 11:17:10 -07:00
docker-compose up -d
2021-07-13 12:34:51 -07:00
```
2023-10-28 11:27:06 -07:00
- You can bring the containers down with `docker-compose down`
- You can bring the containers back up with `docker-compose up -d` .
2022-01-03 11:35:26 -08:00
2024-03-24 07:17:42 -07:00
### Configuration
2021-09-17 11:17:10 -07:00
2024-03-24 07:17:42 -07:00
This program is intended to started with a Bash shell script. In that script, you can set the following environment variables:
2022-01-03 11:35:26 -08:00
2021-04-09 08:39:53 -07:00
```bash
2024-03-24 07:17:42 -07:00
# The instance of bch-api to connect to.
export APISERVER = http://172.17.0.1:3000/v5/
2021-09-17 11:17:10 -07:00
```
2022-01-03 11:35:26 -08:00
2024-03-23 17:44:41 -07:00
### Configuration
This app is intended to be started via a bash shell script. See the environment variables used to configure this app in the [config/env/common.js file ](./config/env/common.js ).
2023-10-28 10:11:04 -07:00
## File Structure
2021-07-13 12:34:51 -07:00
2023-10-28 10:19:59 -07:00
The file layout of this repository follows the file layout of [Clean Architecture ](https://christroutner.github.io/trouts-blog/blog/clean-architecture ). Understaning the principles laid out this article will help developers navigate the code base.
2021-07-13 12:34:51 -07:00
## Usage
- `npm start` Start server on live mode
- `npm run docs` Generate API documentation
- `npm test` Run mocha tests
## Documentation
2023-10-28 10:11:04 -07:00
API documentation is written inline and generated by [apidoc ](http://apidocjs.com/ ). Docs can be generated with this command:
- `npm run docs`
2021-07-13 12:34:51 -07:00
2023-10-28 10:19:59 -07:00
Visit `http://localhost:5020/` to view docs
2021-07-13 12:34:51 -07:00
2022-06-27 10:09:08 -07:00
There is additional developer documentation in the [dev-docs directory ](./dev-docs ).
2021-07-13 12:34:51 -07:00
## Dependencies
- [koa2 ](https://github.com/koajs/koa/tree/v2.x )
- [koa-router ](https://github.com/alexmingoia/koa-router )
- [koa-bodyparser ](https://github.com/koajs/bodyparser )
- [koa-generic-session ](https://github.com/koajs/generic-session )
- [koa-logger ](https://github.com/koajs/logger )
- [MongoDB ](http://mongodb.org/ )
- [Mongoose ](http://mongoosejs.com/ )
- [Passport ](http://passportjs.org/ )
- [Nodemon ](http://nodemon.io/ )
- [Mocha ](https://mochajs.org/ )
- [apidoc ](http://apidocjs.com/ )
- [ESLint ](http://eslint.org/ )
- [ipfs-coord ](https://www.npmjs.com/package/ipfs-coord )
## IPFS
Snapshots pinned to IPFS will be listed here.
## License
[MIT ](./LICENSE.md )
2021-09-02 17:12:11 -07:00
a