mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service.git
synced 2026-09-21 16:52:03 -07:00
118 lines
5.3 KiB
Markdown
118 lines
5.3 KiB
Markdown
# ipfs-bch-wallet-service
|
|
|
|
[](http://standardjs.com) [](https://github.com/semantic-release/semantic-release)
|
|
|
|
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).
|
|
|
|
- [Decentralized Blockchain Service Providers](https://youtu.be/m_33rRXEats) YouTube video demos this software.
|
|
- [JSON RPC and REST API Documentation](https://ipfs-bch-wallet-service.fullstack.cash/)
|
|
|
|
## About This Repository
|
|
|
|
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.
|
|
|
|
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 `daemon` feature to spin up IPFS node and work with bch-js-ipfs.
|
|
|
|
## Requirements
|
|
|
|
- node **^14.18.2**
|
|
- npm **^8.3.0**
|
|
- Docker **^20.10.8**
|
|
- Docker Compose **^1.27.4**
|
|
|
|
## Installation
|
|
|
|
### Development Environment
|
|
|
|
**Note:** This software now uses an external go-ipfs IPFS node. The instructions below have not been updated to reflect this.
|
|
|
|
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.
|
|
|
|
- [Video: Installing ipfs-service-provider](https://youtu.be/Z0NsboIVN44)
|
|
- [Step-by-step installation instructions](https://gist.github.com/christroutner/3304a71d4c12a3a3e1664a438f64d9d0)
|
|
|
|
```bash
|
|
git clone https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service
|
|
cd ipfs-bch-wallet-service
|
|
./install-mongo.sh
|
|
npm install
|
|
cd shell-scripts
|
|
./ipfs-bch-wallet-service.sh
|
|
```
|
|
|
|
### Production Environment
|
|
|
|
The [docker](./production/docker) directory contains a Dockerfile for building a production deployment.
|
|
|
|
```
|
|
docker-compose build --no-cache
|
|
docker-compose up -d
|
|
```
|
|
|
|
- Bring the containers up once, then take them back down with `docker-compose down`.
|
|
- Copy the [swarm.key](./swarm.key) file to `ipfs-service-provider/production/data/go-ipfs/data/swarm.key`.
|
|
- Bring the containers back up with `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.
|
|
|
|
- The PSF network operates as a private network. It does not connect or interact with the wider PSF network, relying instead on gateways to bridge the two networks, when they need to share content. This improves the performance and experience for everyone in the PSF network. To join the network, you'll need to add the [swarm.key](./swarm.key) file to the IPFS data folder.
|
|
|
|
- [Instructions on setting up IPFS private networks.](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#private-networks)
|
|
- For external installations, the swarm.key file will typically go in `~/.ipfs/swarm.key`
|
|
- For production Docker containers, the key would go in `ipfs-service-provider/production/data/go-ipfs/data/swarm.key`
|
|
|
|
## Structure
|
|
|
|
The file layout of this repository differs from the koa-api-boilerplate. Instead, it follows the file layout of [Clean Architecture](troutsblog.com/blog/clean-architecture).
|
|
|
|
## Usage
|
|
|
|
- `npm start` Start server on live mode
|
|
- `npm run docs` Generate API documentation
|
|
- `npm test` Run mocha tests
|
|
- `docker-compose build` Build a 'production' Docker container
|
|
- `docker-compose up` Run the docker container
|
|
|
|
## Documentation
|
|
|
|
API documentation is written inline and generated by [apidoc](http://apidocjs.com/).
|
|
|
|
Visit `http://localhost:5000/docs/` to view docs
|
|
|
|
## 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
|