From 6341839de4a697b3bf69bb9b4ffc71726acf026c Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 26 Jul 2022 12:26:44 +0200 Subject: [PATCH 1/8] [Node page] Add link to node list per country/isp in node page --- backend/src/api/explorer/nodes.api.ts | 3 ++- .../app/lightning/node/node.component.html | 20 ++++++++++++++++--- .../src/app/lightning/node/node.component.ts | 2 ++ frontend/src/app/shared/graphs.utils.ts | 3 +++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/backend/src/api/explorer/nodes.api.ts b/backend/src/api/explorer/nodes.api.ts index ec8ee35fb..9899e20fc 100644 --- a/backend/src/api/explorer/nodes.api.ts +++ b/backend/src/api/explorer/nodes.api.ts @@ -5,7 +5,7 @@ class NodesApi { public async $getNode(public_key: string): Promise { try { const query = ` - SELECT nodes.*, geo_names_as.names as as_organization, geo_names_city.names as city, + SELECT nodes.*, geo_names_iso.names as iso_code, geo_names_as.names as as_organization, geo_names_city.names as city, geo_names_country.names as country, geo_names_subdivision.names as subdivision, (SELECT Count(*) FROM channels @@ -24,6 +24,7 @@ class NodesApi { LEFT JOIN geo_names geo_names_city on geo_names_city.id = city_id LEFT JOIN geo_names geo_names_subdivision on geo_names_subdivision.id = subdivision_id LEFT JOIN geo_names geo_names_country on geo_names_country.id = country_id + LEFT JOIN geo_names geo_names_iso ON geo_names_iso.id = nodes.country_id AND geo_names_iso.type = 'country_iso_code' WHERE public_key = ? `; const [rows]: any = await DB.query(query, [public_key, public_key, public_key, public_key, public_key, public_key, public_key, public_key, public_key]); diff --git a/frontend/src/app/lightning/node/node.component.html b/frontend/src/app/lightning/node/node.component.html index e2132bca5..774f0aaab 100644 --- a/frontend/src/app/lightning/node/node.component.html +++ b/frontend/src/app/lightning/node/node.component.html @@ -43,11 +43,23 @@ Location - {{ node.city.en }}, {{ node.subdivision.en }}
{{ node.country.en }} + + {{ node.city.en }}, {{ node.subdivision.en }} +
+ + {{ node.country.en }} +   + {{ node.flag }} + + Location - {{ node.country.en }} + + + {{ node.country.en }} {{ node.flag }} + + @@ -77,7 +89,9 @@ ISP - {{ node.as_organization }} [ASN {{node.as_number}}] + + {{ node.as_organization }} [ASN {{node.as_number}}] + diff --git a/frontend/src/app/lightning/node/node.component.ts b/frontend/src/app/lightning/node/node.component.ts index c70983b54..c9971a4cb 100644 --- a/frontend/src/app/lightning/node/node.component.ts +++ b/frontend/src/app/lightning/node/node.component.ts @@ -3,6 +3,7 @@ import { ActivatedRoute, ParamMap } from '@angular/router'; import { Observable } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs/operators'; import { SeoService } from 'src/app/services/seo.service'; +import { getFlagEmoji } from 'src/app/shared/graphs.utils'; import { LightningApiService } from '../lightning-api.service'; @Component({ @@ -51,6 +52,7 @@ export class NodeComponent implements OnInit { } else if (socket.indexOf('onion') > -1) { label = 'Tor'; } + node.flag = getFlagEmoji(node.iso_code); socketsObject.push({ label: label, socket: node.public_key + '@' + socket, diff --git a/frontend/src/app/shared/graphs.utils.ts b/frontend/src/app/shared/graphs.utils.ts index 6909e6fac..019ca49e4 100644 --- a/frontend/src/app/shared/graphs.utils.ts +++ b/frontend/src/app/shared/graphs.utils.ts @@ -92,6 +92,9 @@ export function detectWebGL() { } export function getFlagEmoji(countryCode) { + if (!countryCode) { + return ''; + } const codePoints = countryCode .toUpperCase() .split('') From 2acaa45e0a35a9602a182878509967cb988e1e46 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 26 Jul 2022 14:10:09 +0200 Subject: [PATCH 2/8] Remove node chart 1mb line and fix y axis --- .../node-statistics-chart.component.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts b/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts index 15997d3c3..962059c9d 100644 --- a/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts +++ b/frontend/src/app/lightning/node-statistics-chart/node-statistics-chart.component.ts @@ -169,9 +169,6 @@ export class NodeStatisticsChartComponent implements OnInit { }, yAxis: data.channels.length === 0 ? undefined : [ { - min: (value) => { - return value.min * 0.9; - }, type: 'value', axisLabel: { color: 'rgb(110, 112, 121)', @@ -188,9 +185,6 @@ export class NodeStatisticsChartComponent implements OnInit { }, }, { - min: (value) => { - return value.min * 0.9; - }, type: 'value', position: 'right', axisLabel: { @@ -225,15 +219,6 @@ export class NodeStatisticsChartComponent implements OnInit { opacity: 1, width: 1, }, - data: [{ - yAxis: 1, - label: { - position: 'end', - show: true, - color: '#ffffff', - formatter: `1 MB` - } - }], } }, { From b69a7a50317ffe0153a99933bdd98b758d2f9c7d Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 26 Jul 2022 15:18:42 +0200 Subject: [PATCH 3/8] Show 3y charts by default on dashboard to get more interesting charts --- .../nodes-networks-chart/nodes-networks-chart.component.ts | 2 +- .../statistics-chart/lightning-statistics-chart.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts b/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts index 735d4868f..c292d09f7 100644 --- a/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts +++ b/frontend/src/app/lightning/nodes-networks-chart/nodes-networks-chart.component.ts @@ -59,7 +59,7 @@ export class NodesNetworksChartComponent implements OnInit { let firstRun = true; if (this.widget) { - this.miningWindowPreference = '1y'; + this.miningWindowPreference = '3y'; } else { this.seoService.setTitle($localize`Lightning nodes per network`); this.miningWindowPreference = this.miningService.getDefaultTimespan('all'); diff --git a/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts b/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts index d95205542..1727d1f68 100644 --- a/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts +++ b/frontend/src/app/lightning/statistics-chart/lightning-statistics-chart.component.ts @@ -58,7 +58,7 @@ export class LightningStatisticsChartComponent implements OnInit { let firstRun = true; if (this.widget) { - this.miningWindowPreference = '1y'; + this.miningWindowPreference = '3y'; } else { this.seoService.setTitle($localize`Channels and Capacity`); this.miningWindowPreference = this.miningService.getDefaultTimespan('all'); From 3ba37aaa5a43466c16c68f1bde57acf635fa6869 Mon Sep 17 00:00:00 2001 From: Antoni Spaanderman <56turtle56@gmail.com> Date: Tue, 26 Jul 2022 16:29:42 +0200 Subject: [PATCH 4/8] Address @Xekyo's comments on https://github.com/mempool/mempool/pull/2167 + minor fixes, variable name consistency and ts types --- frontend/src/app/bitcoin.utils.ts | 68 ++++++++++--------- .../tx-features/tx-features.component.html | 10 +-- .../tx-features/tx-features.component.ts | 6 +- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/frontend/src/app/bitcoin.utils.ts b/frontend/src/app/bitcoin.utils.ts index b2ea1d7a9..25432565c 100644 --- a/frontend/src/app/bitcoin.utils.ts +++ b/frontend/src/app/bitcoin.utils.ts @@ -5,9 +5,9 @@ const P2SH_P2WSH_COST = 35 * 4; // the WU cost for the non-witness part of P2SH export function calcSegwitFeeGains(tx: Transaction) { // calculated in weight units - let realizedBech32Gains = 0; - let potentialBech32Gains = 0; - let potentialP2shGains = 0; + let realizedSegwitGains = 0; + let potentialSegwitGains = 0; + let potentialP2shSegwitGains = 0; let potentialTaprootGains = 0; let realizedTaprootGains = 0; @@ -24,31 +24,33 @@ export function calcSegwitFeeGains(tx: Transaction) { const isP2tr = vin.prevout.scriptpubkey_type === 'v1_p2tr'; const op = vin.scriptsig ? vin.scriptsig_asm.split(' ')[0] : null; - const isP2sh2Wpkh = isP2sh && !!vin.witness && op === 'OP_PUSHBYTES_22'; - const isP2sh2Wsh = isP2sh && !!vin.witness && op === 'OP_PUSHBYTES_34'; + const isP2shP2Wpkh = isP2sh && !!vin.witness && op === 'OP_PUSHBYTES_22'; + const isP2shP2Wsh = isP2sh && !!vin.witness && op === 'OP_PUSHBYTES_34'; switch (true) { - // Native Segwit - P2WPKH/P2WSH (Bech32) + // Native Segwit - P2WPKH/P2WSH/P2TR case isP2wpkh: case isP2wsh: case isP2tr: // maximal gains: the scriptSig is moved entirely to the witness part - realizedBech32Gains += witnessSize(vin) * 3; + // if taproot is used savings are 42 WU higher because it produces smaller signatures and doesn't require a pubkey in the witness + // this number is explained above `realizedTaprootGains += 42;` + realizedSegwitGains += (witnessSize(vin) + (isP2tr ? 42 : 0)) * 3; // XXX P2WSH output creation is more expensive, should we take this into consideration? break; // Backward compatible Segwit - P2SH-P2WPKH - case isP2sh2Wpkh: - // the scriptSig is moved to the witness, but we have extra 21 extra non-witness bytes (48 WU) - realizedBech32Gains += witnessSize(vin) * 3 - P2SH_P2WPKH_COST; - potentialBech32Gains += P2SH_P2WPKH_COST; + case isP2shP2Wpkh: + // the scriptSig is moved to the witness, but we have extra 21 extra non-witness bytes (84 WU) + realizedSegwitGains += witnessSize(vin) * 3 - P2SH_P2WPKH_COST; + potentialSegwitGains += P2SH_P2WPKH_COST; break; // Backward compatible Segwit - P2SH-P2WSH - case isP2sh2Wsh: - // the scriptSig is moved to the witness, but we have extra 35 extra non-witness bytes - realizedBech32Gains += witnessSize(vin) * 3 - P2SH_P2WSH_COST; - potentialBech32Gains += P2SH_P2WSH_COST; + case isP2shP2Wsh: + // the scriptSig is moved to the witness, but we have extra 35 extra non-witness bytes (140 WU) + realizedSegwitGains += witnessSize(vin) * 3 - P2SH_P2WSH_COST; + potentialSegwitGains += P2SH_P2WSH_COST; break; // Non-segwit P2PKH/P2SH/P2PK/bare multisig @@ -56,9 +58,13 @@ export function calcSegwitFeeGains(tx: Transaction) { case isP2sh: case isP2pk: case isBareMultisig: { - const fullGains = scriptSigSize(vin) * 3; - potentialBech32Gains += fullGains; - potentialP2shGains += fullGains - (isP2pkh ? P2SH_P2WPKH_COST : P2SH_P2WSH_COST); + let fullGains = scriptSigSize(vin) * 3; + if (isBareMultisig) { + // a _bare_ multisig has the keys in the output script, but P2SH and P2WSH require them to be in the scriptSig/scriptWitness + fullGains -= vin.prevout.scriptpubkey.length / 2; + } + potentialSegwitGains += fullGains; + potentialP2shSegwitGains += fullGains - (isP2pkh ? P2SH_P2WPKH_COST : P2SH_P2WSH_COST); break; } } @@ -79,11 +85,11 @@ export function calcSegwitFeeGains(tx: Transaction) { // TODO maybe add some complex scripts that are specified somewhere, so that size is known, such as lightning scripts } } else { - const script = isP2sh2Wsh || isP2wsh ? vin.inner_witnessscript_asm : vin.inner_redeemscript_asm; + const script = isP2shP2Wsh || isP2wsh ? vin.inner_witnessscript_asm : vin.inner_redeemscript_asm; let replacementSize: number; if ( // single sig - isP2pk || isP2pkh || isP2wpkh || isP2sh2Wpkh || + isP2pk || isP2pkh || isP2wpkh || isP2shP2Wpkh || // multisig isBareMultisig || parseMultisigScript(script) ) { @@ -105,11 +111,11 @@ export function calcSegwitFeeGains(tx: Transaction) { // returned as percentage of the total tx weight return { - realizedBech32Gains: realizedBech32Gains / (tx.weight + realizedBech32Gains), // percent of the pre-segwit tx size - potentialBech32Gains: potentialBech32Gains / tx.weight, - potentialP2shGains: potentialP2shGains / tx.weight, + realizedSegwitGains: realizedSegwitGains / (tx.weight + realizedSegwitGains), // percent of the pre-segwit tx size + potentialSegwitGains: potentialSegwitGains / tx.weight, + potentialP2shSegwitGains: potentialP2shSegwitGains / tx.weight, potentialTaprootGains: potentialTaprootGains / tx.weight, - realizedTaprootGains: realizedTaprootGains / tx.weight + realizedTaprootGains: realizedTaprootGains / (tx.weight + realizedTaprootGains) }; } @@ -188,12 +194,12 @@ export function moveDec(num: number, n: number) { return neg + (int || '0') + (frac.length ? '.' + frac : ''); } -function zeros(n) { +function zeros(n: number) { return new Array(n + 1).join('0'); } // Formats a number for display. Treats the number as a string to avoid rounding errors. -export const formatNumber = (s, precision = null) => { +export const formatNumber = (s: number | string, precision: number | null = null) => { let [ whole, dec ] = s.toString().split('.'); // divide numbers into groups of three separated with a thin space (U+202F, "NARROW NO-BREAK SPACE"), @@ -219,27 +225,27 @@ const witnessSize = (vin: Vin) => vin.witness ? vin.witness.reduce((S, w) => S + const scriptSigSize = (vin: Vin) => vin.scriptsig ? vin.scriptsig.length / 2 : 0; // Power of ten wrapper -export function selectPowerOfTen(val: number) { +export function selectPowerOfTen(val: number): { divider: number, unit: string } { const powerOfTen = { exa: Math.pow(10, 18), peta: Math.pow(10, 15), - terra: Math.pow(10, 12), + tera: Math.pow(10, 12), giga: Math.pow(10, 9), mega: Math.pow(10, 6), kilo: Math.pow(10, 3), }; - let selectedPowerOfTen; + let selectedPowerOfTen: { divider: number, unit: string }; if (val < powerOfTen.kilo) { selectedPowerOfTen = { divider: 1, unit: '' }; // no scaling } else if (val < powerOfTen.mega) { selectedPowerOfTen = { divider: powerOfTen.kilo, unit: 'k' }; } else if (val < powerOfTen.giga) { selectedPowerOfTen = { divider: powerOfTen.mega, unit: 'M' }; - } else if (val < powerOfTen.terra) { + } else if (val < powerOfTen.tera) { selectedPowerOfTen = { divider: powerOfTen.giga, unit: 'G' }; } else if (val < powerOfTen.peta) { - selectedPowerOfTen = { divider: powerOfTen.terra, unit: 'T' }; + selectedPowerOfTen = { divider: powerOfTen.tera, unit: 'T' }; } else if (val < powerOfTen.exa) { selectedPowerOfTen = { divider: powerOfTen.peta, unit: 'P' }; } else { diff --git a/frontend/src/app/components/tx-features/tx-features.component.html b/frontend/src/app/components/tx-features/tx-features.component.html index 16dbb66f4..e3569de8d 100644 --- a/frontend/src/app/components/tx-features/tx-features.component.html +++ b/frontend/src/app/components/tx-features/tx-features.component.html @@ -1,12 +1,12 @@ -SegWit +SegWit - SegWit - - SegWit + SegWit + + SegWit -Taproot +Taproot Taproot diff --git a/frontend/src/app/components/tx-features/tx-features.component.ts b/frontend/src/app/components/tx-features/tx-features.component.ts index f73d8ae8a..4c0611971 100644 --- a/frontend/src/app/components/tx-features/tx-features.component.ts +++ b/frontend/src/app/components/tx-features/tx-features.component.ts @@ -12,9 +12,9 @@ export class TxFeaturesComponent implements OnChanges { @Input() tx: Transaction; segwitGains = { - realizedBech32Gains: 0, - potentialBech32Gains: 0, - potentialP2shGains: 0, + realizedSegwitGains: 0, + potentialSegwitGains: 0, + potentialP2shSegwitGains: 0, potentialTaprootGains: 0, realizedTaprootGains: 0 }; From 68f288f69c9a32c8e859dfa6a443c0ff4826bc32 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 26 Jul 2022 17:32:43 +0200 Subject: [PATCH 5/8] Order lightning_stats by added timestamp instead of id --- backend/src/api/explorer/statistics.api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/api/explorer/statistics.api.ts b/backend/src/api/explorer/statistics.api.ts index d29bf1ed4..c2e23848f 100644 --- a/backend/src/api/explorer/statistics.api.ts +++ b/backend/src/api/explorer/statistics.api.ts @@ -13,7 +13,7 @@ class StatisticsApi { query += ` WHERE added BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW()`; } - query += ` ORDER BY id DESC`; + query += ` ORDER BY added DESC`; try { const [rows]: any = await DB.query(query); @@ -26,8 +26,8 @@ class StatisticsApi { public async $getLatestStatistics(): Promise { try { - const [rows]: any = await DB.query(`SELECT * FROM lightning_stats ORDER BY id DESC LIMIT 1`); - const [rows2]: any = await DB.query(`SELECT * FROM lightning_stats ORDER BY id DESC LIMIT 1 OFFSET 7`); + const [rows]: any = await DB.query(`SELECT * FROM lightning_stats ORDER BY added DESC LIMIT 1`); + const [rows2]: any = await DB.query(`SELECT * FROM lightning_stats ORDER BY added DESC LIMIT 1 OFFSET 7`); return { latest: rows[0], previous: rows2[0], From d8b3c21a6c9b69c0e86a83f028e99efcaaba51b6 Mon Sep 17 00:00:00 2001 From: softsimon Date: Tue, 26 Jul 2022 21:35:19 +0200 Subject: [PATCH 6/8] Fix for mempool logo not being centered vertically --- .../src/app/components/master-page/master-page.component.html | 2 +- .../src/app/components/master-page/master-page.component.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/master-page/master-page.component.html b/frontend/src/app/components/master-page/master-page.component.html index 1458e762b..f152cb7b3 100644 --- a/frontend/src/app/components/master-page/master-page.component.html +++ b/frontend/src/app/components/master-page/master-page.component.html @@ -8,7 +8,7 @@ - +
Offline
diff --git a/frontend/src/app/components/master-page/master-page.component.scss b/frontend/src/app/components/master-page/master-page.component.scss index 0f7e56828..c6a9aaeff 100644 --- a/frontend/src/app/components/master-page/master-page.component.scss +++ b/frontend/src/app/components/master-page/master-page.component.scss @@ -164,7 +164,7 @@ nav { display: flex; } -app-svg-images { +.mempool-logo, app-svg-images { align-self: center; width: 140px; height: 35px; From 412a0ee57756812de9a6615f0cb8e6cf8a040eb2 Mon Sep 17 00:00:00 2001 From: Stephan Oeste Date: Tue, 26 Jul 2022 22:07:46 +0200 Subject: [PATCH 7/8] Add random generated mysql passwords on prod install --- production/install | 43 +++++++++++++++++--- production/mempool-build-all | 15 +++++++ production/mempool-config.bisq.json | 4 +- production/mempool-config.liquid.json | 4 +- production/mempool-config.liquidtestnet.json | 4 +- production/mempool-config.mainnet.json | 4 +- production/mempool-config.signet.json | 4 +- production/mempool-config.testnet.json | 4 +- 8 files changed, 64 insertions(+), 18 deletions(-) diff --git a/production/install b/production/install index fb3aa9281..e9b24bafa 100755 --- a/production/install +++ b/production/install @@ -218,6 +218,21 @@ MYSQL_HOME=/mysql MYSQL_USER=mysql MYSQL_GROUP=mysql +# mempool mysql user/password +MEMPOOL_MAINNET_USER='mempool' +MEMPOOL_TESTNET_USER='mempool_testnet' +MEMPOOL_SIGNET_USER='mempool_signet' +MEMPOOL_LIQUID_USER='mempool_liquid' +MEMPOOL_LIQUIDTESTNET_USER='mempool_liquidtestnet' +MEMPOOL_BISQ_USER='mempool_bisq' +# generate random hex string +MEMPOOL_MAINNET_PASS=$(head -150 /dev/urandom | ${MD5} | awk '{print $1}') +MEMPOOL_TESTNET_PASS=$(head -150 /dev/urandom | ${MD5} | awk '{print $1}') +MEMPOOL_SIGNET_PASS=$(head -150 /dev/urandom | ${MD5} | awk '{print $1}') +MEMPOOL_LIQUID_PASS=$(head -150 /dev/urandom | ${MD5} | awk '{print $1}') +MEMPOOL_LIQUIDTESTNET_PASS=$(head -150 /dev/urandom | ${MD5} | awk '{print $1}') +MEMPOOL_BISQ_PASS=$(head -150 /dev/urandom | ${MD5} | awk '{print $1}') + # mempool data folder and user/group MEMPOOL_HOME=/mempool MEMPOOL_USER=mempool @@ -1513,22 +1528,38 @@ esac mysql << _EOF_ create database mempool; -grant all on mempool.* to 'mempool'@'localhost' identified by 'mempool'; +grant all on mempool.* to '${MEMPOOL_MAINNET_USER}'@'localhost' identified by '${MEMPOOL_MAINNET_PASS}'; create database mempool_testnet; -grant all on mempool_testnet.* to 'mempool_testnet'@'localhost' identified by 'mempool_testnet'; +grant all on mempool_testnet.* to '${MEMPOOL_TESTNET_USER}'@'localhost' identified by '${MEMPOOL_TESTNET_PASS}'; create database mempool_signet; -grant all on mempool_signet.* to 'mempool_signet'@'localhost' identified by 'mempool_signet'; +grant all on mempool_signet.* to '${MEMPOOL_SIGNET_USER}'@'localhost' identified by '${MEMPOOL_SIGNET_PASS}'; create database mempool_liquid; -grant all on mempool_liquid.* to 'mempool_liquid'@'localhost' identified by 'mempool_liquid'; +grant all on mempool_liquid.* to '${MEMPOOL_LIQUID_USER}'@'localhost' identified by '${MEMPOOL_LIQUID_PASS}'; create database mempool_liquidtestnet; -grant all on mempool_liquidtestnet.* to 'mempool_liquidtestnet'@'localhost' identified by 'mempool_liquidtestnet'; +grant all on mempool_liquidtestnet.* to '${MEMPOOL_LIQUIDTESTNET_USER}'@'localhost' identified by '${MEMPOOL_LIQUIDTESTNET_PASS}'; create database mempool_bisq; -grant all on mempool_bisq.* to 'mempool_bisq'@'localhost' identified by 'mempool_bisq'; +grant all on mempool_bisq.* to '${MEMPOOL_BISQ_USER}'@'localhost' identified by '${MEMPOOL_BISQ_PASS}'; +_EOF_ + +echo "[*] save MySQL credentials" +cat > ${MEMPOOL_HOME}/mysql_credentials << _EOF_ +declare -x MEMPOOL_MAINNET_USER="${MEMPOOL_MAINNET_USER}" +declare -x MEMPOOL_MAINNET_PASS="${MEMPOOL_MAINNET_PASS}" +declare -x MEMPOOL_TESTNET_USER="${MEMPOOL_TESTNET_USER}" +declare -x MEMPOOL_TESTNET_PASS="${MEMPOOL_TESTNET_PASS}" +declare -x MEMPOOL_SIGNET_USER="${MEMPOOL_SIGNET_USER}" +declare -x MEMPOOL_SIGNET_PASS="${MEMPOOL_SIGNET_PASS}" +declare -x MEMPOOL_LIQUID_USER="${MEMPOOL_LIQUID_USER}" +declare -x MEMPOOL_LIQUID_PASS="${MEMPOOL_LIQUID_PASS}" +declare -x MEMPOOL_LIQUIDTESTNET_USER="${MEMPOOL_LIQUIDTESTNET_USER}" +declare -x MEMPOOL_LIQUIDTESTNET_PASS="${MEMPOOL_LIQUIDTESTNET_PASS}" +declare -x MEMPOOL_BISQ_USER="${MEMPOOL_BISQ_USER}" +declare -x MEMPOOL_BISQ_PASS="${MEMPOOL_BISQ_PASS}" _EOF_ ##### nginx diff --git a/production/mempool-build-all b/production/mempool-build-all index 5ac25f7e4..c0e9a2c2a 100755 --- a/production/mempool-build-all +++ b/production/mempool-build-all @@ -11,6 +11,9 @@ BITCOIN_RPC_PASS=$(grep '^rpcpassword' /bitcoin/bitcoin.conf | cut -d '=' -f2) ELEMENTS_RPC_USER=$(grep '^rpcuser' /elements/elements.conf | cut -d '=' -f2) ELEMENTS_RPC_PASS=$(grep '^rpcpassword' /elements/elements.conf | cut -d '=' -f2) +# get mysql credentials +. /mempool/mysql_credentials + if [ -f "${LOCKFILE}" ];then echo "upgrade already running? check lockfile ${LOCKFILE}" exit 1 @@ -73,6 +76,18 @@ build_backend() -e "s!__BITCOIN_RPC_PASS__!${BITCOIN_RPC_PASS}!" \ -e "s!__ELEMENTS_RPC_USER__!${ELEMENTS_RPC_USER}!" \ -e "s!__ELEMENTS_RPC_PASS__!${ELEMENTS_RPC_PASS}!" \ + -e "s!__MEMPOOL_MAINNET_USER__!${MEMPOOL_MAINNET_USER}!" \ + -e "s!__MEMPOOL_MAINNET_PASS__!${MEMPOOL_MAINNET_PASS}!" \ + -e "s!__MEMPOOL_TESTNET_USER__!${MEMPOOL_TESTNET_USER}!" \ + -e "s!__MEMPOOL_TESTNET_PASS__!${MEMPOOL_TESTNET_PASS}!" \ + -e "s!__MEMPOOL_SIGNET_USER__!${MEMPOOL_SIGNET_USER}!" \ + -e "s!__MEMPOOL_SIGNET_PASS__!${MEMPOOL_SIGNET_PASS}!" \ + -e "s!__MEMPOOL_LIQUID_USER__!${MEMPOOL_LIQUID_USER}!" \ + -e "s!__MEMPOOL_LIQUID_PASS__!${MEMPOOL_LIQUID_PASS}!" \ + -e "s!__MEMPOOL_LIQUIDTESTNET_USER__!${LIQUIDTESTNET_USER}!" \ + -e "s!__MEMPOOL_LIQUIDTESTNET_PASS__!${MEMPOOL_LIQUIDTESTNET_PASS}!" \ + -e "s!__MEMPOOL_BISQ_USER__!${MEMPOOL_BISQ_USER}!" \ + -e "s!__MEMPOOL_BISQ_PASS__!${MEMPOOL_BISQ_PASS}!" \ "mempool-config.json" fi npm install --omit=dev --omit=optional || exit 1 diff --git a/production/mempool-config.bisq.json b/production/mempool-config.bisq.json index 1e91be930..599711764 100644 --- a/production/mempool-config.bisq.json +++ b/production/mempool-config.bisq.json @@ -21,8 +21,8 @@ "ENABLED": false, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "mempool_bisq", - "PASSWORD": "mempool_bisq", + "USERNAME": "__MEMPOOL_BISQ_USER__", + "PASSWORD": "__MEMPOOL_BISQ_PASS__", "DATABASE": "mempool_bisq" }, "STATISTICS": { diff --git a/production/mempool-config.liquid.json b/production/mempool-config.liquid.json index 70ab56625..11ad8ffcd 100644 --- a/production/mempool-config.liquid.json +++ b/production/mempool-config.liquid.json @@ -28,8 +28,8 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "mempool_liquid", - "PASSWORD": "mempool_liquid", + "USERNAME": "__MEMPOOL_LIQUID_USER__", + "PASSWORD": "__MEMPOOL_LIQUID_PASS__", "DATABASE": "mempool_liquid" }, "STATISTICS": { diff --git a/production/mempool-config.liquidtestnet.json b/production/mempool-config.liquidtestnet.json index b3c4dfaaf..7769bfb53 100644 --- a/production/mempool-config.liquidtestnet.json +++ b/production/mempool-config.liquidtestnet.json @@ -28,8 +28,8 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "mempool_liquidtestnet", - "PASSWORD": "mempool_liquidtestnet", + "USERNAME": "__MEMPOOL_LIQUIDTESTNET_USER__", + "PASSWORD": "__MEMPOOL_LIQUIDTESTNET_PASS__", "DATABASE": "mempool_liquidtestnet" }, "STATISTICS": { diff --git a/production/mempool-config.mainnet.json b/production/mempool-config.mainnet.json index 4575afdbe..06a14d223 100644 --- a/production/mempool-config.mainnet.json +++ b/production/mempool-config.mainnet.json @@ -32,8 +32,8 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "mempool", - "PASSWORD": "mempool", + "USERNAME": "__MEMPOOL_MAINNET_USER__", + "PASSWORD": "__MEMPOOL_MAINNET_PASS__", "DATABASE": "mempool" }, "STATISTICS": { diff --git a/production/mempool-config.signet.json b/production/mempool-config.signet.json index c1333f45a..f42c4dc50 100644 --- a/production/mempool-config.signet.json +++ b/production/mempool-config.signet.json @@ -24,8 +24,8 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "mempool_signet", - "PASSWORD": "mempool_signet", + "USERNAME": "__MEMPOOL_SIGNET_USER__", + "PASSWORD": "__MEMPOOL_SIGNET_PASS__", "DATABASE": "mempool_signet" }, "STATISTICS": { diff --git a/production/mempool-config.testnet.json b/production/mempool-config.testnet.json index 79190c2de..cc63f93bf 100644 --- a/production/mempool-config.testnet.json +++ b/production/mempool-config.testnet.json @@ -24,8 +24,8 @@ "ENABLED": true, "HOST": "127.0.0.1", "PORT": 3306, - "USERNAME": "mempool_testnet", - "PASSWORD": "mempool_testnet", + "USERNAME": "__MEMPOOL_TESTNET_USER__", + "PASSWORD": "__MEMPOOL_TESTNET_PASS__", "DATABASE": "mempool_testnet" }, "STATISTICS": { From 7e504e783fd873c35dadcc3db370ce04efe33cfc Mon Sep 17 00:00:00 2001 From: wiz Date: Wed, 27 Jul 2022 00:47:46 +0200 Subject: [PATCH 8/8] Fix zmq ports in prod bitcoin.conf --- production/bitcoin.conf | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/production/bitcoin.conf b/production/bitcoin.conf index 4cb95eacc..0fa1e943f 100644 --- a/production/bitcoin.conf +++ b/production/bitcoin.conf @@ -18,12 +18,18 @@ whitelist=2401:b140::/32 #uacomment=@wiz [main] -bind=0.0.0.0:8333 -bind=[::]:8333 rpcbind=127.0.0.1:8332 rpcbind=[::1]:8332 -zmqpubrawblock=tcp://127.0.0.1:18332 -zmqpubrawtx=tcp://127.0.0.1:18333 +bind=0.0.0.0:8333 +bind=[::]:8333 +zmqpubrawblock=tcp://127.0.0.1:8334 +zmqpubrawtx=tcp://127.0.0.1:8335 +#addnode=[2401:b140:1::92:201]:8333 +#addnode=[2401:b140:1::92:202]:8333 +#addnode=[2401:b140:1::92:203]:8333 +#addnode=[2401:b140:1::92:204]:8333 +#addnode=[2401:b140:1::92:205]:8333 +#addnode=[2401:b140:1::92:206]:8333 #addnode=[2401:b140:2::92:201]:8333 #addnode=[2401:b140:2::92:202]:8333 #addnode=[2401:b140:2::92:203]:8333 @@ -33,10 +39,18 @@ zmqpubrawtx=tcp://127.0.0.1:18333 [test] daemon=1 -bind=0.0.0.0:18333 -bind=[::]:18333 rpcbind=127.0.0.1:18332 rpcbind=[::1]:18332 +bind=0.0.0.0:18333 +bind=[::]:18333 +zmqpubrawblock=tcp://127.0.0.1:18334 +zmqpubrawtx=tcp://127.0.0.1:18335 +#addnode=[2401:b140:1::92:201]:18333 +#addnode=[2401:b140:1::92:202]:18333 +#addnode=[2401:b140:1::92:203]:18333 +#addnode=[2401:b140:1::92:204]:18333 +#addnode=[2401:b140:1::92:205]:18333 +#addnode=[2401:b140:1::92:206]:18333 #addnode=[2401:b140:2::92:201]:18333 #addnode=[2401:b140:2::92:202]:18333 #addnode=[2401:b140:2::92:203]:18333 @@ -46,10 +60,18 @@ rpcbind=[::1]:18332 [signet] daemon=1 -bind=0.0.0.0:38333 -bind=[::]:38333 rpcbind=127.0.0.1:38332 rpcbind=[::1]:38332 +bind=0.0.0.0:38333 +bind=[::]:38333 +zmqpubrawblock=tcp://127.0.0.1:38334 +zmqpubrawtx=tcp://127.0.0.1:38335 +#addnode=[2401:b140:1::92:201]:38333 +#addnode=[2401:b140:1::92:202]:38333 +#addnode=[2401:b140:1::92:203]:38333 +#addnode=[2401:b140:1::92:204]:38333 +#addnode=[2401:b140:1::92:205]:38333 +#addnode=[2401:b140:1::92:206]:38333 #addnode=[2401:b140:2::92:201]:38333 #addnode=[2401:b140:2::92:202]:38333 #addnode=[2401:b140:2::92:203]:38333