/ keys / index-example.js
index-example.js
  1  /*!
  2   * keys/index-example.js
  3   * Copyright © 2019 – Katana Cryptographic Ltd. All Rights Reserved.
  4   */
  5  
  6  
  7  /**
  8   * Desired structure of /keys/index.js, which is ignored in the repository.
  9   * index.js should store only one of the 2 sets of parameters (mainnet or testnet)
 10   */
 11  export default {
 12      /*
 13     * Mainnet parameters
 14     */
 15      bitcoin: {
 16          /*
 17           * Dojo version
 18           */
 19          dojoVersion: '1.25.0',
 20          /*
 21           * Bitcoind
 22           */
 23          bitcoind: {
 24              // RPC API
 25              rpc: {
 26                  // Login
 27                  user: 'user',
 28                  // Password
 29                  pass: 'password',
 30                  // IP address
 31                  host: '127.0.0.1',
 32                  // TCP port
 33                  port: 8332
 34              },
 35              // ZMQ Tx notifications
 36              zmqTx: 'tcp://127.0.0.1:9501',
 37              // ZMQ Block notifications
 38              zmqBlk: 'tcp://127.0.0.1:9502',
 39              // Fee type (estimatesmartfee)
 40              feeType: 'ECONOMICAL'
 41          },
 42          /*
 43       * MySQL database
 44       */
 45          db: {
 46              // User
 47              user: 'user',
 48              // Password
 49              pass: 'password',
 50              // IP address
 51              host: '127.0.0.1',
 52              // TCP port
 53              port: 3306,
 54              // Db name
 55              database: 'db_name',
 56              // Timeout
 57              acquireTimeout: 15000,
 58              // Max number of concurrent connections
 59              // for each module
 60              connectionLimitApi: 50,
 61              connectionLimitTracker: 10,
 62              connectionLimitPushTxApi: 5,
 63              connectionLimitPushTxOrchestrator: 5
 64          },
 65          /*
 66       * IP address used to expose the API ports
 67       */
 68          apiBind: '127.0.0.1',
 69          /*
 70       * TCP Ports
 71       */
 72          ports: {
 73              // Port used by the API
 74              account: 8080,
 75              // Port used by pushtx API
 76              pushtx: 8081,
 77              // Port used by the tracker API
 78              trackerApi: 8082,
 79              // Port used by the tracker for its notifications
 80              tracker: 5555,
 81              // Port used by pushtx for its notifications
 82              notifpushtx: 5556,
 83              // Port used by the pushtx orchestrator for its notifications
 84              orchestrator: 5557
 85          },
 86          /*
 87       * Authenticated access to the APIs (account & pushtx)
 88       */
 89          auth: {
 90              // Name of the authentication strategy used
 91              // Available values:
 92              //    null          : No authentication
 93              //    'localApiKey' : authentication with a shared local api key
 94              activeStrategy: 'localApiKey',
 95              // Flag indicating if authenticated access is mandatory
 96              // (useful for launch, othewise should be true)
 97              mandatory: false,
 98              // List of available authentication strategies
 99              strategies: {
100                  // Authentication with a shared local api key
101                  localApiKey: {
102                      // List of API keys (alphanumeric characters)
103                      apiKeys: ['<myApiKey>', '<myApiKey2>'],
104                      // Admin key (alphanumeric characters)
105                      adminKey: '<myAdminKey>'
106                  },
107                  auth47: {
108                      hostname: '<dojoHostname>',
109                      paymentCodes: ['<myPaymentCode>']
110                  }
111              },
112              // Configuration of Json Web Tokens
113              // used for the management of authorizations
114              jwt: {
115                  // Secret passphrase used by the server to sign the jwt
116                  // (alphanumeric characters)
117                  secret: '<my_secret>',
118                  accessToken: {
119                      // Number of seconds after which the jwt expires
120                      expires: 600
121                  },
122                  refreshToken: {
123                      // Number of seconds after which the jwt expires
124                      expires: 7200
125                  }
126              }
127          },
128          /*
129       * Prefixes used by the API
130       * for /support and /status endpoints
131       */
132          prefixes: {
133              // Prefix for /support endpoint
134              support: 'support',
135              // Prefix for /status endpoint
136              status: 'status',
137              // Prefix for pushtx /status endpoint
138              statusPushtx: 'status'
139          },
140          /*
141       * Gaps used for derivation of keys
142       */
143          gap: {
144              // Gap for derivation of external addresses
145              external: 20,
146              // Gap for derivation of internal (change) addresses
147              internal: 20
148          },
149          /*
150       * Multiaddr endpoint
151       */
152          multiaddr: {
153              // Number of transactions returned by the endpoint
154              transactions: 50
155          },
156          /*
157       * Indexer or third party service
158       * used for fast scan of addresses
159       */
160          indexer: {
161              // Active indexer
162              // Values: local_bitcoind | local_indexer | third_party_explorer
163              active: 'local_bitcoind',
164              // Local indexer
165              localIndexer: {
166                  // IP address or hostname
167                  host: '127.0.0.1',
168                  // Port
169                  port: 50001,
170                  // Support of batch requests
171                  // Values: active | inactive
172                  batchRequests: 'inactive',
173                  // Protocol for communication (TCP or TLS)
174                  protocol: 'tcp'
175              },
176              // Use a SOCKS5 proxy for all communications with external services
177              // Values: null if no socks5 proxy used, otherwise the url of the socks5 proxy
178              socks5Proxy: null,
179              // OXT
180              oxt: 'https://api.oxt.me'
181          },
182          /*
183       * Explorer recommended by this Dojo
184       */
185          explorer: {
186              // Active explorer
187              // Values: oxt | btc_rpc_explorer
188              active: 'oxt',
189              // URI of the explorer
190              uri: 'https://oxt.me'
191          },
192          /*
193       * Max number of transactions per address
194       * accepted during fast scan
195       */
196          addrFilterThreshold: 1000,
197          /*
198       * Pool of child processes
199       * for parallel derivation of addresses
200       * Be careful with these parameters ;)
201       */
202          addrDerivationPool: {
203              // Min number of child processes always running
204              minNbChildren: 2,
205              // Max number of child processes allowed
206              maxNbChildren: 2,
207              // Max duration
208              acquireTimeoutMillis: 60000,
209              // Parallel derivation threshold
210              // (use parallel derivation if number of addresses to be derived
211              //  is greater than thresholdParalleDerivation)
212              thresholdParallelDerivation: 10
213          },
214          /*
215       * PushTx - Scheduler
216       */
217          txsScheduler: {
218              // Max number of transactions allowed in a single script
219              maxNbEntries: 10,
220              // Max number of blocks allowed in the future
221              maxDeltaHeight: 18
222          },
223          /*
224       * Tracker
225       */
226          tracker: {
227              // Processing of mempool (periodicity in ms)
228              mempoolProcessPeriod: 2000,
229              // Processing of unconfirmed transactions (periodicity in ms)
230              unconfirmedTxsProcessPeriod: 300000
231          }
232      },
233  
234      /*
235     * Testnet parameters
236     */
237      testnet: {
238          dojoVersion: '1.25.0',
239          bitcoind: {
240              rpc: {
241                  user: 'user',
242                  pass: 'password',
243                  host: '127.0.0.1',
244                  port: 18_332
245              },
246              zmqTx: 'tcp://127.0.0.1:19501',
247              zmqBlk: 'tcp://127.0.0.1:19502',
248              feeType: 'ECONOMICAL'
249          },
250          db: {
251              user: 'user',
252              pass: 'password',
253              host: '127.0.0.1',
254              port: 3306,
255              database: 'db_name',
256              acquireTimeout: 15000,
257              connectionLimitApi: 5,
258              connectionLimitTracker: 5,
259              connectionLimitPushTxApi: 1,
260              connectionLimitPushTxOrchestrator: 5
261          },
262          apiBind: '127.0.0.1',
263          ports: {
264              account: 18080,
265              pushtx: 18081,
266              trackerApi: 18082,
267              tracker: 15555,
268              notifpushtx: 15556,
269              orchestrator: 15557
270          },
271          auth: {
272              activeStrategy: null,
273              mandatory: false,
274              strategies: {
275                  localApiKey: {
276                      apiKeys: ['<myApiKey>', '<myApiKey2>'],
277                      adminKey: '<myAdminKey>'
278                  },
279                  auth47: {
280                      hostname: '<dojoHostname>',
281                      paymentCodes: ['<myPaymentCode>']
282                  }
283              },
284              jwt: {
285                  secret: 'myJwtSecret',
286                  accessToken: {
287                      expires: 600
288                  },
289                  refreshToken: {
290                      expires: 7200
291                  }
292              }
293          },
294          prefixes: {
295              support: 'support',
296              status: 'status',
297              statusPushtx: 'status'
298          },
299          gap: {
300              external: 20,
301              internal: 20
302          },
303          multiaddr: {
304              transactions: 50
305          },
306          indexer: {
307              active: 'third_party_explorer',
308              localIndexer: {
309                  host: '127.0.0.1',
310                  port: 50001,
311                  batchRequests: 'inactive',
312                  protocol: 'tcp'
313              },
314              socks5Proxy: null,
315              esplora: 'https://blockstream.info/testnet'
316          },
317          explorer: {
318              active: 'none',
319              uri: ''
320          },
321          addrFilterThreshold: 1000,
322          addrDerivationPool: {
323              minNbChildren: 1,
324              maxNbChildren: 1,
325              acquireTimeoutMillis: 60000,
326              thresholdParallelDerivation: 10
327          },
328          txsScheduler: {
329              maxNbEntries: 10,
330              maxDeltaHeight: 18
331          },
332          tracker: {
333              mempoolProcessPeriod: 2000,
334              unconfirmedTxsProcessPeriod: 300000
335          }
336      }
337  }