UNPKG

3.67 kBMarkdownView Raw
1The following document is a step-by-step guide to run wallet-service.
2
3### Prerequisites
4Ensure MongoDB (2.6+) is installed and running. This document assumes that mongod is running at the default port 27017.
5See the configuration section to configure a different host/port.
6
7### Install Wallet Service from NPM
8Use 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.
9```bash
10npm install @owstack/wallet-service
11cd wallet-service
12```
13
14### Install wallet-service from github source
15Use the following steps to Install wallet-service from github source and run it with defaults. To change configuration before running, see the Configuration section.
16```bash
17git clone https://github.com/owstack/wallet-service.git
18cd wallet-service
19npm install
20```
21
22### Start the wallet-service
23Start all services for all supported coin networks.
24```bash
25npm start all
26```
27Start services for a specific coin network.
28```bash
29npm start [ btc | bch | ltc ]
30```
31
32### Run tests
33Use the following to run tests
34```bash
35npm test
36```
37Use the following to run coverage during testing
38```bash
39npm run coverage
40```
41or
42```bash
43make
44```
45
46### Configuration
47Configuration for all required modules can be specified in https://github.com/owstack/wallet-service/blob/master/base-service/config.js
48
49The wallet-service is composed of the following separate node services:
50
51One global instance of each:
52* Fiat Rate Service - base-service/fiatrateservice/fiatrateservice.js
53* Locker - base-service/locker/locker.js
54* Message Broker - base-service/messagebroker/messagebroker.js
55* Wallet Service - base-service/ws.js
56
57One instance of each per coin network:
58* Blockchain Monitor - service-template/bcmonitor/bcmonitor.js (This service talks to the Blockchain Explorer service configured under blockchainExplorerOpts - see Configure blockchain service below.)
59* Email Service - service-template/emailservice/emailservice.js
60* Push Notifications Service - service-template/pushnotificationsservice/pushnotificationsservice.js
61
62#### Configure MongoDB
63Example configuration for connecting to the MongoDB instance:
64```javascript
65 storageOpts: {
66 mongoDb: {
67 uri: 'mongodb://localhost:27017/ws',
68 },
69 }
70```
71
72#### Configure Locker service
73Example configuration for connecting to locker service:
74```javascript
75 lockOpts: {
76 lockerServer: {
77 host: 'localhost',
78 port: 3231,
79 },
80 }
81```
82
83#### Configure Message Broker service
84Example configuration for connecting to message broker service:
85```javascript
86 messageBrokerOpts: {
87 messageBrokerServer: {
88 url: 'http://localhost:3380',
89 },
90 }
91```
92
93#### Configure blockchain service
94Note: this service will be used by blockchain monitor service as well as by wallet-service itself.
95An example of this configuration is:
96```javascript
97 blockchainExplorerOpts: {
98 defaultProvider: 'explorer',
99
100 // Providers
101 'explorer': {
102 'livenet': {
103 url: 'https://explorer.openwalletstack.com:443',
104 apiPrefix: '/explorer-api'
105 },
106 'testnet': {
107 url: 'https://test-explorer.openwalletstack.com:443',
108 apiPrefix: '/explorer-api'
109 }
110 }
111 }
112```
113
114#### Configure Email service
115Example configuration for connecting to email service (using postfix):
116```javascript
117 emailOpts: {
118 host: 'localhost',
119 port: 25,
120 ignoreTLS: true,
121 subjectPrefix: '[Wallet Service]',
122 from: 'wallet-service@openwalletstack.com',
123 }
124```
125
126#### Enable clustering
127Change `config.js` file to enable and configure clustering:
128```javascript
129{
130 cluster: true,
131 clusterInstances: 4,
132}
133```