Files
ipfs-bch-wallet-service/README.md
T

120 lines
4.7 KiB
Markdown
Raw Normal View History

2021-07-13 16:42:39 -07:00
# ipfs-bch-wallet-service
2021-07-13 12:34:51 -07:00
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](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
2023-10-28 10:11:04 -07:00
- node **^16.20.2**
- npm **^8.19.4**
2022-01-03 11:35:26 -08:00
- Docker **^20.10.8**
- 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
./ipfs-bch-wallet-service.sh
```
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
2021-09-17 11:17:10 -07:00
### Development Environment
2023-10-28 10:11:04 -07:00
A development environment will allow you modify the code on-the-fly and contribute to the code base of this repository. Ubuntu v20 is the recommended OS for creating a dev environment. Other operating systems may cause issues.
2022-01-03 11:35:26 -08:00
```bash
2021-07-13 10:00:39 -07:00
git clone https://github.com/Permissionless-Software-Foundation/ipfs-service-provider
cd ipfs-service-provider
2021-09-17 11:18:26 -07:00
./install-mongo-sh
npm install
2023-10-28 10:11:04 -07:00
npm start
2021-09-17 11:17:10 -07:00
```
2022-01-03 11:35:26 -08:00
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)
a