From fb42fc54a036dd5389e9c2315d02bb80471e93e2 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Sun, 18 Aug 2019 17:46:55 +0100 Subject: [PATCH 01/33] Handle spammy logs for removed l-a-s options --- lib/config-validate.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/config-validate.js b/lib/config-validate.js index 547e2f6f..f4f7a471 100644 --- a/lib/config-validate.js +++ b/lib/config-validate.js @@ -5,6 +5,8 @@ const configManager = require('./config-manager') const logger = require('./logger') const schema = require('../lamassu-schema.json') +const REMOVED_FIELDS = ['crossRefVerificationActive', 'crossRefVerificationThreshold'] + function allScopes (cryptoScopes, machineScopes) { const scopes = [] cryptoScopes.forEach(c => { @@ -128,6 +130,8 @@ function ensureConstraints (config) { .then(() => { config.every(fieldInstance => { const fieldCode = fieldInstance.fieldLocator.code + if (_.includes(fieldCode, REMOVED_FIELDS)) return + const field = pickField(fieldCode) if (!field) { logger.warn('No such field: %s, %j', fieldCode, fieldInstance.fieldLocator.fieldScope) From 5125601e56f4b2b323233d1b258fa43a3dc8b042 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Sun, 18 Aug 2019 19:46:32 +0100 Subject: [PATCH 02/33] Only block reused address if option is on --- lib/blacklist.js | 2 +- lib/cash-in/cash-in-tx.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/blacklist.js b/lib/blacklist.js index 08d2705e..e66ac3ff 100644 --- a/lib/blacklist.js +++ b/lib/blacklist.js @@ -2,7 +2,7 @@ const db = require('./db') function blocked (address, cryptoCode) { const sql = `select * from blacklist where address = $1 and crypto_code = $2` - return db.oneOrNone(sql, [ + return db.any(sql, [ address, cryptoCode ]) diff --git a/lib/cash-in/cash-in-tx.js b/lib/cash-in/cash-in-tx.js index 5147bba6..0ef93717 100644 --- a/lib/cash-in/cash-in-tx.js +++ b/lib/cash-in/cash-in-tx.js @@ -24,13 +24,13 @@ function post (machineTx, pi) { let blacklisted = false let addressReuse = false - return checkForBlacklisted(updatedTx) - .then(blacklistItem => { - if (blacklistItem && blacklistItem.created_by_operator) { - blacklisted = true - } + return Promise.all([settingsLoader.loadLatest(), checkForBlacklisted(updatedTx)]) + .then(([{ config }, blacklistItems]) => { + const rejectAddressReuseActive = configManager.unscoped(config).rejectAddressReuseActive - if (blacklistItem && !blacklistItem.created_by_operator) { + if (_.some(it => it.created_by_operator === true)(blacklistItems)) { + blacklisted = true + } else if (_.some(it => it.created_by_operator === false)(blacklistItems) && rejectAddressReuseActive) { addressReuse = true } From 6349b9568a0a800a088f289b00ed3d03ea0699ad Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 22 Aug 2019 14:03:38 -0400 Subject: [PATCH 03/33] Update BCH for Nov HF --- lib/blockchain/common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index 23deedf9..a662a08d 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -41,8 +41,8 @@ const BINARIES = { dir: 'litecoin-0.17.1/bin' }, BCH: { - url: 'https://download.bitcoinabc.org/0.19.10/linux/bitcoin-abc-0.19.10-x86_64-linux-gnu.tar.gz', - dir: 'bitcoin-abc-0.19.10/bin', + url: 'https://download.bitcoinabc.org/0.20.0/linux/bitcoin-abc-0.20.0-x86_64-linux-gnu.tar.gz', + dir: 'bitcoin-abc-0.20.0/bin', files: [['bitcoind', 'bitcoincashd'], ['bitcoin-cli', 'bitcoincash-cli']] } } From 3f38444043e2aa61a36819f4d04267931847f73d Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 22 Aug 2019 14:20:59 -0400 Subject: [PATCH 04/33] Change connections to maxconnections Otherwise, bitcoincashd errors out with: `Error reading configuration file: Invalid configuration value connections` --- lib/blockchain/bitcoincash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blockchain/bitcoincash.js b/lib/blockchain/bitcoincash.js index 24772e82..49c1547a 100644 --- a/lib/blockchain/bitcoincash.js +++ b/lib/blockchain/bitcoincash.js @@ -21,7 +21,7 @@ function buildConfig () { rpcpassword=${common.randomPass()} dbcache=500 server=1 -connections=40 +maxconnections=40 keypool=10000 prune=4000 daemon=0 From c67942c3e738eaa53526320f1e64a43c00c4300b Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Mon, 26 Aug 2019 12:04:53 -0400 Subject: [PATCH 05/33] Update zcashd & dashd --- lib/blockchain/common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index a662a08d..0a58fb4d 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -29,11 +29,11 @@ const BINARIES = { dir: 'geth-linux-amd64-1.9.1-b7b2f60f' }, ZEC: { - url: 'https://z.cash/downloads/zcash-2.0.6-linux64.tar.gz', - dir: 'zcash-2.0.6/bin' + url: 'https://z.cash/downloads/zcash-2.0.7-linux64-debian-jessie.tar.gz', + dir: 'zcash-2.0.7/bin' }, DASH: { - url: 'https://github.com/dashpay/dash/releases/download/v0.14.0.2/dashcore-0.14.0.2-x86_64-linux-gnu.tar', + url: 'https://github.com/dashpay/dash/releases/download/v0.14.0.3/dashcore-0.14.0.3-x86_64-linux-gnu.tar.gz', dir: 'dashcore-0.14.0/bin' }, LTC: { From ae063f95839924785b2ba9b2fb4894776599bbce Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 29 Aug 2019 13:19:01 -0400 Subject: [PATCH 06/33] Delete quadrigacx.json --- schemas/quadrigacx.json | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 schemas/quadrigacx.json diff --git a/schemas/quadrigacx.json b/schemas/quadrigacx.json deleted file mode 100644 index f6cb4481..00000000 --- a/schemas/quadrigacx.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "code": "quadrigacx", - "display": "QuadrigaCX", - "fields": [ - { - "code": "clientId", - "display": "Client ID", - "fieldType": "string", - "required": true, - "value": "" - }, - { - "code": "key", - "display": "API key", - "fieldType": "string", - "required": true, - "value": "" - }, - { - "code": "secret", - "display": "API secret", - "fieldType": "password", - "required": true, - "value": "" - } - ] -} From 94d2a0799ee1e682c5a2605eeb36e3bcf0bf64ff Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 29 Aug 2019 13:20:41 -0400 Subject: [PATCH 07/33] Swap Quadriga for Kraken --- test/unit/filter-config-accounts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/filter-config-accounts.js b/test/unit/filter-config-accounts.js index 9c8fb731..d2d46ed4 100644 --- a/test/unit/filter-config-accounts.js +++ b/test/unit/filter-config-accounts.js @@ -8,7 +8,7 @@ const data = { accounts: [ {code: 'mock-ticker', display: 'Mock ticker', class: 'ticker', cryptos: ALL_CRYPTOS}, {code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC']}, - {code: 'quadrigacx', display: 'QuadrigaCX', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'BCH']}, + {code: 'kraken', display: 'Kraken', class: 'exchange', cryptos: ['BTC', 'ZEC', 'ETH', 'LTC', 'BCH', 'DASH']}, {code: 'mock-wallet', display: 'Mock (Caution!)', class: 'wallet', cryptos: ALL_CRYPTOS} ] } From a1901dff50840b35f142dfdc189ef5447c7ee877 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 29 Aug 2019 13:22:04 -0400 Subject: [PATCH 08/33] Delete quadrigacx.js --- lib/plugins/ticker/quadrigacx/quadrigacx.js | 49 --------------------- 1 file changed, 49 deletions(-) delete mode 100644 lib/plugins/ticker/quadrigacx/quadrigacx.js diff --git a/lib/plugins/ticker/quadrigacx/quadrigacx.js b/lib/plugins/ticker/quadrigacx/quadrigacx.js deleted file mode 100644 index 375e635e..00000000 --- a/lib/plugins/ticker/quadrigacx/quadrigacx.js +++ /dev/null @@ -1,49 +0,0 @@ -const axios = require('axios') -const _ = require('lodash/fp') - -const BN = require('../../../bn') -const common = require('../../common/quadrigacx') - -exports.NAME = 'QuadrigaCX' -exports.SUPPORTED_MODULES = ['ticker'] - -function findCurrency (fxRates, fiatCode) { - const rates = _.find(_.matchesProperty('code', fiatCode), fxRates) - if (!rates || !rates.rate) throw new Error(`Unsupported currency: ${fiatCode}`) - return BN(rates.rate.toString()) -} - -exports.ticker = function ticker (account, fiatCode, cryptoCode) { - if (fiatCode === 'USD' && cryptoCode === 'BTC' || fiatCode === 'CAD') { - return getCurrencyRates(fiatCode, cryptoCode) - } - - return axios.get('https://bitpay.com/api/rates') - .then(response => { - const fxRates = response.data - const cadRate = findCurrency(fxRates, 'CAD') - const fxRate = findCurrency(fxRates, fiatCode).div(cadRate) - - return getCurrencyRates('CAD', cryptoCode) - .then(res => ({ - rates: { - ask: res.rates.ask.times(fxRate), - bid: res.rates.bid.times(fxRate) - } - })) - }) -} - -function getCurrencyRates (fiatCode, cryptoCode) { - return Promise.resolve() - .then(() => { - const market = common.buildMarket(fiatCode, cryptoCode) - return common.request(`/ticker?book=${market}`, 'GET') - }) - .then(r => ({ - rates: { - ask: BN(r.ask), - bid: BN(r.bid) - } - })) -} From fe1878129b5b05b1536c78f3711c8cd3b15ad6d5 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 29 Aug 2019 13:22:30 -0400 Subject: [PATCH 09/33] Delete quadrigacx.js --- lib/plugins/exchange/quadrigacx/quadrigacx.js | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 lib/plugins/exchange/quadrigacx/quadrigacx.js diff --git a/lib/plugins/exchange/quadrigacx/quadrigacx.js b/lib/plugins/exchange/quadrigacx/quadrigacx.js deleted file mode 100644 index 8ee62b3b..00000000 --- a/lib/plugins/exchange/quadrigacx/quadrigacx.js +++ /dev/null @@ -1,28 +0,0 @@ -const common = require('../../common/quadrigacx') -const coinUtils = require('../../../coin-utils') - -function buy (account, cryptoAtoms, fiatCode, cryptoCode) { - return trade('buy', account, cryptoAtoms, fiatCode, cryptoCode) -} - -function sell (account, cryptoAtoms, fiatCode, cryptoCode) { - return trade('sell', account, cryptoAtoms, fiatCode, cryptoCode) -} - -function trade (type, account, cryptoAtoms, fiatCode, cryptoCode) { - return Promise.resolve() - .then(() => { - const market = common.buildMarket(fiatCode, cryptoCode) - const options = { - book: market, - amount: coinUtils.toUnit(cryptoAtoms, cryptoCode).toFixed(8) - } - - return common.authRequest(account, '/' + type, options) - }) -} - -module.exports = { - buy, - sell -} From 67f59e33bea7822fa1acd8bc061c95a1f3a2747a Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 29 Aug 2019 13:23:25 -0400 Subject: [PATCH 10/33] Remove Quadriga from NavBar --- lamassu-admin-elm/src/NavBar.elm | 1 - 1 file changed, 1 deletion(-) diff --git a/lamassu-admin-elm/src/NavBar.elm b/lamassu-admin-elm/src/NavBar.elm index 29e7b6d9..a0233995 100644 --- a/lamassu-admin-elm/src/NavBar.elm +++ b/lamassu-admin-elm/src/NavBar.elm @@ -262,7 +262,6 @@ view route invalidGroups = , ( "itBit", AccountRoute "itbit", True ) , ( "Kraken", AccountRoute "kraken", True ) , ( "Mailgun", AccountRoute "mailgun", True ) - , ( "QuadrigaCX", AccountRoute "quadrigacx", True ) , ( "Strike", AccountRoute "strike", True ) , ( "Twilio", AccountRoute "twilio", True ) ] From b4d28d1a9b574a22f0abbbae8b839fc392c93f27 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 29 Aug 2019 13:23:50 -0400 Subject: [PATCH 11/33] Delete quadrigacx.js --- lib/plugins/common/quadrigacx.js | 91 -------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 lib/plugins/common/quadrigacx.js diff --git a/lib/plugins/common/quadrigacx.js b/lib/plugins/common/quadrigacx.js deleted file mode 100644 index 81c5527a..00000000 --- a/lib/plugins/common/quadrigacx.js +++ /dev/null @@ -1,91 +0,0 @@ -const axios = require('axios') -const crypto = require('crypto') -const _ = require('lodash/fp') - -const API_ENDPOINT = 'https://api.quadrigacx.com/v2' - -let counter = -1 -let lastTimestamp = Date.now() - -function pad (num) { - const asString = num.toString(10) - if (num < 10) return '00' + asString - if (num < 100) return '0' + asString - return asString -} - -function generateNonce () { - const timestamp = Date.now() - if (timestamp !== lastTimestamp) counter = -1 - lastTimestamp = timestamp - counter = (counter + 1) % 1000 - return timestamp.toString(10) + pad(counter) -} - -function authRequest (config, path, data) { - if (!config.key || !config.secret || !config.clientId) { - const err = new Error('Must provide key, secret and client ID') - return Promise.reject(err) - } - - data = data || {} - - const nonce = generateNonce() - const msg = [nonce, config.clientId, config.key].join('') - - const signature = crypto - .createHmac('sha256', Buffer.from(config.secret)) - .update(msg) - .digest('hex') - .toLowerCase() - - const signedData = _.merge(data, { - key: config.key, - signature, - nonce - }) - - return request(path, 'POST', signedData) -} - -function buildMarket (fiatCode, cryptoCode) { - if (!_.includes(cryptoCode, ['BTC', 'ETH', 'LTC', 'BCH'])) { - throw new Error(`Unsupported crypto: ${cryptoCode}`) - } - - if (!_.includes(fiatCode, ['USD', 'CAD'])) { - throw new Error(`Unsupported fiat: ${fiatCode}`) - } - - let market = `${cryptoCode.toLowerCase()}_${fiatCode.toLowerCase()}` - - if (fiatCode === 'USD' && cryptoCode !== 'BTC') { - throw new Error(`Unsupported market: ${market}`) - } - - return market -} - -function request (path, method, data) { - const options = { - method, - data, - url: API_ENDPOINT + path, - headers: { - 'User-Agent': 'Mozilla/4.0 (compatible; Lamassu client)', - 'Content-Type': 'application/json; charset=utf-8' - } - } - - return axios(options) - .then(r => { - if (r.data.error) throw new Error(r.data.error.message) - return r.data - }) -} - -module.exports = { - buildMarket, - authRequest, - request -} From b11271f5cc7ba6a90482c0afcec717f6ece94f47 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Wed, 4 Sep 2019 11:55:43 -0400 Subject: [PATCH 12/33] Add Coinbase for ZEC --- lib/admin/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/admin/config.js b/lib/admin/config.js index 45127b8a..5b7d1882 100644 --- a/lib/admin/config.js +++ b/lib/admin/config.js @@ -178,7 +178,7 @@ function fetchData () { {code: 'bitpay', display: 'Bitpay', class: 'ticker', cryptos: ['BTC', 'BCH']}, {code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH']}, {code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH']}, - {code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH']}, + {code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC']}, {code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC']}, {code: 'mock-ticker', display: 'Mock (Caution!)', class: 'ticker', cryptos: ALL_CRYPTOS}, {code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC']}, From 96e0c0198d775f1952b2d7513f92545ae0621898 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Wed, 4 Sep 2019 11:56:08 -0400 Subject: [PATCH 13/33] Add ZEC to coinbase.js --- lib/plugins/ticker/coinbase/coinbase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/ticker/coinbase/coinbase.js b/lib/plugins/ticker/coinbase/coinbase.js index afd4e107..33309be7 100644 --- a/lib/plugins/ticker/coinbase/coinbase.js +++ b/lib/plugins/ticker/coinbase/coinbase.js @@ -28,7 +28,7 @@ function getSellPrice (obj) { function ticker (account, fiatCode, cryptoCode) { return Promise.resolve() .then(() => { - if (!_.includes(cryptoCode, ['BTC', 'ETH', 'LTC', 'BCH'])) { + if (!_.includes(cryptoCode, ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC'])) { throw new Error('Unsupported crypto: ' + cryptoCode) } }) From 8a43d4ee7cb9c9fa23c37e95c454646605059a61 Mon Sep 17 00:00:00 2001 From: Taranto Date: Wed, 4 Sep 2019 16:49:59 +0100 Subject: [PATCH 14/33] Update to new bitpay api version --- lib/plugins/ticker/bitpay/bitpay.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/ticker/bitpay/bitpay.js b/lib/plugins/ticker/bitpay/bitpay.js index 80d2c67b..099ed3be 100644 --- a/lib/plugins/ticker/bitpay/bitpay.js +++ b/lib/plugins/ticker/bitpay/bitpay.js @@ -2,9 +2,9 @@ const axios = require('axios') const BN = require('../../../bn') function ticker (account, fiatCode, cryptoCode) { - return axios.get('https://bitpay.com/api/rates/' + cryptoCode + '/' + fiatCode) + return axios.get('https://bitpay.com/rates/' + cryptoCode + '/' + fiatCode) .then(r => { - const data = r.data + const data = r.data.data const price = BN(data.rate.toString()) return { rates: { From 0eddea751d31cbb09a76c8e6070dd99b49c85880 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Thu, 5 Sep 2019 10:52:48 -0400 Subject: [PATCH 15/33] Add itBit for ETH --- lib/admin/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/admin/config.js b/lib/admin/config.js index 5b7d1882..7ba47827 100644 --- a/lib/admin/config.js +++ b/lib/admin/config.js @@ -179,7 +179,7 @@ function fetchData () { {code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH']}, {code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH']}, {code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC']}, - {code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC']}, + {code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC', 'ETH']}, {code: 'mock-ticker', display: 'Mock (Caution!)', class: 'ticker', cryptos: ALL_CRYPTOS}, {code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC']}, {code: 'no-layer2', display: 'No Layer 2', class: 'layer2', cryptos: ALL_CRYPTOS}, @@ -191,7 +191,7 @@ function fetchData () { {code: 'bitcoincashd', display: 'bitcoincashd', class: 'wallet', cryptos: ['BCH']}, {code: 'bitgo', display: 'BitGo', class: 'wallet', cryptos: ['BTC', 'ZEC', 'LTC', 'BCH', 'DASH']}, {code: 'bitstamp', display: 'Bitstamp', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'BCH']}, - {code: 'itbit', display: 'itBit', class: 'exchange', cryptos: ['BTC']}, + {code: 'itbit', display: 'itBit', class: 'exchange', cryptos: ['BTC', 'ETH']}, {code: 'kraken', display: 'Kraken', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH']}, {code: 'mock-wallet', display: 'Mock (Caution!)', class: 'wallet', cryptos: ALL_CRYPTOS}, {code: 'no-exchange', display: 'No exchange', class: 'exchange', cryptos: ALL_CRYPTOS}, From 2e675f738fc9263cdb9ee124c94c2daeef8e026c Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Wed, 18 Sep 2019 12:59:35 -0400 Subject: [PATCH 16/33] Update BTC, ZEC, BCH, ETH --- lib/blockchain/common.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index 0a58fb4d..d3b97654 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -21,16 +21,16 @@ module.exports = { const BINARIES = { BTC: { - url: 'https://bitcoin.org/bin/bitcoin-core-0.18.0/bitcoin-0.18.0-x86_64-linux-gnu.tar.gz', - dir: 'bitcoin-0.18.0/bin' + url: 'https://bitcoin.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz', + dir: 'bitcoin-0.18.1/bin' }, ETH: { - url: 'https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.1-b7b2f60f.tar.gz', - dir: 'geth-linux-amd64-1.9.1-b7b2f60f' + url: 'https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.3-cfbb969d.tar.gz', + dir: 'geth-linux-amd64-1.9.3-cfbb969d' }, ZEC: { - url: 'https://z.cash/downloads/zcash-2.0.7-linux64-debian-jessie.tar.gz', - dir: 'zcash-2.0.7/bin' + url: 'https://z.cash/downloads/zcash-2.0.7-2-linux64-debian-jessie.tar.gz', + dir: 'zcash-2.0.7-2/bin' }, DASH: { url: 'https://github.com/dashpay/dash/releases/download/v0.14.0.3/dashcore-0.14.0.3-x86_64-linux-gnu.tar.gz', @@ -41,8 +41,8 @@ const BINARIES = { dir: 'litecoin-0.17.1/bin' }, BCH: { - url: 'https://download.bitcoinabc.org/0.20.0/linux/bitcoin-abc-0.20.0-x86_64-linux-gnu.tar.gz', - dir: 'bitcoin-abc-0.20.0/bin', + url: 'https://download.bitcoinabc.org/0.20.2/linux/bitcoin-abc-0.20.2-x86_64-linux-gnu.tar.gz', + dir: 'bitcoin-abc-0.20.2/bin', files: [['bitcoind', 'bitcoincashd'], ['bitcoin-cli', 'bitcoincash-cli']] } } From 1153c6af6abbf34806492a07107b5a07e3cd3b84 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Fri, 20 Sep 2019 12:33:00 +0100 Subject: [PATCH 17/33] Merge cc into dd (#317) * Fix ETH fee fetching (#303) * v7.3.3 (#304) * Throttle clock skew and fetch logs * PR Fixes * Reduce throttle time * Remove old endpoint * Fix standard styles and improve readability * Simplify throttling * Small fixes * Bump version --- lib/routes.js | 41 ++++++++++++++++++++++++++--------------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/lib/routes.js b/lib/routes.js index 9f0b4a74..899c68fd 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -26,10 +26,14 @@ const argv = require('minimist')(process.argv.slice(2)) const CLOCK_SKEW = 60 * 1000 const REQUEST_TTL = 3 * 60 * 1000 +const THROTTLE_LOGS_QUERY = 30 * 1000 +const THROTTLE_CLOCK_SKEW = 60 * 1000 const pids = {} const reboots = {} const restartServicesMap = {} +const canGetLastSeenMap = {} +const canLogClockSkewMap = {} const devMode = argv.dev || options.http @@ -167,13 +171,6 @@ function stateChange (req, res, next) { .catch(next) } -function deviceEvent (req, res, next) { - const pi = plugins(req.settings, req.deviceId) - pi.logEvent(req.body) - .then(() => respond(req, res)) - .catch(next) -} - function verifyUser (req, res, next) { const pi = plugins(req.settings, req.deviceId) pi.verifyUser(req.body) @@ -245,9 +242,19 @@ function updateCustomer (req, res, next) { } function getLastSeen (req, res, next) { - return logs.getLastSeen(req.deviceId) - .then(r => res.json(r)) - .catch(next) + const deviceId = req.deviceId + const timestamp = Date.now() + const shouldTrigger = !canGetLastSeenMap[deviceId] || + timestamp - canGetLastSeenMap[deviceId] >= THROTTLE_LOGS_QUERY + + if (shouldTrigger) { + canGetLastSeenMap[deviceId] = timestamp + return logs.getLastSeen(deviceId) + .then(r => res.json(r)) + .catch(next) + } + + return res.status(408).json({}) } function updateLogs (req, res, next) { @@ -310,9 +317,15 @@ function httpError (msg, code) { function filterOldRequests (req, res, next) { const deviceTime = req.deviceTime - const delta = Date.now() - Date.parse(deviceTime) + const deviceId = req.deviceId + const timestamp = Date.now() + const delta = timestamp - Date.parse(deviceTime) - if (delta > CLOCK_SKEW) { + const shouldTrigger = !canLogClockSkewMap[deviceId] || + timestamp - canLogClockSkewMap[deviceId] >= THROTTLE_CLOCK_SKEW + + if (delta > CLOCK_SKEW && shouldTrigger) { + canLogClockSkewMap[deviceId] = timestamp logger.error('Clock skew with lamassu-machine[%s] too high [%ss], adjust lamassu-machine clock', req.deviceName, (delta / 1000).toFixed(2)) } @@ -337,8 +350,7 @@ function authorize (req, res, next) { .catch(next) } -const skip = (req, res) => _.includes(req.path, ['/poll', '/state', '/logs']) && - res.statusCode === 200 +const skip = (req, res) => _.includes(req.path, ['/poll', '/state', '/logs']) && _.includes(res.statusCode, [200, 408]) const configRequiredRoutes = [ '/poll', @@ -367,7 +379,6 @@ app.use(filterOldRequests) app.get('/poll', poll) app.post('/state', stateChange) -app.post('/event', deviceEvent) app.post('/verify_user', verifyUser) app.post('/verify_transaction', verifyTx) diff --git a/package-lock.json b/package-lock.json index 2a502dab..7d4253ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lamassu-server", - "version": "7.3.2", + "version": "7.3.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c69d00ef..4446dfe0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lamassu-server", "description": "bitcoin atm client server protocol module", "keywords": [], - "version": "7.3.2", + "version": "7.4.0", "license": "Unlicense", "author": "Lamassu (https://lamassu.is)", "dependencies": { From 1fb35d107be1a20fb066144440ed982c824dc2d3 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Fri, 27 Sep 2019 17:59:39 +0100 Subject: [PATCH 18/33] Fix notify operator call --- lib/plugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins.js b/lib/plugins.js index 16c19da3..7f0cb6ae 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -347,7 +347,7 @@ function plugins (settings, deviceId) { if (!transactionNotificationsEnabled()) return Promise.resolve() const isCashOut = tx.direction === 'cashOut' - const zeroConf = isZeroConf(tx) + const zeroConf = isCashOut && isZeroConf(tx) // 0-conf cash-out should only send notification on redemption if (zeroConf && isCashOut && !rec.isRedemption && !rec.error) return Promise.resolve() From 08635ca833462405765870b9cded614a23b6df6c Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Fri, 27 Sep 2019 10:34:50 -0400 Subject: [PATCH 19/33] ZEC node security update --- lib/blockchain/common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index d3b97654..f4c1ef6b 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -29,8 +29,8 @@ const BINARIES = { dir: 'geth-linux-amd64-1.9.3-cfbb969d' }, ZEC: { - url: 'https://z.cash/downloads/zcash-2.0.7-2-linux64-debian-jessie.tar.gz', - dir: 'zcash-2.0.7-2/bin' + url: 'https://z.cash/downloads/zcash-2.0.7-3-linux64-debian-jessie.tar.gz', + dir: 'zcash-2.0.7-3/bin' }, DASH: { url: 'https://github.com/dashpay/dash/releases/download/v0.14.0.3/dashcore-0.14.0.3-x86_64-linux-gnu.tar.gz', From 6b90237eb4182119a4b5b87760ea7731e4b989a8 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Fri, 27 Sep 2019 11:54:46 -0400 Subject: [PATCH 20/33] v7.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4446dfe0..7d781d68 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lamassu-server", "description": "bitcoin atm client server protocol module", "keywords": [], - "version": "7.4.0", + "version": "7.4.1", "license": "Unlicense", "author": "Lamassu (https://lamassu.is)", "dependencies": { From 20f3cf14e9abde6f4478387b71ab414c6f73fc30 Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Fri, 27 Sep 2019 11:55:21 -0400 Subject: [PATCH 21/33] v7.4.1 --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 7d4253ae..56ea18de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lamassu-server", - "version": "7.3.3", + "version": "7.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { From d083ae5a40351ab012bf9ef29cbd463513789dd6 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 1 Oct 2019 11:09:36 +0100 Subject: [PATCH 22/33] perf - Cache settings on router.js --- lib/routes.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/routes.js b/lib/routes.js index 899c68fd..9564eb15 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -28,12 +28,14 @@ const CLOCK_SKEW = 60 * 1000 const REQUEST_TTL = 3 * 60 * 1000 const THROTTLE_LOGS_QUERY = 30 * 1000 const THROTTLE_CLOCK_SKEW = 60 * 1000 +const SETTINGS_CACHE_REFRESH = 60 * 60 * 1000 const pids = {} const reboots = {} const restartServicesMap = {} const canGetLastSeenMap = {} const canLogClockSkewMap = {} +const settingsCache = {} const devMode = argv.dev || options.http @@ -427,6 +429,7 @@ localApp.post('/restartServices', (req, res) => { }) localApp.post('/dbChange', (req, res, next) => { + settingsCache.cache = null return settingsLoader.loadLatest() .then(poller.reload) .then(() => logger.info('Config reloaded')) @@ -463,9 +466,23 @@ function populateSettings (req, res, next) { oldVersionId = versionId } - if (!versionId) { + // Clear cache every hour + if (Date.now() - settingsCache.timestamp > SETTINGS_CACHE_REFRESH) { + settingsCache.cache = null + } + + if (!versionId && settingsCache.cache) { + req.settings = settingsCache.cache + return next() + } + + if (!versionId && !settingsCache.cache) { return settingsLoader.loadLatest() - .then(settings => { req.settings = settings }) + .then(settings => { + settingsCache.cache = settings + settingsCache.timestamp = Date.now() + req.settings = settings + }) .then(() => next()) .catch(next) } From 52ccea0e5ff56b3d26411dbd66133cf59b39ecca Mon Sep 17 00:00:00 2001 From: Neal Conner Date: Mon, 14 Oct 2019 12:24:24 -0400 Subject: [PATCH 23/33] Update Bitstamp to new Bitpay api version --- lib/plugins/ticker/bitstamp/bitstamp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/ticker/bitstamp/bitstamp.js b/lib/plugins/ticker/bitstamp/bitstamp.js index dbb81e5e..1d5ac416 100644 --- a/lib/plugins/ticker/bitstamp/bitstamp.js +++ b/lib/plugins/ticker/bitstamp/bitstamp.js @@ -18,9 +18,9 @@ exports.ticker = function ticker (account, fiatCode, cryptoCode) { return getCurrencyRates(fiatCode, cryptoCode) } - return axios.get('https://bitpay.com/api/rates') + return axios.get('https://bitpay.com/rates') .then(response => { - const fxRates = response.data + const fxRates = response.data.data const usdRate = findCurrency(fxRates, 'USD') const fxRate = findCurrency(fxRates, fiatCode).div(usdRate) From 44769d6e4440fd1ae57dbfafeb31fc3d4f922555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20F=C3=A9lix?= Date: Thu, 17 Oct 2019 15:31:55 +0100 Subject: [PATCH 24/33] fix: add photocard, frontcamera dirs to json conf --- bin/cert-gen.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/cert-gen.sh b/bin/cert-gen.sh index 2be643ae..b64c042f 100755 --- a/bin/cert-gen.sh +++ b/bin/cert-gen.sh @@ -13,6 +13,8 @@ LAMASSU_CA_PATH=$PWD/Lamassu_CA.pem MIGRATE_STATE_PATH=$CONFIG_DIR/.migrate POSTGRES_PASS=postgres123 OFAC_DATA_DIR=$CONFIG_DIR/ofac +IDPHOTOCARD_DIR=$CONFIG_DIR/idphotocard +FRONTCAMERA_DIR=$CONFIG_DIR/frontcamera mkdir -p $CERT_DIR mkdir -p $CONFIG_DIR >> $LOG_FILE 2>&1 @@ -109,7 +111,9 @@ cat < $CONFIG_DIR/lamassu.json "name": "cons_advanced", "url": "https://www.treasury.gov/ofac/downloads/sanctions/1.0/cons_advanced.xml" } - ] + ], + "idPhotoCardDir": "$IDPHOTOCARD_DIR", + "frontCameraDir": "$FRONTCAMERA_DIR" } EOF From 51d4bb1fe5559d47abb016dec6cccdb062644ea2 Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Thu, 31 Oct 2019 07:38:10 -0700 Subject: [PATCH 25/33] v7.4.3 * v7.4.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56ea18de..3d6c3107 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lamassu-server", - "version": "7.4.1", + "version": "7.4.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7d781d68..f19c579d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lamassu-server", "description": "bitcoin atm client server protocol module", "keywords": [], - "version": "7.4.1", + "version": "7.4.3", "license": "Unlicense", "author": "Lamassu (https://lamassu.is)", "dependencies": { From c7dec82f38891550174b381235842705384bdbb3 Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Mon, 11 Nov 2019 13:16:55 -0500 Subject: [PATCH 26/33] Add DASH to Coinbase ticker --- lib/plugins/ticker/coinbase/coinbase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/ticker/coinbase/coinbase.js b/lib/plugins/ticker/coinbase/coinbase.js index 33309be7..772dfcf9 100644 --- a/lib/plugins/ticker/coinbase/coinbase.js +++ b/lib/plugins/ticker/coinbase/coinbase.js @@ -28,7 +28,7 @@ function getSellPrice (obj) { function ticker (account, fiatCode, cryptoCode) { return Promise.resolve() .then(() => { - if (!_.includes(cryptoCode, ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC'])) { + if (!_.includes(cryptoCode, ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC', 'DASH'])) { throw new Error('Unsupported crypto: ' + cryptoCode) } }) From 5ad3a1f86ed03fee86e6f987bad6c46e977e7173 Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Mon, 11 Nov 2019 13:18:03 -0500 Subject: [PATCH 27/33] Add Coinbase ticker to Dash in admin --- lib/admin/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/admin/config.js b/lib/admin/config.js index 7ba47827..9aa47292 100644 --- a/lib/admin/config.js +++ b/lib/admin/config.js @@ -178,7 +178,7 @@ function fetchData () { {code: 'bitpay', display: 'Bitpay', class: 'ticker', cryptos: ['BTC', 'BCH']}, {code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH']}, {code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH']}, - {code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC']}, + {code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC', 'DASH']}, {code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC', 'ETH']}, {code: 'mock-ticker', display: 'Mock (Caution!)', class: 'ticker', cryptos: ALL_CRYPTOS}, {code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC']}, From e77d031fa791fdcacfa4911ced8055af4646dc7b Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Mon, 11 Nov 2019 13:20:06 -0500 Subject: [PATCH 28/33] Update crypto node versions --- lib/blockchain/common.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index f4c1ef6b..fb280921 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -25,12 +25,12 @@ const BINARIES = { dir: 'bitcoin-0.18.1/bin' }, ETH: { - url: 'https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.3-cfbb969d.tar.gz', - dir: 'geth-linux-amd64-1.9.3-cfbb969d' + url: 'https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.7-a718daa6.tar.gz', + dir: 'geth-linux-amd64-1.9.7-a718daa6' }, ZEC: { - url: 'https://z.cash/downloads/zcash-2.0.7-3-linux64-debian-jessie.tar.gz', - dir: 'zcash-2.0.7-3/bin' + url: 'https://z.cash/downloads/zcash-2.1.0-1-linux64-jessie.tar.gz', + dir: 'zcash-2.1.0-1/bin' }, DASH: { url: 'https://github.com/dashpay/dash/releases/download/v0.14.0.3/dashcore-0.14.0.3-x86_64-linux-gnu.tar.gz', @@ -41,8 +41,8 @@ const BINARIES = { dir: 'litecoin-0.17.1/bin' }, BCH: { - url: 'https://download.bitcoinabc.org/0.20.2/linux/bitcoin-abc-0.20.2-x86_64-linux-gnu.tar.gz', - dir: 'bitcoin-abc-0.20.2/bin', + url: 'https://download.bitcoinabc.org/0.20.5/linux/bitcoin-abc-0.20.5-x86_64-linux-gnu.tar.gz', + dir: 'bitcoin-abc-0.20.5/bin', files: [['bitcoind', 'bitcoincashd'], ['bitcoin-cli', 'bitcoincash-cli']] } } From ae39a87244ad0fcf2e98028708943eff964c1d7d Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Tue, 12 Nov 2019 12:57:39 -0500 Subject: [PATCH 29/33] Update Zcash filepath --- lib/blockchain/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index fb280921..6162ec90 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -29,7 +29,7 @@ const BINARIES = { dir: 'geth-linux-amd64-1.9.7-a718daa6' }, ZEC: { - url: 'https://z.cash/downloads/zcash-2.1.0-1-linux64-jessie.tar.gz', + url: 'https://z.cash/downloads/zcash-2.1.0-1-linux64-debian-jessie.tar.gz', dir: 'zcash-2.1.0-1/bin' }, DASH: { From 07f4bdfb669831b24eb27d6b187cc10c04ea963b Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Fri, 15 Nov 2019 10:11:28 -0500 Subject: [PATCH 30/33] Fix ETH sending following miner fee logging --- lib/plugins/wallet/geth/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/wallet/geth/base.js b/lib/plugins/wallet/geth/base.js index b219ea9e..381bf90d 100644 --- a/lib/plugins/wallet/geth/base.js +++ b/lib/plugins/wallet/geth/base.js @@ -54,7 +54,7 @@ function sendCoins (account, toAddress, cryptoAtoms, cryptoCode) { .then(tx => { if (!tx) return { txid } - const fee = BN(tx.gas).multipliedBy(BN(tx.gasPrice)).round() + const fee = BN(tx.gas).mul(BN(tx.gasPrice)).round() return { txid, fee } }) From 0fd0d215991176dc09491cd70c1319a38a3a4918 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Wed, 20 Nov 2019 13:02:06 +0000 Subject: [PATCH 31/33] fix: operator id fetching on scripts --- bin/hkdf | 4 ++-- bin/lamassu-coinatmradar | 4 +--- bin/lamassu-operator | 17 ++++++++++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/hkdf b/bin/hkdf index eb700684..2e3cdb14 100755 --- a/bin/hkdf +++ b/bin/hkdf @@ -13,5 +13,5 @@ if (process.argv.length !== 4) { process.exit(3) } -const masterSeed = new Buffer(masterSeedHex, 'hex') -console.log(hkdf(masterSeed, 32, {salt: 'lamassu-server-salt', info: label}).toString('hex')) +const masterSeed = Buffer.from(masterSeedHex, 'hex') +console.log(hkdf(masterSeed, 32, { salt: 'lamassu-server-salt', info: label }).toString('hex')) diff --git a/bin/lamassu-coinatmradar b/bin/lamassu-coinatmradar index 1f2836fe..5912b71a 100644 --- a/bin/lamassu-coinatmradar +++ b/bin/lamassu-coinatmradar @@ -1,7 +1,5 @@ #!/usr/bin/env bash -SEED="$(cat ~/seeds/seed.txt)" - echo echo "Here is the 'External ID' of your paired machine(s), for use under the 'ATM / Teller details' of your CoinATMRadar listing:" echo @@ -9,5 +7,5 @@ su - postgres -c "psql \"lamassu\" -Atc \"select regexp_replace(device_id, '$', echo echo "If speaking with CoinATMRadar directly, it may be helpful to let them know your 'Operator ID':" echo -$(npm root -g)/lamassu-server/bin/hkdf operator-id "$SEED" | cut -c -32 +$(npm root -g)/lamassu-server/bin/lamassu-operator echo diff --git a/bin/lamassu-operator b/bin/lamassu-operator index b2792cdd..104a1c5e 100644 --- a/bin/lamassu-operator +++ b/bin/lamassu-operator @@ -1,9 +1,12 @@ -#!/usr/bin/env bash +#!/usr/bin/env node -SEED="$(cat ~/seeds/seed.txt)" +const fs = require('fs') +const hkdf = require('futoin-hkdf') -echo -echo "Your Operator ID for use with CoinATMRadar is:" -echo -/usr/bin/hkdf operator-id "$SEED" | cut -c -32 -echo +const options = require('../lib/options') +const mnemonicHelpers = require('../lib/mnemonic-helpers') + +const mnemonic = fs.readFileSync(options.mnemonicPath, 'utf8').trim() +const masterSeed = mnemonicHelpers.toEntropyBuffer(mnemonic) + +console.log(hkdf(masterSeed, 16, { salt: 'lamassu-server-salt', info: 'operator-id' }).toString('hex')) From 05a95485f700f4bece45f1d2a94a1a0c39e6a4ee Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Wed, 20 Nov 2019 17:56:16 +0000 Subject: [PATCH 32/33] fix: pass down settings to coinatmradar module --- lib/poller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/poller.js b/lib/poller.js index 1e13f28c..22b15b27 100644 --- a/lib/poller.js +++ b/lib/poller.js @@ -62,7 +62,7 @@ function updateCoinAtmRadar () { const config = settings().config return pi().getRawRates() - .then(rates => coinAtmRadar.update({ rates, config })) + .then(rates => coinAtmRadar.update({ rates, config }, settings())) } function start (__settings) { From 43a89d82f1c5919a5d49c57e09732f7ac140329a Mon Sep 17 00:00:00 2001 From: naconner <7396812+naconner@users.noreply.github.com> Date: Wed, 27 Nov 2019 11:02:31 -0800 Subject: [PATCH 33/33] v7.4.4 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d6c3107..97093932 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lamassu-server", - "version": "7.4.3", + "version": "7.4.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f19c579d..96e13249 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lamassu-server", "description": "bitcoin atm client server protocol module", "keywords": [], - "version": "7.4.3", + "version": "7.4.4", "license": "Unlicense", "author": "Lamassu (https://lamassu.is)", "dependencies": {