The following document is a step-by-step guide to run wallet-service.
Ensure MongoDB (2.6+) is installed and running. This document assumes that mongod is running at the default port 27017. See the configuration section to configure a different host/port.
Use the following steps to Install wallet-service from the npmjs repository and run it with defaults. To change configuration before running, see the Configuration section.
npm install @owstack/wallet-service
cd wallet-serviceUse the following steps to Install wallet-service from github source and run it with defaults. To change configuration before running, see the Configuration section.
git clone https://github.com/owstack/wallet-service.git
cd wallet-service
npm installStart all services for all supported coin networks.
npm start allStart services for a specific coin network.
npm start [ btc | bch | ltc ]Use the following to run tests
npm testUse the following to run coverage during testing
npm run coverageor
makeConfiguration for all required modules can be specified in https://github.com/owstack/wallet-service/blob/master/base-service/config.js
The wallet-service is composed of the following separate node services:
One global instance of each:
- Fiat Rate Service - base-service/fiatrateservice/fiatrateservice.js
- Locker - base-service/locker/locker.js
- Message Broker - base-service/messagebroker/messagebroker.js
- Wallet Service - base-service/ws.js
One instance of each per coin network:
- Blockchain Monitor - service-template/bcmonitor/bcmonitor.js (This service talks to the Blockchain Explorer service configured under blockchainExplorerOpts - see Configure blockchain service below.)
- Email Service - service-template/emailservice/emailservice.js
- Push Notifications Service - service-template/pushnotificationsservice/pushnotificationsservice.js
Example configuration for connecting to the MongoDB instance:
storageOpts: {
mongoDb: {
uri: 'mongodb://localhost:27017/ws',
},
}Example configuration for connecting to locker service:
lockOpts: {
lockerServer: {
host: 'localhost',
port: 3231,
},
}Example configuration for connecting to message broker service:
messageBrokerOpts: {
messageBrokerServer: {
url: 'http://localhost:3380',
},
}Note: this service will be used by blockchain monitor service as well as by wallet-service itself. An example of this configuration is:
blockchainExplorerOpts: {
defaultProvider: 'explorer',
// Providers
'explorer': {
'livenet': {
url: 'https://explorer.openwalletstack.com:443',
apiPrefix: '/explorer-api'
},
'testnet': {
url: 'https://test-explorer.openwalletstack.com:443',
apiPrefix: '/explorer-api'
}
}
}Example configuration for connecting to email service (using postfix):
emailOpts: {
host: 'localhost',
port: 25,
ignoreTLS: true,
subjectPrefix: '[Wallet Service]',
from: 'wallet-service@openwalletstack.com',
}Change config.js file to enable and configure clustering:
{
cluster: true,
clusterInstances: 4,
}