4.3 KiB
ipfs-bch-wallet-service
This is a censorship-resistant, IPFS-based microservice that provides access for wallets to access the Bitcoin Cash (BCH) blockchain. It leverages bch-js.
- Decentralized Blockchain Service Providers YouTube video demos this software.
- JSON RPC and REST API Documentation
About This Repository
This repository is forked from the 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.
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.
Roadmap
This repository is one step in a longer path. Here are the major milestones of this path:
- Add wallet-based calls to ipfs-bch-wallet-service (this repository).
- 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
daemonfeature to spin up IPFS node and work with bch-js-ipfs.
Requirements
- node ^14.17.0
- npm ^7.13.0
Installation
Development Environment
A development environment will allow you modify the code on-the-fly and contribute to the code base of this repository. PM2 is recommended for running this code base as an IPFS Circuit Relay.
git clone https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service
cd ipfs-bch-wallet-service
./install-mongo-sh
npm install
./ipfs-bch-wallet-service.sh
Production Environment
The docker directory contains a Dockerfile for building a production deployment. However, there is currently a bug preventing the Docker container from being used as a Circuit Relay.
docker-compose build --no-cache
docker-compose up -d
Operation Notes
- There is a memory leak in the version of js-ipfs. The app is currently configured to shut down every 8 hours to flush memory. It relies on a process manager like pm2, Docker, or systemd to restart the app after it shuts down, in order to ensure continuous operation.
Structure
The file layout of this repository differs from the koa-api-boilerplate. Instead, it follows the file layout of Clean Architecture.
Usage
npm startStart server on live modenpm run docsGenerate API documentationnpm testRun mocha testsdocker-compose buildBuild a 'production' Docker containerdocker-compose upRun the docker container
Documentation
API documentation is written inline and generated by apidoc.
Visit http://localhost:5000/docs/ to view docs
Dependencies
- koa2
- koa-router
- koa-bodyparser
- koa-generic-session
- koa-logger
- MongoDB
- Mongoose
- Passport
- Nodemon
- Mocha
- apidoc
- ESLint
- ipfs-coord
IPFS
Snapshots pinned to IPFS will be listed here.
License
a