mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service.git
synced 2026-09-22 01:02:03 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3eb1b1ad3 | ||
|
|
1e1e1558b4 | ||
|
|
d4abd693de | ||
|
|
d38718dcdf | ||
|
|
3a3376c303 | ||
|
|
05043ac74d | ||
|
|
5f89bfcbd8 | ||
|
|
d7d56d9ebf | ||
|
|
1592eadd8c | ||
|
|
be1a4c750a | ||
|
|
4572ce3d6b | ||
|
|
fb7d4e6074 | ||
|
|
5467c991de | ||
|
|
ba93c6cc46 | ||
|
|
60b37e4f72 | ||
|
|
02a543323c | ||
|
|
c28bc22084 | ||
|
|
f796dd6076 | ||
|
|
5d624f5c23 | ||
|
|
3eacfb27a6 | ||
|
|
29b3d32743 | ||
|
|
a58e237122 | ||
|
|
c237b33677 | ||
|
|
b48b618d4c | ||
|
|
252834d727 | ||
|
|
04bcd9fd3a | ||
|
|
cc5aba7896 | ||
|
|
50bc5c2d02 | ||
|
|
3251b0dc58 | ||
|
|
090f524b9d | ||
|
|
1846b5da64 | ||
|
|
643dfd8fc0 | ||
|
|
944d721296 | ||
|
|
96e4afd6c8 | ||
|
|
002e6657ff | ||
|
|
fb215b11b7 | ||
|
|
1618289078 | ||
|
|
2ebe42d5f4 | ||
|
|
326271f703 | ||
|
|
0480f54287 | ||
|
|
f9df8c7fab | ||
|
|
2ae550c027 | ||
|
|
eca131fefc | ||
|
|
596645ad6b | ||
|
|
2a2d940e7c | ||
|
|
46b0c595f9 | ||
|
|
eab7a30926 | ||
|
|
85a8efb5bf | ||
|
|
e33ee49879 | ||
|
|
9c53204a91 | ||
|
|
6faf1ccf86 | ||
|
|
8fafe96e01 | ||
|
|
d06c995174 | ||
|
|
2d02904ed1 | ||
|
|
51d7ddb362 | ||
|
|
ee1fbad02a | ||
|
|
f5ae98cb9c | ||
|
|
e416478522 | ||
|
|
ce85dffc97 | ||
|
|
c9f7a43339 | ||
|
|
a885fb7edf | ||
|
|
93d1542522 |
@@ -67,5 +67,6 @@ ipfsdata
|
||||
.ipfsdata
|
||||
ipfs-service-provider.sh
|
||||
start-bch-wallet-service.sh
|
||||
data/
|
||||
|
||||
!README.md
|
||||
|
||||
@@ -78,3 +78,5 @@ Snapshots pinned to IPFS will be listed here.
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE.md)
|
||||
|
||||
a
|
||||
|
||||
+7
-1
@@ -47,6 +47,9 @@ class Server {
|
||||
useNewUrlParser: true
|
||||
})
|
||||
|
||||
console.log(`Starting environment: ${config.env}`)
|
||||
console.log(`Debug level: ${config.debugLevel}`)
|
||||
|
||||
// MIDDLEWARE START
|
||||
|
||||
app.use(convert(logger()))
|
||||
@@ -68,7 +71,7 @@ class Server {
|
||||
// Attach REST API and JSON RPC controllers to the app.
|
||||
const Controllers = require('../src/controllers')
|
||||
const controllers = new Controllers()
|
||||
await controllers.attachControllers(app)
|
||||
await controllers.attachRESTControllers(app)
|
||||
|
||||
app.controllers = controllers
|
||||
|
||||
@@ -94,6 +97,9 @@ class Server {
|
||||
)
|
||||
}
|
||||
|
||||
// Attach the other IPFS controllers
|
||||
await controllers.attachControllers(app)
|
||||
|
||||
return app
|
||||
} catch (err) {
|
||||
console.error('Could not start server. Error: ', err)
|
||||
|
||||
Vendored
+6
-1
@@ -73,5 +73,10 @@ module.exports = {
|
||||
|
||||
// IPFS Ports
|
||||
ipfsTcpPort: process.env.IPFS_TCP_PORT ? process.env.IPFS_TCP_PORT : 5668,
|
||||
ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 5669
|
||||
ipfsWsPort: process.env.IPFS_WS_PORT ? process.env.IPFS_WS_PORT : 5669,
|
||||
|
||||
// BCH Mnemonic for generating encryption keys and payment address
|
||||
mnemonic: process.env.MNEMONIC ? process.env.MNEMONIC : '',
|
||||
|
||||
debugLevel: process.env.DEBUG_LEVEL ? parseInt(process.env.DEBUG_LEVEL) : 2
|
||||
}
|
||||
|
||||
Generated
+4167
-2632
File diff suppressed because it is too large
Load Diff
+4
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ipfs-bch-wallet-service",
|
||||
"version": "1.9.1",
|
||||
"version": "1.11.4",
|
||||
"description": "IPFS and REST service providing blockchain access needed by a wallet. ",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -27,8 +27,8 @@
|
||||
"axios": "^0.21.1",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"glob": "^7.1.6",
|
||||
"ipfs": "0.55.4",
|
||||
"ipfs-coord": "^6.1.2",
|
||||
"@chris.troutner/ipfs": "2.0.2",
|
||||
"ipfs-coord": "^6.6.0",
|
||||
"jsonrpc-lite": "^2.2.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"jwt-bch-lib": "^1.3.0",
|
||||
@@ -45,6 +45,7 @@
|
||||
"koa2-ratelimit": "^0.9.0",
|
||||
"line-reader": "^0.4.0",
|
||||
"mongoose": "^5.11.15",
|
||||
"node-fetch": "npm:@achingbrain/node-fetch@^2.6.7",
|
||||
"nodemailer": "^6.4.17",
|
||||
"passport-local": "^1.0.0",
|
||||
"winston": "^3.3.3",
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# Start the testnet server with the command 'docker-compose up -d'
|
||||
|
||||
bch-wallet-mongodb:
|
||||
image: mongo
|
||||
container_name: mongo-bch-service
|
||||
ports:
|
||||
- '5555:27017' # <host port>:<container port>
|
||||
volumes:
|
||||
- ./database:/data/db
|
||||
command: mongod --logpath=/dev/null # -- quiet
|
||||
restart: always
|
||||
|
||||
bch-wallet-service:
|
||||
build: ./
|
||||
dockerfile: Dockerfile
|
||||
container_name: bch-wallet-service
|
||||
links:
|
||||
- bch-wallet-mongodb
|
||||
ports:
|
||||
# <host port>:<container port>
|
||||
- '5001:5001' # REST API
|
||||
- '5668:5668' # IPFS TCP Port
|
||||
- '5669:5669' # IPFS WS Port
|
||||
volumes:
|
||||
- ../ipfsdata:/home/safeuser/ipfsdata
|
||||
- ../orbitdb:/home/safeuser/orbitdb
|
||||
|
||||
restart: always
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#IMAGE BUILD COMMANDS
|
||||
# ct-base-ubuntu = ubuntu 18.04 + nodejs v10 LTS
|
||||
FROM christroutner/ct-base-ubuntu
|
||||
FROM christroutner/ct-base-ubuntu:latest
|
||||
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
|
||||
|
||||
#Create the user 'safeuser' and add them to the sudo group.
|
||||
@@ -23,34 +23,33 @@ WORKDIR /home/safeuser
|
||||
#RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
|
||||
|
||||
# Switch to user account.
|
||||
USER safeuser
|
||||
#USER safeuser
|
||||
# Prep 'sudo' commands.
|
||||
RUN echo 'abcd8765' | sudo -S pwd
|
||||
#RUN echo 'abcd8765' | sudo -S pwd
|
||||
|
||||
# Clone the rest.bitcoin.com repository
|
||||
WORKDIR /home/safeuser
|
||||
RUN git clone https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service
|
||||
# RUN mv koa-api-boilerplate koa
|
||||
# RUN mkdir keys
|
||||
|
||||
# Switch to the desired branch. `master` is usually stable,
|
||||
# and `stage` has the most up-to-date changes.
|
||||
WORKDIR /home/safeuser/ipfs-bch-wallet-service
|
||||
|
||||
# For development: switch to unstable branch
|
||||
# RUN git checkout unstable
|
||||
RUN git checkout ct-unstable
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install -g @mapbox/node-pre-gyp
|
||||
RUN npm install
|
||||
|
||||
# Generate the API docs
|
||||
RUN npm run docs
|
||||
|
||||
# Calling out the directorys that should be mounted as external volumes.
|
||||
RUN mkdir /home/safeuser/ipfsdata
|
||||
RUN mkdir /home/safeuser/orbitdb
|
||||
VOLUME /home/safeuser/ipfsdata
|
||||
VOLUME /home/safeuser/orbitdb
|
||||
RUN mkdir /home/safeuser/.ipfsdata
|
||||
#RUN mkdir /home/safeuser/orbitdb
|
||||
#VOLUME /home/safeuser/ipfsdata
|
||||
#VOLUME /home/safeuser/orbitdb
|
||||
|
||||
# Start the application.
|
||||
COPY start-production.sh start-production.sh
|
||||
@@ -0,0 +1,31 @@
|
||||
# Start the service with the command 'docker-compose up -d'
|
||||
|
||||
version: '2'
|
||||
services:
|
||||
bch-wallet-mongodb:
|
||||
image: mongo
|
||||
container_name: mongo-bch-service
|
||||
ports:
|
||||
- '5555:27017' # <host port>:<container port>
|
||||
volumes:
|
||||
- ../data/mongodb:/data/db
|
||||
command: mongod --logpath=/dev/null # -- quiet
|
||||
restart: always
|
||||
|
||||
bch-wallet-service:
|
||||
build: ./
|
||||
container_name: bch-wallet-service
|
||||
logging:
|
||||
driver: 'json-file'
|
||||
options:
|
||||
max-size: '10m'
|
||||
max-file: '10'
|
||||
links:
|
||||
- bch-wallet-mongodb
|
||||
ports:
|
||||
# <host port>:<container port>
|
||||
- '5001:5001' # REST API
|
||||
- '5668:5668' # IPFS TCP Port
|
||||
- '5669:5669' # IPFS WS Port
|
||||
volumes:
|
||||
- ../data/ipfsdata:/home/safeuser/ipfs-service-provider/.ipfsdata
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BEGIN: Optional configuration settings
|
||||
|
||||
# This mnemonic is used to set up persistent public key for e2ee
|
||||
# Replace this with your own 12-word mnemonic.
|
||||
export MNEMONIC="olive two muscle bottom coral ancient wait legend bronze useful process session"
|
||||
|
||||
# The human readable name this IPFS node identifies as.
|
||||
export COORD_NAME=ipfs-service-provider-generic
|
||||
|
||||
# Allow this node to function as a circuit relay. It must not be behind a firewall.
|
||||
#export ENABLE_CIRCUIT_RELAY=true
|
||||
|
||||
# Debug level. 0 = minimal info. 2 = max info.
|
||||
export DEBUG_LEVEL=1
|
||||
|
||||
# END: Optional configuration settings
|
||||
|
||||
|
||||
# Production database connection string.
|
||||
export DBURL=mongodb://172.17.0.1:5555/ipfs-service-prod
|
||||
|
||||
# Customize these environment variables for your own installation.
|
||||
export AUTHSERVER=https://auth.fullstack.cash
|
||||
export APISERVER=https://api.fullstack.cash/v5/
|
||||
export FULLSTACKLOGIN=demo@demo.com
|
||||
export FULLSTACKPASS=demo
|
||||
|
||||
# Ports
|
||||
export PORT=5001 # REST API
|
||||
export IPFS_TCP_PORT=5668 # IPSF TCP Port
|
||||
export IPFS_WS_PORT=5669 # IPFS WS Port
|
||||
|
||||
export SVC_ENV=production
|
||||
npm start
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Customize these environment variables for your own installation.
|
||||
export AUTHSERVER=https://auth.fullstack.cash
|
||||
export APISERVER=https://api.fullstack.cash/v5/
|
||||
export FULLSTACKLOGIN=demo@demo.com
|
||||
export FULLSTACKPASS=demo
|
||||
|
||||
# Ports
|
||||
export PORT=5001 # REST API
|
||||
export IPFS_TCP_PORT=5668 # IPSF TCP Port
|
||||
export IPFS_WS_PORT=5669 # IPFS WS Port
|
||||
|
||||
# Production database connection string.
|
||||
export DBURL=mongodb://172.17.0.1:5555/ipfs-service-prod
|
||||
|
||||
#export ENABLE_CIRCUIT_RELAY=1
|
||||
|
||||
export SVC_ENV=production
|
||||
npm start
|
||||
@@ -43,6 +43,8 @@ class IpfsCoordAdapter {
|
||||
}
|
||||
|
||||
async start (localConfig = {}) {
|
||||
// console.log('this.config.announceJsonLd: ', this.config.announceJsonLd)
|
||||
|
||||
this.ipfsCoord = new this.IpfsCoord({
|
||||
ipfs: this.ipfs,
|
||||
type: 'node.js',
|
||||
@@ -51,11 +53,13 @@ class IpfsCoordAdapter {
|
||||
privateLog: console.log, // Default to console.log
|
||||
isCircuitRelay: this.config.isCircuitRelay,
|
||||
apiInfo: this.config.apiInfo,
|
||||
announceJsonLd: this.config.announceJsonLd
|
||||
announceJsonLd: this.config.announceJsonLd,
|
||||
mnemonic: this.config.mnemonic,
|
||||
debugLevel: this.config.debugLevel
|
||||
})
|
||||
|
||||
// Wait for the ipfs-coord library to signal that it is ready.
|
||||
await this.ipfsCoord.start()
|
||||
await this.ipfsCoord.start({ type: 'node.js' })
|
||||
|
||||
// Signal that this adapter is ready.
|
||||
this.isReady = true
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
|
||||
// Global npm libraries
|
||||
const IPFS = require('ipfs')
|
||||
// const IPFS = require('ipfs')
|
||||
const IPFS = require('@chris.troutner/ipfs')
|
||||
|
||||
// Local libraries
|
||||
const config = require('../../../config')
|
||||
|
||||
@@ -36,7 +36,7 @@ class Controllers {
|
||||
await this.adapters.start()
|
||||
|
||||
// Attach the REST controllers to the Koa app.
|
||||
this.attachRESTControllers(app)
|
||||
// this.attachRESTControllers(app)
|
||||
|
||||
this.attachRPCControllers()
|
||||
}
|
||||
|
||||
@@ -45,12 +45,17 @@ class TestUtils {
|
||||
async sendRPC (ipfsId, cmdStr) {
|
||||
try {
|
||||
// Send the RPC command to the server/service.
|
||||
await this.ipfsCoord.ipfs.orbitdb.sendToDb(ipfsId, cmdStr)
|
||||
// await this.ipfsCoord.ipfs.orbitdb.sendToDb(ipfsId, cmdStr)
|
||||
await this.ipfsCoord.useCases.peer.sendPrivateMessage(
|
||||
ipfsId,
|
||||
cmdStr,
|
||||
this.ipfsCoord.thisNode
|
||||
)
|
||||
|
||||
let retData
|
||||
|
||||
// This event is triggered when the response comes back.
|
||||
this.eventEmitter.on('rpcData', inData => {
|
||||
this.eventEmitter.on('rpcData', (inData) => {
|
||||
retData = inData
|
||||
})
|
||||
|
||||
@@ -98,11 +103,8 @@ class TestUtils {
|
||||
apiInfo: 'none',
|
||||
announceJsonLd: announceJsonLd
|
||||
})
|
||||
await this.ipfsCoord.ipfs.start()
|
||||
// some ipfs-coord versions do not have this function
|
||||
if (this.ipfsCoord.isReady) {
|
||||
await this.ipfsCoord.isReady()
|
||||
}
|
||||
|
||||
await this.ipfsCoord.start()
|
||||
|
||||
// Wait to let ipfs-coord connect to subnet peers.
|
||||
await this.bchjs.Util.sleep(30000)
|
||||
@@ -126,10 +128,17 @@ class TestUtils {
|
||||
// 'ipfs-coord peer info: ',
|
||||
// this.ipfsCoord.ipfs.peers.state.peers[ipfsId]
|
||||
// )
|
||||
if (!this.ipfsCoord.ipfs.peers.state.peers[ipfsId]) {
|
||||
|
||||
const peers = this.ipfsCoord.thisNode.peerList
|
||||
// console.log('peers: ', peers)
|
||||
// console.log('Target peer in peerList? ', peers.includes(ipfsId))
|
||||
|
||||
// if (!this.ipfsCoord.ipfs.peers.state.peers[ipfsId]) {
|
||||
if (!peers.includes(ipfsId)) {
|
||||
throw new Error('Could not find UUT in ipfs-coord list of peers.')
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
console.error('Error in connectToUut()')
|
||||
console.log(
|
||||
'Is the service running? Did you update the test-data.json file?'
|
||||
@@ -215,7 +224,10 @@ class TestUtils {
|
||||
const result = await this.sendRPC(ipfsId, cmdStr)
|
||||
// console.log('result: ', result)
|
||||
|
||||
if (result.result.value.status && Array.isArray(result.result.value.transactions)) {
|
||||
if (
|
||||
result.result.value.status &&
|
||||
Array.isArray(result.result.value.transactions)
|
||||
) {
|
||||
console.log('E2E TEST: transactions test passed.')
|
||||
return true
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"uutAddr": "/ip4/192.168.43.115/tcp/5668/p2p/QmVBWvFxao7smhRjUUh1q8rNAEwMqbg4X3dqsQDMSjUpmx",
|
||||
"uutId": "QmfUjMqUeXSCzNkFGrzvf79yvV62dtjsnwtBSYKx3wegXw"
|
||||
"uutAddr": "/ip4/127.0.0.1/tcp/5701/p2p/QmWkjYRRTaxVEuGK8ip2X3trVyJShFs6U9g1h9x6fK5mZ2",
|
||||
"uutId": "QmWkjYRRTaxVEuGK8ip2X3trVyJShFs6U9g1h9x6fK5mZ2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user