Merge branch 'master' into rtlFixes3

This commit is contained in:
wiz 2022-07-06 00:24:31 +02:00 committed by GitHub
commit e0e2a2a626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 4814 additions and 292 deletions

88
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,88 @@
name: CI Pipeline for the Backend and Frontend
on:
push:
env:
NODE_VERSION: 16.15.0
jobs:
backend:
strategy:
matrix:
flavor: ['dev', 'prod']
runs-on: 'ubuntu-latest'
name: Backend (${{ matrix.flavor }})
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ matrix.flavor }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm install
working-directory: ${{ matrix.flavor }}/backend
- name: Install (Prod dependencies only)
if: ${{ matrix.flavor == 'prod'}}
run: npm install --prod
working-directory: ${{ matrix.flavor }}/backend
- name: Lint
if: ${{ matrix.flavor == 'dev'}}
run: npm run lint
working-directory: ${{ matrix.flavor }}/backend
# - name: Test
# run: npm run test
- name: Build
run: npm run build
working-directory: ${{ matrix.flavor }}/backend
frontend:
strategy:
matrix:
flavor: ['dev', 'prod']
runs-on: 'ubuntu-latest'
name: Frontend (${{ matrix.flavor }})
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ matrix.flavor }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Install (Prod dependencies only)
run: npm install
if: ${{ matrix.flavor == 'prod'}}
working-directory: ${{ matrix.flavor }}/frontend
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm install
working-directory: ${{ matrix.flavor }}/frontend
- name: Lint
run: npm run lint
working-directory: ${{ matrix.flavor }}/frontend
# - name: Test
# run: npm run test
- name: Build
run: npm run build
working-directory: ${{ matrix.flavor }}/frontend

View File

@ -1,8 +1,11 @@
name: Cypress Tests name: Cypress Tests
on: [push, pull_request] on:
pull_request:
types: [ opened, review_requested, synchronize ]
jobs: jobs:
cypress: cypress:
if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ sitemap
data data
docker-compose.yml docker-compose.yml
backend/mempool-config.json backend/mempool-config.json
*.swp

2
backend/.eslintignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
dist

32
backend/.eslintrc Normal file
View File

@ -0,0 +1,32 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/no-inferrable-types": 1,
"@typescript-eslint/no-namespace": 1,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-var-requires": 1,
"no-console": 1,
"no-constant-condition": 1,
"no-dupe-else-if": 1,
"no-empty": 1,
"no-prototype-builtins": 1,
"no-self-assign": 1,
"no-useless-catch": 1,
"no-var": 1,
"prefer-const": 1,
"prefer-rest-params": 1
}
}

2606
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,15 +20,17 @@
], ],
"main": "index.ts", "main": "index.ts",
"scripts": { "scripts": {
"ng": "./node_modules/@angular/cli/bin/ng",
"tsc": "./node_modules/typescript/bin/tsc", "tsc": "./node_modules/typescript/bin/tsc",
"build": "npm run tsc", "build": "npm run tsc",
"start": "node --max-old-space-size=2048 dist/index.js", "start": "node --max-old-space-size=2048 dist/index.js",
"start-production": "node --max-old-space-size=4096 dist/index.js", "start-production": "node --max-old-space-size=4096 dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1",
"lint": "./node_modules/.bin/eslint . --ext .ts",
"lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix"
}, },
"dependencies": { "dependencies": {
"@mempool/electrum-client": "^1.1.7", "@mempool/electrum-client": "^1.1.7",
"@types/node": "^16.11.41",
"axios": "~0.27.2", "axios": "~0.27.2",
"bitcoinjs-lib": "6.0.1", "bitcoinjs-lib": "6.0.1",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
@ -41,8 +43,11 @@
}, },
"devDependencies": { "devDependencies": {
"@types/compression": "^1.7.2", "@types/compression": "^1.7.2",
"@types/ws": "~8.5.3",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"@types/ws": "~8.5.3",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"eslint": "^8.19.0",
"tslint": "^6.1.0" "tslint": "^6.1.0"
} }
} }

View File

@ -4,6 +4,7 @@ export interface AbstractBitcoinApi {
$getRawMempool(): Promise<IEsploraApi.Transaction['txid'][]>; $getRawMempool(): Promise<IEsploraApi.Transaction['txid'][]>;
$getRawTransaction(txId: string, skipConversion?: boolean, addPrevout?: boolean, lazyPrevouts?: boolean): Promise<IEsploraApi.Transaction>; $getRawTransaction(txId: string, skipConversion?: boolean, addPrevout?: boolean, lazyPrevouts?: boolean): Promise<IEsploraApi.Transaction>;
$getBlockHeightTip(): Promise<number>; $getBlockHeightTip(): Promise<number>;
$getBlockHashTip(): Promise<string>;
$getTxIdsForBlock(hash: string): Promise<string[]>; $getTxIdsForBlock(hash: string): Promise<string[]>;
$getBlockHash(height: number): Promise<string>; $getBlockHash(height: number): Promise<string>;
$getBlockHeader(hash: string): Promise<string>; $getBlockHeader(hash: string): Promise<string>;

View File

@ -64,6 +64,13 @@ class BitcoinApi implements AbstractBitcoinApi {
}); });
} }
$getBlockHashTip(): Promise<string> {
return this.bitcoindClient.getChainTips()
.then((result: IBitcoinApi.ChainTips[]) => {
return result.find(tip => tip.status === 'active')!.hash;
});
}
$getTxIdsForBlock(hash: string): Promise<string[]> { $getTxIdsForBlock(hash: string): Promise<string[]> {
return this.bitcoindClient.getBlock(hash, 1) return this.bitcoindClient.getBlock(hash, 1)
.then((rpcBlock: IBitcoinApi.Block) => rpcBlock.tx); .then((rpcBlock: IBitcoinApi.Block) => rpcBlock.tx);

View File

@ -1,10 +1,10 @@
import config from '../../config'; import config from '../../config';
import Client from '@mempool/electrum-client';
import { AbstractBitcoinApi } from './bitcoin-api-abstract-factory'; import { AbstractBitcoinApi } from './bitcoin-api-abstract-factory';
import { IEsploraApi } from './esplora-api.interface'; import { IEsploraApi } from './esplora-api.interface';
import { IElectrumApi } from './electrum-api.interface'; import { IElectrumApi } from './electrum-api.interface';
import BitcoinApi from './bitcoin-api'; import BitcoinApi from './bitcoin-api';
import logger from '../../logger'; import logger from '../../logger';
import * as ElectrumClient from '@mempool/electrum-client';
import * as sha256 from 'crypto-js/sha256'; import * as sha256 from 'crypto-js/sha256';
import * as hexEnc from 'crypto-js/enc-hex'; import * as hexEnc from 'crypto-js/enc-hex';
import loadingIndicators from '../loading-indicators'; import loadingIndicators from '../loading-indicators';
@ -26,7 +26,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
onLog: (str) => { logger.debug(str); }, onLog: (str) => { logger.debug(str); },
}; };
this.electrumClient = new ElectrumClient( this.electrumClient = new Client(
config.ELECTRUM.PORT, config.ELECTRUM.PORT,
config.ELECTRUM.HOST, config.ELECTRUM.HOST,
config.ELECTRUM.TLS_ENABLED ? 'tls' : 'tcp', config.ELECTRUM.TLS_ENABLED ? 'tls' : 'tcp',
@ -35,7 +35,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
); );
this.electrumClient.initElectrum(electrumConfig, electrumPersistencePolicy) this.electrumClient.initElectrum(electrumConfig, electrumPersistencePolicy)
.then(() => {}) .then(() => { })
.catch((err) => { .catch((err) => {
logger.err(`Error connecting to Electrum Server at ${config.ELECTRUM.HOST}:${config.ELECTRUM.PORT}`); logger.err(`Error connecting to Electrum Server at ${config.ELECTRUM.HOST}:${config.ELECTRUM.PORT}`);
}); });
@ -95,7 +95,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
async $getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]> { async $getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]> {
const addressInfo = await this.bitcoindClient.validateAddress(address); const addressInfo = await this.bitcoindClient.validateAddress(address);
if (!addressInfo || !addressInfo.isvalid) { if (!addressInfo || !addressInfo.isvalid) {
return []; return [];
} }
try { try {

View File

@ -25,6 +25,11 @@ class ElectrsApi implements AbstractBitcoinApi {
.then((response) => response.data); .then((response) => response.data);
} }
$getBlockHashTip(): Promise<string> {
return axios.get<string>(config.ESPLORA.REST_API_URL + '/blocks/tip/hash', this.axiosConfig)
.then((response) => response.data);
}
$getTxIdsForBlock(hash: string): Promise<string[]> { $getTxIdsForBlock(hash: string): Promise<string[]> {
return axios.get<string[]>(config.ESPLORA.REST_API_URL + '/block/' + hash + '/txids', this.axiosConfig) return axios.get<string[]>(config.ESPLORA.REST_API_URL + '/block/' + hash + '/txids', this.axiosConfig)
.then((response) => response.data); .then((response) => response.data);

View File

@ -300,12 +300,8 @@ class Blocks {
* [INDEXING] Index all blocks metadata for the mining dashboard * [INDEXING] Index all blocks metadata for the mining dashboard
*/ */
public async $generateBlockDatabase(): Promise<boolean> { public async $generateBlockDatabase(): Promise<boolean> {
const blockchainInfo = await bitcoinClient.getBlockchainInfo();
if (blockchainInfo.blocks !== blockchainInfo.headers) { // Wait for node to sync
return false;
}
try { try {
const blockchainInfo = await bitcoinClient.getBlockchainInfo();
let currentBlockHeight = blockchainInfo.blocks; let currentBlockHeight = blockchainInfo.blocks;
let indexingBlockAmount = Math.min(config.MEMPOOL.INDEXING_BLOCKS_AMOUNT, blockchainInfo.blocks); let indexingBlockAmount = Math.min(config.MEMPOOL.INDEXING_BLOCKS_AMOUNT, blockchainInfo.blocks);

View File

@ -1,6 +1,6 @@
import * as fs from 'fs'; import * as fs from 'fs';
const fsPromises = fs.promises; const fsPromises = fs.promises;
import * as cluster from 'cluster'; import cluster from 'cluster';
import memPool from './mempool'; import memPool from './mempool';
import blocks from './blocks'; import blocks from './blocks';
import logger from '../logger'; import logger from '../logger';
@ -19,7 +19,7 @@ class DiskCache {
constructor() { } constructor() { }
async $saveCacheToDisk(): Promise<void> { async $saveCacheToDisk(): Promise<void> {
if (!cluster.isMaster) { if (!cluster.isPrimary) {
return; return;
} }
if (this.isWritingCache) { if (this.isWritingCache) {
@ -46,12 +46,12 @@ class DiskCache {
blockSummaries: blocks.getBlockSummaries(), blockSummaries: blocks.getBlockSummaries(),
mempool: {}, mempool: {},
mempoolArray: mempoolArray.splice(0, chunkSize), mempoolArray: mempoolArray.splice(0, chunkSize),
}), {flag: 'w'}); }), { flag: 'w' });
for (let i = 1; i < DiskCache.CHUNK_FILES; i++) { for (let i = 1; i < DiskCache.CHUNK_FILES; i++) {
await fsPromises.writeFile(DiskCache.FILE_NAMES.replace('{number}', i.toString()), JSON.stringify({ await fsPromises.writeFile(DiskCache.FILE_NAMES.replace('{number}', i.toString()), JSON.stringify({
mempool: {}, mempool: {},
mempoolArray: mempoolArray.splice(0, chunkSize), mempoolArray: mempoolArray.splice(0, chunkSize),
}), {flag: 'w'}); }), { flag: 'w' });
} }
logger.debug('Mempool and blocks data saved to disk cache'); logger.debug('Mempool and blocks data saved to disk cache');
this.isWritingCache = false; this.isWritingCache = false;
@ -67,7 +67,7 @@ class DiskCache {
fs.unlinkSync(DiskCache.FILE_NAMES.replace('{number}', i.toString())); fs.unlinkSync(DiskCache.FILE_NAMES.replace('{number}', i.toString()));
} }
} }
loadMempoolCache() { loadMempoolCache() {
if (!fs.existsSync(DiskCache.FILE_NAME)) { if (!fs.existsSync(DiskCache.FILE_NAME)) {
return; return;

View File

@ -1,7 +1,9 @@
import logger from '../logger'; import logger from '../logger';
import * as WebSocket from 'ws'; import * as WebSocket from 'ws';
import { BlockExtended, TransactionExtended, WebsocketResponse, MempoolBlock, MempoolBlockDelta, import {
OptimizedStatistic, ILoadingIndicators, IConversionRates } from '../mempool.interfaces'; BlockExtended, TransactionExtended, WebsocketResponse, MempoolBlock, MempoolBlockDelta,
OptimizedStatistic, ILoadingIndicators, IConversionRates
} from '../mempool.interfaces';
import blocks from './blocks'; import blocks from './blocks';
import memPool from './mempool'; import memPool from './mempool';
import backendInfo from './backend-info'; import backendInfo from './backend-info';
@ -164,7 +166,7 @@ class WebsocketHandler {
throw new Error('WebSocket.Server is not set'); throw new Error('WebSocket.Server is not set');
} }
this.wss.clients.forEach((client: WebSocket) => { this.wss.clients.forEach((client) => {
if (client.readyState !== WebSocket.OPEN) { if (client.readyState !== WebSocket.OPEN) {
return; return;
} }
@ -179,7 +181,7 @@ class WebsocketHandler {
throw new Error('WebSocket.Server is not set'); throw new Error('WebSocket.Server is not set');
} }
this.wss.clients.forEach((client: WebSocket) => { this.wss.clients.forEach((client) => {
if (client.readyState !== WebSocket.OPEN) { if (client.readyState !== WebSocket.OPEN) {
return; return;
} }
@ -192,7 +194,7 @@ class WebsocketHandler {
throw new Error('WebSocket.Server is not set'); throw new Error('WebSocket.Server is not set');
} }
this.wss.clients.forEach((client: WebSocket) => { this.wss.clients.forEach((client) => {
if (client.readyState !== WebSocket.OPEN) { if (client.readyState !== WebSocket.OPEN) {
return; return;
} }
@ -224,7 +226,7 @@ class WebsocketHandler {
throw new Error('WebSocket.Server is not set'); throw new Error('WebSocket.Server is not set');
} }
this.wss.clients.forEach((client: WebSocket) => { this.wss.clients.forEach((client) => {
if (client.readyState !== WebSocket.OPEN) { if (client.readyState !== WebSocket.OPEN) {
return; return;
} }
@ -255,7 +257,7 @@ class WebsocketHandler {
memPool.handleRbfTransactions(rbfTransactions); memPool.handleRbfTransactions(rbfTransactions);
const recommendedFees = feeApi.getRecommendedFee(); const recommendedFees = feeApi.getRecommendedFee();
this.wss.clients.forEach(async (client: WebSocket) => { this.wss.clients.forEach(async (client) => {
if (client.readyState !== WebSocket.OPEN) { if (client.readyState !== WebSocket.OPEN) {
return; return;
} }

View File

@ -1,8 +1,8 @@
import { Express, Request, Response, NextFunction } from 'express'; import express from "express";
import * as express from 'express'; import { Application, Request, Response, NextFunction, Express } from 'express';
import * as http from 'http'; import * as http from 'http';
import * as WebSocket from 'ws'; import * as WebSocket from 'ws';
import * as cluster from 'cluster'; import cluster from 'cluster';
import axios from 'axios'; import axios from 'axios';
import DB from './database'; import DB from './database';
@ -32,7 +32,7 @@ import priceUpdater from './tasks/price-updater';
class Server { class Server {
private wss: WebSocket.Server | undefined; private wss: WebSocket.Server | undefined;
private server: http.Server | undefined; private server: http.Server | undefined;
private app: Express; private app: Application;
private currentBackendRetryInterval = 5; private currentBackendRetryInterval = 5;
constructor() { constructor() {
@ -43,7 +43,7 @@ class Server {
return; return;
} }
if (cluster.isMaster) { if (cluster.isPrimary) {
logger.notice(`Mempool Server (Master) is running on port ${config.MEMPOOL.HTTP_PORT} (${backendInfo.getShortCommitHash()})`); logger.notice(`Mempool Server (Master) is running on port ${config.MEMPOOL.HTTP_PORT} (${backendInfo.getShortCommitHash()})`);
const numCPUs = config.MEMPOOL.SPAWN_CLUSTER_PROCS; const numCPUs = config.MEMPOOL.SPAWN_CLUSTER_PROCS;
@ -77,7 +77,7 @@ class Server {
}) })
.use(express.urlencoded({ extended: true })) .use(express.urlencoded({ extended: true }))
.use(express.text()) .use(express.text())
; ;
this.server = http.createServer(this.app); this.server = http.createServer(this.app);
this.wss = new WebSocket.Server({ server: this.server }); this.wss = new WebSocket.Server({ server: this.server });
@ -105,7 +105,7 @@ class Server {
} }
} }
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED && cluster.isMaster) { if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED && cluster.isPrimary) {
statistics.startStatistics(); statistics.startStatistics();
} }
@ -260,7 +260,7 @@ class Server {
res.status(500).end(); res.status(500).end();
} }
}) })
; ;
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) { if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {
this.app this.app
@ -290,7 +290,7 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/rewards/:interval', routes.$getHistoricalBlockRewards) .get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/rewards/:interval', routes.$getHistoricalBlockRewards)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/fee-rates/:interval', routes.$getHistoricalBlockFeeRates) .get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/fee-rates/:interval', routes.$getHistoricalBlockFeeRates)
.get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/sizes-weights/:interval', routes.$getHistoricalBlockSizeAndWeight) .get(config.MEMPOOL.API_URL_PREFIX + 'mining/blocks/sizes-weights/:interval', routes.$getHistoricalBlockSizeAndWeight)
; ;
} }
if (config.BISQ.ENABLED) { if (config.BISQ.ENABLED) {
@ -332,6 +332,7 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', routes.getTransactionOutspends) .get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', routes.getTransactionOutspends)
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/header', routes.getBlockHeader) .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/header', routes.getBlockHeader)
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/height', routes.getBlockTipHeight) .get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/height', routes.getBlockTipHeight)
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/hash', routes.getBlockTipHash)
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/txs', routes.getBlockTransactions) .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/txs', routes.getBlockTransactions)
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/txs/:index', routes.getBlockTransactions) .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/txs/:index', routes.getBlockTransactions)
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/txids', routes.getTxIdsForBlock) .get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/txids', routes.getTxIdsForBlock)
@ -340,7 +341,7 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'address/:address/txs', routes.getAddressTransactions) .get(config.MEMPOOL.API_URL_PREFIX + 'address/:address/txs', routes.getAddressTransactions)
.get(config.MEMPOOL.API_URL_PREFIX + 'address/:address/txs/chain/:txId', routes.getAddressTransactions) .get(config.MEMPOOL.API_URL_PREFIX + 'address/:address/txs/chain/:txId', routes.getAddressTransactions)
.get(config.MEMPOOL.API_URL_PREFIX + 'address-prefix/:prefix', routes.getAddressPrefix) .get(config.MEMPOOL.API_URL_PREFIX + 'address-prefix/:prefix', routes.getAddressPrefix)
; ;
} }
if (Common.isLiquid()) { if (Common.isLiquid()) {
@ -349,13 +350,13 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/featured', routes.$getAllFeaturedLiquidAssets) .get(config.MEMPOOL.API_URL_PREFIX + 'assets/featured', routes.$getAllFeaturedLiquidAssets)
.get(config.MEMPOOL.API_URL_PREFIX + 'asset/:assetId/icon', routes.getLiquidIcon) .get(config.MEMPOOL.API_URL_PREFIX + 'asset/:assetId/icon', routes.getLiquidIcon)
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/group/:id', routes.$getAssetGroup) .get(config.MEMPOOL.API_URL_PREFIX + 'assets/group/:id', routes.$getAssetGroup)
; ;
} }
if (Common.isLiquid() && config.DATABASE.ENABLED) { if (Common.isLiquid() && config.DATABASE.ENABLED) {
this.app this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'liquid/pegs/month', routes.$getElementsPegsByMonth) .get(config.MEMPOOL.API_URL_PREFIX + 'liquid/pegs/month', routes.$getElementsPegsByMonth)
; ;
} }
} }
} }

View File

@ -4,6 +4,7 @@ import mempool from './api/mempool';
import mining from './api/mining'; import mining from './api/mining';
import logger from './logger'; import logger from './logger';
import HashratesRepository from './repositories/HashratesRepository'; import HashratesRepository from './repositories/HashratesRepository';
import bitcoinClient from './api/bitcoin/bitcoin-client';
class Indexer { class Indexer {
runIndexer = true; runIndexer = true;
@ -25,6 +26,12 @@ class Indexer {
return; return;
} }
// Do not attempt to index anything unless Bitcoin Core is fully synced
const blockchainInfo = await bitcoinClient.getBlockchainInfo();
if (blockchainInfo.blocks !== blockchainInfo.headers) {
return;
}
this.runIndexer = false; this.runIndexer = false;
this.indexerRunning = true; this.indexerRunning = true;

View File

@ -925,6 +925,16 @@ class Routes {
} }
} }
public async getBlockTipHash(req: Request, res: Response) {
try {
const result = await bitcoinApi.$getBlockHashTip();
res.setHeader('content-type', 'text/plain');
res.send(result);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
public async getTxIdsForBlock(req: Request, res: Response) { public async getTxIdsForBlock(req: Request, res: Response) {
try { try {
const result = await bitcoinApi.$getTxIdsForBlock(req.params.hash); const result = await bitcoinApi.$getTxIdsForBlock(req.params.hash);

View File

@ -1,5 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"types": ["node"],
"module": "commonjs", "module": "commonjs",
"target": "esnext", "target": "esnext",
"lib": ["es2019", "dom"], "lib": ["es2019", "dom"],
@ -11,7 +12,8 @@
"typeRoots": [ "typeRoots": [
"node_modules/@types" "node_modules/@types"
], ],
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true,
"esModuleInterop": true
}, },
"include": [ "include": [
"src/**/*.ts" "src/**/*.ts"

3
frontend/.eslintignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
dist
frontend

34
frontend/.eslintrc Normal file
View File

@ -0,0 +1,34 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/no-inferrable-types": 1,
"@typescript-eslint/no-namespace": 1,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-var-requires": 1,
"no-case-declarations": 1,
"no-console": 1,
"no-constant-condition": 1,
"no-dupe-else-if": 1,
"no-empty": 1,
"no-extra-boolean-cast": 1,
"no-prototype-builtins": 1,
"no-self-assign": 1,
"no-useless-catch": 1,
"no-var": 1,
"prefer-const": 1,
"prefer-rest-params": 1
}
}

File diff suppressed because it is too large Load Diff

View File

@ -20,20 +20,20 @@
], ],
"main": "index.ts", "main": "index.ts",
"scripts": { "scripts": {
"ng": "./node_modules/@angular/cli/bin/ng", "ng": "./node_modules/@angular/cli/bin/ng.js",
"tsc": "./node_modules/typescript/bin/tsc", "tsc": "./node_modules/typescript/bin/tsc",
"i18n-extract-from-source": "./node_modules/@angular/cli/bin/ng extract-i18n --out-file ./src/locale/messages.xlf", "i18n-extract-from-source": "./node_modules/@angular/cli/bin/ng extract-i18n --out-file ./src/locale/messages.xlf",
"i18n-pull-from-transifex": "tx pull -a --parallel --minimum-perc 1 --force", "i18n-pull-from-transifex": "tx pull -a --parallel --minimum-perc 1 --force",
"serve": "npm run generate-config && ng serve -c local", "serve": "npm run generate-config && npm run ng -- serve -c local",
"serve:stg": "npm run generate-config && ng serve -c staging", "serve:stg": "npm run generate-config && npm run ng -- serve -c staging",
"serve:local-prod": "npm run generate-config && ng serve -c local-prod", "serve:local-prod": "npm run generate-config && npm run ng -- serve -c local-prod",
"serve:local-staging": "npm run generate-config && ng serve -c local-staging", "serve:local-staging": "npm run generate-config && npm run ng -- serve -c local-staging",
"start": "npm run generate-config && npm run sync-assets-dev && ng serve -c local", "start": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c local",
"start:stg": "npm run generate-config && npm run sync-assets-dev && ng serve -c staging", "start:stg": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c staging",
"start:local-prod": "npm run generate-config && npm run sync-assets-dev && ng serve -c local-prod", "start:local-prod": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c local-prod",
"start:local-staging": "npm run generate-config && npm run sync-assets-dev && ng serve -c local-staging", "start:local-staging": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c local-staging",
"start:mixed": "npm run generate-config && npm run sync-assets-dev && ng serve -c mixed", "start:mixed": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c mixed",
"build": "npm run generate-config && ng build --configuration production --localize && npm run sync-assets && npm run build-mempool.js", "build": "npm run generate-config && npm run ng -- build --configuration production --localize && npm run sync-assets && npm run build-mempool.js",
"sync-assets": "node sync-assets.js && rsync -av ./dist/mempool/browser/en-US/resources ./dist/mempool/browser/resources", "sync-assets": "node sync-assets.js && rsync -av ./dist/mempool/browser/en-US/resources ./dist/mempool/browser/resources",
"sync-assets-dev": "node sync-assets.js dev", "sync-assets-dev": "node sync-assets.js dev",
"generate-config": "node generate-config.js", "generate-config": "node generate-config.js",
@ -41,17 +41,18 @@
"build-mempool-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index.js --standalone mempoolJS > ./dist/mempool/browser/en-US/mempool.js", "build-mempool-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index.js --standalone mempoolJS > ./dist/mempool/browser/en-US/mempool.js",
"build-mempool-bisq-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index-bisq.js --standalone bisqJS > ./dist/mempool/browser/en-US/bisq.js", "build-mempool-bisq-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index-bisq.js --standalone bisqJS > ./dist/mempool/browser/en-US/bisq.js",
"build-mempool-liquid-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index-liquid.js --standalone liquidJS > ./dist/mempool/browser/en-US/liquid.js", "build-mempool-liquid-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index-liquid.js --standalone liquidJS > ./dist/mempool/browser/en-US/liquid.js",
"test": "ng test", "test": "npm run ng -- test",
"lint": "ng lint", "lint": "./node_modules/.bin/eslint . --ext .ts",
"e2e": "npm run generate-config && ng e2e", "lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix",
"e2e": "npm run generate-config && npm run ng -- e2e",
"e2e:ci": "npm run cypress:run:ci", "e2e:ci": "npm run cypress:run:ci",
"config:defaults:mempool": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true LIQUID_TESTNET_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=mempool BLOCK_WEIGHT_UNITS=4000000 && npm run generate-config", "config:defaults:mempool": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true LIQUID_TESTNET_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=mempool BLOCK_WEIGHT_UNITS=4000000 && npm run generate-config",
"config:defaults:liquid": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true LIQUID_TESTNET_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=liquid BLOCK_WEIGHT_UNITS=300000 && npm run generate-config", "config:defaults:liquid": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true LIQUID_TESTNET_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=liquid BLOCK_WEIGHT_UNITS=300000 && npm run generate-config",
"config:defaults:bisq": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=bisq BLOCK_WEIGHT_UNITS=4000000 && npm run generate-config", "config:defaults:bisq": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=bisq BLOCK_WEIGHT_UNITS=4000000 && npm run generate-config",
"dev:ssr": "npm run generate-config && ng run mempool:serve-ssr", "dev:ssr": "npm run generate-config && npm run ng -- run mempool:serve-ssr",
"serve:ssr": "node server.run.js", "serve:ssr": "node server.run.js",
"build:ssr": "npm run build && ng run mempool:server:production && ./node_modules/typescript/bin/tsc server.run.ts", "build:ssr": "npm run build && npm run ng -- run mempool:server:production && npm run tsc -- server.run.ts",
"prerender": "ng run mempool:prerender", "prerender": "npm run ng -- run mempool:prerender",
"cypress:open": "cypress open", "cypress:open": "cypress open",
"cypress:run": "cypress run", "cypress:run": "cypress run",
"cypress:run:record": "cypress run --record", "cypress:run:record": "cypress run --record",
@ -107,7 +108,10 @@
"@types/jasmine": "~4.0.3", "@types/jasmine": "~4.0.3",
"@types/jasminewd2": "~2.0.10", "@types/jasminewd2": "~2.0.10",
"@types/node": "^12.11.1", "@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"codelyzer": "~6.0.2", "codelyzer": "~6.0.2",
"eslint": "^8.19.0",
"http-proxy-middleware": "^1.0.5", "http-proxy-middleware": "^1.0.5",
"jasmine-core": "~4.1.0", "jasmine-core": "~4.1.0",
"jasmine-spec-reporter": "~7.0.0", "jasmine-spec-reporter": "~7.0.0",

View File

@ -31,7 +31,7 @@ export class BisqTransfersComponent implements OnInit, OnChanges {
} }
ngOnChanges() { ngOnChanges() {
this.totalOutput = this.tx.outputs.filter((output) => output.isVerified).reduce((acc, output) => acc + output.bsqAmount, 0);; this.totalOutput = this.tx.outputs.filter((output) => output.isVerified).reduce((acc, output) => acc + output.bsqAmount, 0);
} }
switchCurrency() { switchCurrency() {

View File

@ -5,8 +5,8 @@
</div> </div>
<div class="band-separator fill"></div> <div class="band-separator fill"></div>
<div class="fee-progress-bar priority" [style.background]="gradient"> <div class="fee-progress-bar priority" [style.background]="gradient">
<span class="fee-label prority" i18n="fees-box.low-priority" i18n-ngbTooltip="Transaction feerate tooltip (low priority)" ngbTooltip="Places your transaction in between the second and third mempool blocks" placement="top">Low Priority</span> <span class="fee-label prority" i18n="fees-box.low-priority" i18n-ngbTooltip="Transaction feerate tooltip (low priority)" ngbTooltip="Usually places your transaction in between the second and third mempool blocks" placement="top">Low Priority</span>
<span class="fee-label prority" i18n="fees-box.medium-priority" i18n-ngbTooltip="Transaction feerate tooltip (medium priority)" ngbTooltip="Places your transaction in between the first and second mempool blocks" placement="top">Medium Priority</span> <span class="fee-label prority" i18n="fees-box.medium-priority" i18n-ngbTooltip="Transaction feerate tooltip (medium priority)" ngbTooltip="Usually places your transaction in between the first and second mempool blocks" placement="top">Medium Priority</span>
<span class="fee-label prority" i18n="fees-box.high-priority" i18n-ngbTooltip="Transaction feerate tooltip (high priority)" ngbTooltip="Places your transaction in the first mempool block" placement="top">High Priority</span> <span class="fee-label prority" i18n="fees-box.high-priority" i18n-ngbTooltip="Transaction feerate tooltip (high priority)" ngbTooltip="Places your transaction in the first mempool block" placement="top">High Priority</span>
</div> </div>
</div> </div>

View File

@ -17,15 +17,15 @@ export class ApiDocsNavComponent implements OnInit {
constructor() { } constructor() { }
ngOnInit(): void { ngOnInit(): void {
if( this.whichTab === 'rest' ) { if (this.whichTab === 'rest') {
this.tabData = restApiDocsData; this.tabData = restApiDocsData;
} else if( this.whichTab = 'faq' ) { } else if (this.whichTab === 'faq') {
this.tabData = faqData; this.tabData = faqData;
} }
} }
navLinkClick( event ) { navLinkClick(event) {
this.navLinkClickEvent.emit( event ); this.navLinkClickEvent.emit(event);
} }
} }

View File

@ -3,7 +3,7 @@
<h2 i18n="documentation.title">Documentation</h2> <h2 i18n="documentation.title">Documentation</h2>
<ul ngbNav #nav="ngbNav" [(activeId)]="activeTab" class="nav-tabs" role="tablist"> <ul ngbNav #nav="ngbNav" [animation]="false" [(activeId)]="activeTab" class="nav-tabs" role="tablist">
<li [ngbNavItem]="0" *ngIf="showFaqTab" role="presentation"> <li [ngbNavItem]="0" *ngIf="showFaqTab" role="presentation">
<a ngbNavLink [routerLink]="['/docs/faq' | relativeUrl]" role="tab">FAQ</a> <a ngbNavLink [routerLink]="['/docs/faq' | relativeUrl]" role="tab">FAQ</a>

View File

@ -22,6 +22,8 @@ bind=0.0.0.0:8333
bind=[::]:8333 bind=[::]:8333
rpcbind=127.0.0.1:8332 rpcbind=127.0.0.1:8332
rpcbind=[::1]:8332 rpcbind=[::1]:8332
zmqpubrawblock=tcp://127.0.0.1:18332
zmqpubrawtx=tcp://127.0.0.1:18333
#addnode=[2401:b140:2::92:201]:8333 #addnode=[2401:b140:2::92:201]:8333
#addnode=[2401:b140:2::92:202]:8333 #addnode=[2401:b140:2::92:202]:8333
#addnode=[2401:b140:2::92:203]:8333 #addnode=[2401:b140:2::92:203]:8333

View File

@ -180,7 +180,7 @@ case $OS in
TOR_PKG=tor TOR_PKG=tor
TOR_USER=_tor TOR_USER=_tor
TOR_GROUP=_tor TOR_GROUP=_tor
CERTBOT_PKG=py38-certbot CERTBOT_PKG=py39-certbot
;; ;;
Debian) Debian)
@ -191,9 +191,9 @@ case $OS in
TOR_CONFIGURATION=/etc/tor/torrc TOR_CONFIGURATION=/etc/tor/torrc
TOR_RESOURCES=/var/lib/tor TOR_RESOURCES=/var/lib/tor
TOR_PKG=tor TOR_PKG=tor
TOR_USER=tor-debian TOR_USER=debian-tor
TOR_GROUP=tor-debian TOR_GROUP=debian-tor
CERTBOT_PKG=python-certbot CERTBOT_PKG=python3-certbot-nginx
NGINX_CONFIGURATION=/etc/nginx/nginx.conf NGINX_CONFIGURATION=/etc/nginx/nginx.conf
;; ;;
esac esac
@ -282,7 +282,7 @@ BITCOIN_REPO_URL=https://github.com/bitcoin/bitcoin
BITCOIN_REPO_NAME=bitcoin BITCOIN_REPO_NAME=bitcoin
BITCOIN_REPO_BRANCH=master BITCOIN_REPO_BRANCH=master
#BITCOIN_LATEST_RELEASE=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases/latest|grep tag_name|head -1|cut -d '"' -f4) #BITCOIN_LATEST_RELEASE=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
BITCOIN_LATEST_RELEASE=v22.0 BITCOIN_LATEST_RELEASE=v23.0
echo -n '.' echo -n '.'
BISQ_REPO_URL=https://github.com/bisq-network/bisq BISQ_REPO_URL=https://github.com/bisq-network/bisq
@ -320,19 +320,19 @@ LIQUIDTESTNET_ASSET_REGISTRY_DB_NAME=asset_registry_testnet_db
# packages needed for mempool ecosystem # packages needed for mempool ecosystem
DEBIAN_PKG=() DEBIAN_PKG=()
DEBIAN_PKG+=(zsh vim curl screen openssl python3) DEBIAN_PKG+=(zsh vim curl screen openssl python3 dialog cron)
DEBIAN_PKG+=(build-essential git git-lfs clang cmake jq) DEBIAN_PKG+=(build-essential git git-lfs clang cmake jq)
DEBIAN_PKG+=(autotools-dev autoconf automake pkg-config bsdmainutils) DEBIAN_PKG+=(autotools-dev autoconf automake pkg-config bsdmainutils)
DEBIAN_PKG+=(libevent-dev libdb-dev libssl-dev libtool-dev autotools-dev) DEBIAN_PKG+=(libevent-dev libdb-dev libssl-dev libtool autotools-dev)
DEBIAN_PKG+=(libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev) DEBIAN_PKG+=(libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev)
DEBIAN_PKG+=(nodejs npm mariadb-server nginx-core python-certbot-nginx rsync ufw) DEBIAN_PKG+=(nodejs npm mariadb-server nginx-core python3-certbot-nginx rsync ufw)
# packages needed for mempool ecosystem # packages needed for mempool ecosystem
FREEBSD_PKG=() FREEBSD_PKG=()
FREEBSD_PKG+=(zsh sudo git screen curl wget calc neovim) FREEBSD_PKG+=(zsh sudo git screen curl wget calc neovim)
FREEBSD_PKG+=(openssh-portable py38-pip rust llvm90 jq base64) FREEBSD_PKG+=(openssh-portable py39-pip rust llvm90 jq base64 libzmq4)
FREEBSD_PKG+=(boost-libs autoconf automake gmake gcc libevent libtool pkgconf) FREEBSD_PKG+=(boost-libs autoconf automake gmake gcc libevent libtool pkgconf)
FREEBSD_PKG+=(nginx rsync py38-certbot-nginx mariadb105-server keybase) FREEBSD_PKG+=(nginx rsync py39-certbot-nginx mariadb105-server keybase)
############################# #############################
##### utility functions ##### ##### utility functions #####
@ -403,15 +403,31 @@ osPackageInstallAll()
esac esac
} }
# osUserCreate username home_directory main_groupname [additional_group]
osUserCreate() osUserCreate()
{ {
case $OS in case $OS in
FreeBSD) FreeBSD)
# pw useradd -d /mempool -g mempool -n mempool # pw useradd -d /mempool -g mempool [-G additional_group] -n mampool
osSudo "${ROOT_USER}" pw useradd $* if [ $# -eq 3 ] ; then
osSudo "${ROOT_USER}" pw useradd -d "$2" -g "$3" -n "$1"
elif [ $# -eq 4 ]; then
osSudo "${ROOT_USER}" pw useradd -d "$2" -g "$3" -G "$4" -n "$1"
else
echo "Illegal number of parameters"
exit 1
fi
;; ;;
Debian) Debian)
osSudo "${ROOT_USER}" useradd $* # useradd -d /mempool -g mempool [-G additional_group] mempool
if [ $# -eq 3 ] ; then
osSudo "${ROOT_USER}" useradd -d "$2" -g "$3" "$1"
elif [ $# -eq 4 ]; then
osSudo "${ROOT_USER}" useradd -d "$2" -g "$3" -G "$4" "$1"
else
echo "Illegal number of parameters"
exit 1
fi
;; ;;
esac esac
} }
@ -536,6 +552,86 @@ zfsCreateFilesystems()
fi fi
} }
ext4CreateDir()
{
mkdir -p "/backup" "${ELEMENTS_HOME}" "${BITCOIN_HOME}" "${MINFEE_HOME}" "${ELECTRS_HOME}" "${MEMPOOL_HOME}" "${MYSQL_HOME}" "${BITCOIN_ELECTRS_HOME}" "${ELEMENTS_HOME}/liquidv1" "${ELEMENTS_ELECTRS_HOME}"
# Bitcoin Mainnet
if [ "${BITCOIN_MAINNET_ENABLE}" = ON ];then
for folder in chainstate indexes blocks
do
mkdir -p "${BITCOIN_HOME}/${folder}"
done
fi
# Bitcoin Testnet
if [ "${BITCOIN_TESTNET_ENABLE}" = ON ];then
mkdir -p "${BITCOIN_TESTNET_DATA}"
for folder in chainstate indexes blocks
do
mkdir -p "${BITCOIN_TESTNET_DATA}/${folder}"
done
fi
# Bitcoin Signet
if [ "${BITCOIN_SIGNET_ENABLE}" = ON ];then
mkdir -p "${BITCOIN_SIGNET_DATA}"
for folder in chainstate indexes blocks
do
mkdir -p "${BITCOIN_SIGNET_DATA}/${folder}"
done
fi
# electrs mainnet data
if [ "${BITCOIN_MAINNET_ENABLE}" = ON ];then
mkdir -p "${ELECTRS_MAINNET_DATA}"
for folder in cache history txstore
do
mkdir -p "${ELECTRS_MAINNET_DATA}/newindex/${folder}"
done
fi
# electrs testnet data
if [ "${BITCOIN_TESTNET_ENABLE}" = ON ];then
mkdir -p "${ELECTRS_TESTNET_DATA}"
for folder in cache history txstore
do
mkdir -p "${ELECTRS_TESTNET_DATA}/newindex/${folder}"
done
fi
# electrs signet data
if [ "${BITCOIN_SIGNET_ENABLE}" = ON ];then
mkdir -p "${ELECTRS_SIGNET_DATA}"
for folder in cache history txstore
do
mkdir -p "${ELECTRS_SIGNET_DATA}/newindex/${folder}"
done
fi
# electrs liquid data
if [ "${ELEMENTS_LIQUID_ENABLE}" = ON ];then
mkdir -p "${ELECTRS_LIQUID_DATA}"
for folder in cache history txstore
do
mkdir -p "${ELECTRS_LIQUID_DATA}/newindex/${folder}"
done
fi
# electrs liquidtestnet data
if [ "${ELEMENTS_LIQUIDTESTNET_ENABLE}" = ON ];then
mkdir -p "${ELECTRS_LIQUIDTESTNET_DATA}"
for folder in cache history txstore
do
mkdir -p "${ELECTRS_LIQUIDTESTNET_DATA}/newindex/${folder}"
done
fi
if [ "${BISQ_INSTALL}" = ON ];then
mkdir -p "${BISQ_HOME}"
fi
}
##### Perform sanity checks before trying anything ##### Perform sanity checks before trying anything
# what OS running, what FS partitions, etc. # what OS running, what FS partitions, etc.
@ -683,99 +779,42 @@ HOSTNAME=$(cat $tempfile)
$DIALOG --ok-label "Submit" \ $DIALOG --ok-label "Submit" \
--backtitle "$backtitle" "$@" \ --backtitle "$backtitle" "$@" \
--form "Your fullnode will be installed as follows:" 30 70 0 \ --form "Your fullnode will be installed as follows:" 0 0 0 \
"BISQ_BLOCKNOTIFY_PORT" 1 1 "${BISQ_BLOCKNOTIFY_PORT}" 1 35 35 0 \ "BISQ_LATEST_RELEASE" 1 1 "${BISQ_LATEST_RELEASE}" 1 35 35 0 \
"BISQ_GROUP" 2 1 "${BISQ_GROUP}" 2 35 35 0 \ "BISQ_REPO_BRANCH" 2 1 "${BISQ_REPO_BRANCH}" 2 35 35 0 \
"BISQ_HOME" 3 1 "${BISQ_HOME}" 3 35 35 0 \ "BISQ_REPO_NAME" 3 1 "${BISQ_REPO_NAME}" 3 35 35 0 \
"BISQ_INSTALL" 4 1 "${BISQ_INSTALL}" 4 35 35 0 \ "BISQ_REPO_URL" 4 1 "${BISQ_REPO_URL}" 4 35 35 0 \
"BISQ_LATEST_RELEASE" 5 1 "${BISQ_LATEST_RELEASE}" 5 35 35 0 \ "BITCOIN_ELECTRS_LATEST_RELEASE" 5 1 "${BITCOIN_ELECTRS_LATEST_RELEASE}" 5 35 35 0 \
"BISQ_MAINNET_ENABLE" 6 1 "${BISQ_MAINNET_ENABLE}" 6 35 35 0 \ "BITCOIN_ELECTRS_LIGHT_MODE" 6 1 "${BITCOIN_ELECTRS_LIGHT_MODE}" 6 35 35 0 \
"BISQ_REPO_BRANCH" 7 1 "${BISQ_REPO_BRANCH}" 7 35 35 0 \ "BITCOIN_ELECTRS_REPO_BRANCH" 7 1 "${BITCOIN_ELECTRS_REPO_BRANCH}" 7 35 35 0 \
"BISQ_REPO_NAME" 8 1 "${BISQ_REPO_NAME}" 8 35 35 0 \ "BITCOIN_ELECTRS_REPO_NAME" 8 1 "${BITCOIN_ELECTRS_REPO_NAME}" 8 35 35 0 \
"BISQ_REPO_URL" 9 1 "${BISQ_REPO_URL}" 9 35 35 0 \ "BITCOIN_ELECTRS_REPO_URL" 9 1 "${BITCOIN_ELECTRS_REPO_URL}" 9 35 35 0 \
"BISQ_USER" 10 1 "${BISQ_USER}" 10 35 35 0 \ "BITCOIN_LATEST_RELEASE" 10 1 "${BITCOIN_LATEST_RELEASE}" 10 35 35 0 \
"BITCOIN_ELECTRS_COMPACTION" 11 1 "${BITCOIN_ELECTRS_COMPACTION}" 11 35 35 0 \ "BITCOIN_MAINNET_ENABLE" 11 1 "${BITCOIN_MAINNET_ENABLE}" 11 35 35 0 \
"BITCOIN_ELECTRS_HOME" 12 1 "${BITCOIN_ELECTRS_HOME}" 12 35 35 0 \ "BITCOIN_REPO_BRANCH" 12 1 "${BITCOIN_REPO_BRANCH}" 12 35 35 0 \
"BITCOIN_ELECTRS_LATEST_RELEASE" 13 1 "${BITCOIN_ELECTRS_LATEST_RELEASE}" 13 35 35 0 \ "BITCOIN_REPO_NAME" 13 1 "${BITCOIN_REPO_NAME}" 13 35 35 0 \
"BITCOIN_ELECTRS_LIGHT_MODE" 14 1 "${BITCOIN_ELECTRS_LIGHT_MODE}" 14 35 35 0 \ "BITCOIN_REPO_URL" 14 1 "${BITCOIN_REPO_URL}" 14 35 35 0 \
"BITCOIN_ELECTRS_REPO_BRANCH" 15 1 "${BITCOIN_ELECTRS_REPO_BRANCH}" 15 35 35 0 \ "BITCOIN_TESTNET_ENABLE" 15 1 "${BITCOIN_TESTNET_ENABLE}" 15 35 35 0 \
"BITCOIN_ELECTRS_REPO_NAME" 16 1 "${BITCOIN_ELECTRS_REPO_NAME}" 16 35 35 0 \ "ELEMENTS_INSTALL" 16 1 "${ELEMENTS_INSTALL}" 16 35 35 0 \
"BITCOIN_ELECTRS_REPO_URL" 17 1 "${BITCOIN_ELECTRS_REPO_URL}" 17 35 35 0 \ "ELEMENTS_LATEST_RELEASE" 17 1 "${ELEMENTS_LATEST_RELEASE}" 17 35 35 0 \
"BITCOIN_GROUP" 18 1 "${BITCOIN_GROUP}" 18 35 35 0 \ "ELEMENTS_LIQUID_ENABLE" 18 1 "${ELEMENTS_LIQUID_ENABLE}" 18 35 35 0 \
"BITCOIN_HOME" 19 1 "${BITCOIN_HOME}" 19 35 35 0 \ "ELEMENTS_REPO_BRANCH" 19 1 "${ELEMENTS_REPO_BRANCH}" 19 35 35 0 \
"BITCOIN_INSTALL" 20 1 "${BITCOIN_INSTALL}" 20 35 35 0 \ "ELEMENTS_REPO_NAME" 20 1 "${ELEMENTS_REPO_NAME}" 20 35 35 0 \
"BITCOIN_LATEST_RELEASE" 21 1 "${BITCOIN_LATEST_RELEASE}" 21 35 35 0 \ "ELEMENTS_REPO_URL" 21 1 "${ELEMENTS_REPO_URL}" 21 35 35 0 \
"BITCOIN_MAINNET_ENABLE" 22 1 "${BITCOIN_MAINNET_ENABLE}" 22 35 35 0 \ "MEMPOOL_LATEST_RELEASE" 22 1 "${MEMPOOL_LATEST_RELEASE}" 22 35 35 0 \
"BITCOIN_MAINNET_P2P_HOST" 23 1 "${BITCOIN_MAINNET_P2P_HOST}" 23 35 35 0 \ "MEMPOOL_LIQUID_HTTP_HOST" 23 1 "${MEMPOOL_LIQUID_HTTP_HOST}" 23 35 35 0 \
"BITCOIN_MAINNET_P2P_PORT" 24 1 "${BITCOIN_MAINNET_P2P_PORT}" 24 35 35 0 \ "MEMPOOL_LIQUID_HTTP_PORT" 24 1 "${MEMPOOL_LIQUID_HTTP_PORT}" 24 35 35 0 \
"BITCOIN_MAINNET_RPC_HOST" 25 1 "${BITCOIN_MAINNET_RPC_HOST}" 25 35 35 0 \ "MEMPOOL_MAINNET_HTTP_HOST" 25 1 "${MEMPOOL_MAINNET_HTTP_HOST}" 25 35 35 0 \
"BITCOIN_MAINNET_RPC_PORT" 26 1 "${BITCOIN_MAINNET_RPC_PORT}" 26 35 35 0 \ "MEMPOOL_MAINNET_HTTP_PORT" 26 1 "${MEMPOOL_MAINNET_HTTP_PORT}" 26 35 35 0 \
"BITCOIN_RPC_PASS" 27 1 "${BITCOIN_RPC_PASS}" 27 35 35 0 \ "MEMPOOL_REPO_BRANCH" 27 1 "${MEMPOOL_REPO_BRANCH}" 27 35 35 0 \
"BITCOIN_RPC_USER" 28 1 "${BITCOIN_RPC_USER}" 28 35 35 0 \ "MEMPOOL_REPO_NAME" 28 1 "${MEMPOOL_REPO_NAME}" 28 35 35 0 \
"BITCOIN_REPO_BRANCH" 29 1 "${BITCOIN_REPO_BRANCH}" 29 35 35 0 \ "MEMPOOL_REPO_URL" 29 1 "${MEMPOOL_REPO_URL}" 29 35 35 0 \
"BITCOIN_REPO_NAME" 30 1 "${BITCOIN_REPO_NAME}" 30 35 35 0 \ "MEMPOOL_TESTNET_HTTP_HOST" 30 1 "${MEMPOOL_TESTNET_HTTP_HOST}" 30 35 35 0 \
"BITCOIN_REPO_URL" 31 1 "${BITCOIN_REPO_URL}" 31 35 35 0 \ "MEMPOOL_TESTNET_HTTP_PORT" 31 1 "${MEMPOOL_TESTNET_HTTP_PORT}" 31 35 35 0 \
"BITCOIN_TESTNET_DATA" 32 1 "${BITCOIN_TESTNET_DATA}" 32 35 35 0 \ "MEMPOOL_TOR_HS" 32 1 "${MEMPOOL_TOR_HS}" 32 35 35 0 \
"BITCOIN_TESTNET_ENABLE" 33 1 "${BITCOIN_TESTNET_ENABLE}" 33 35 35 0 \ "HOSTNAME" 33 1 "${HOSTNAME}" 33 35 35 0 \
"BITCOIN_TESTNET_P2P_HOST" 34 1 "${BITCOIN_TESTNET_P2P_HOST}" 34 35 35 0 \ "TOR_INSTALL" 34 1 "${TOR_INSTALL}" 34 35 35 0 \
"BITCOIN_TESTNET_P2P_PORT" 35 1 "${BITCOIN_TESTNET_P2P_PORT}" 35 35 35 0 \ "CERTBOT_INSTALL" 35 1 "${CERTBOT_INSTALL}" 35 35 35 0 \
"BITCOIN_TESTNET_RPC_HOST" 36 1 "${BITCOIN_TESTNET_RPC_HOST}" 36 35 35 0 \
"BITCOIN_TESTNET_RPC_PORT" 38 1 "${BITCOIN_TESTNET_RPC_PORT}" 38 35 35 0 \
"BITCOIN_USER" 40 1 "${BITCOIN_USER}" 40 35 35 0 \
"ELECTRS_DATA_ROOT" 41 1 "${ELECTRS_DATA_ROOT}" 41 35 35 0 \
"ELECTRS_LIQUID_DATA" 42 1 "${ELECTRS_LIQUID_DATA}" 42 35 35 0 \
"ELECTRS_LIQUID_HTTP_HOST" 43 1 "${ELECTRS_LIQUID_HTTP_HOST}" 43 35 35 0 \
"ELECTRS_LIQUID_HTTP_PORT" 44 1 "${ELECTRS_LIQUID_HTTP_PORT}" 44 35 35 0 \
"ELECTRS_LIQUID_ZPOOL" 45 1 "${ELECTRS_LIQUID_ZPOOL}" 45 35 35 0 \
"ELECTRS_MAINNET_DATA" 46 1 "${ELECTRS_MAINNET_DATA}" 46 35 35 0 \
"ELECTRS_MAINNET_HTTP_HOST" 47 1 "${ELECTRS_MAINNET_HTTP_HOST}" 47 35 35 0 \
"ELECTRS_MAINNET_HTTP_PORT" 48 1 "${ELECTRS_MAINNET_HTTP_PORT}" 48 35 35 0 \
"ELECTRS_MAINNET_ZPOOL" 49 1 "${ELECTRS_MAINNET_ZPOOL}" 49 35 35 0 \
"ELECTRS_TESTNET_DATA" 50 1 "${ELECTRS_TESTNET_DATA}" 50 35 35 0 \
"ELECTRS_TESTNET_HTTP_HOST" 51 1 "${ELECTRS_TESTNET_HTTP_HOST}" 51 35 35 0 \
"ELECTRS_TESTNET_HTTP_PORT" 52 1 "${ELECTRS_TESTNET_HTTP_PORT}" 52 35 35 0 \
"ELECTRS_TESTNET_ZPOOL" 53 1 "${ELECTRS_TESTNET_ZPOOL}" 53 35 35 0 \
"ELEMENTS_ELECTRS_COMPACTION" 54 1 "${ELEMENTS_ELECTRS_COMPACTION}" 54 35 35 0 \
"ELEMENTS_ELECTRS_HOME" 55 1 "${ELEMENTS_ELECTRS_HOME}" 55 35 35 0 \
"ELEMENTS_ELECTRS_LATEST_RELEASE" 56 1 "${ELEMENTS_ELECTRS_LATEST_RELEASE}" 56 35 35 0 \
"ELEMENTS_ELECTRS_LIGHT_MODE" 57 1 "${ELEMENTS_ELECTRS_LIGHT_MODE}" 57 35 35 0 \
"ELEMENTS_ELECTRS_REPO_BRANCH" 58 1 "${ELEMENTS_ELECTRS_REPO_BRANCH}" 58 35 35 0 \
"ELEMENTS_ELECTRS_REPO_NAME" 59 1 "${ELEMENTS_ELECTRS_REPO_NAME}" 59 35 35 0 \
"ELEMENTS_ELECTRS_REPO_URL" 60 1 "${ELEMENTS_ELECTRS_REPO_URL}" 60 35 35 0 \
"ELEMENTS_GROUP" 61 1 "${ELEMENTS_GROUP}" 61 35 35 0 \
"ELEMENTS_HOME" 62 1 "${ELEMENTS_HOME}" 62 35 35 0 \
"ELEMENTS_INSTALL" 63 1 "${ELEMENTS_INSTALL}" 63 35 35 0 \
"ELEMENTS_LATEST_RELEASE" 64 1 "${ELEMENTS_LATEST_RELEASE}" 64 35 35 0 \
"ELEMENTS_LIQUID_ENABLE" 65 1 "${ELEMENTS_LIQUID_ENABLE}" 65 35 35 0 \
"ELEMENTS_LIQUID_P2P_HOST" 66 1 "${ELEMENTS_LIQUID_P2P_HOST}" 66 35 35 0 \
"ELEMENTS_LIQUID_P2P_PORT" 67 1 "${ELEMENTS_LIQUID_P2P_PORT}" 67 35 35 0 \
"ELEMENTS_LIQUID_RPC_HOST" 68 1 "${ELEMENTS_LIQUID_RPC_HOST}" 68 35 35 0 \
"ELEMENTS_RPC_PASS" 69 1 "${ELEMENTS_RPC_PASS}" 69 35 35 0 \
"ELEMENTS_LIQUID_RPC_PORT" 70 1 "${ELEMENTS_LIQUID_RPC_PORT}" 70 35 35 0 \
"ELEMENTS_RPC_USER" 71 1 "${ELEMENTS_RPC_USER}" 71 35 35 0 \
"ELEMENTS_REPO_BRANCH" 72 1 "${ELEMENTS_REPO_BRANCH}" 72 35 35 0 \
"ELEMENTS_REPO_NAME" 73 1 "${ELEMENTS_REPO_NAME}" 73 35 35 0 \
"ELEMENTS_REPO_URL" 74 1 "${ELEMENTS_REPO_URL}" 74 35 35 0 \
"ELEMENTS_USER" 75 1 "${ELEMENTS_USER}" 75 35 35 0 \
"MEMPOOL_BISQ_HTTP_HOST" 76 1 "${MEMPOOL_BISQ_HTTP_HOST}" 76 35 35 0 \
"MEMPOOL_BISQ_HTTP_PORT" 77 1 "${MEMPOOL_BISQ_HTTP_PORT}" 77 35 35 0 \
"MEMPOOL_GROUP" 78 1 "${MEMPOOL_GROUP}" 78 35 35 0 \
"MEMPOOL_HOME" 79 1 "${MEMPOOL_HOME}" 79 35 35 0 \
"MEMPOOL_LATEST_RELEASE" 80 1 "${MEMPOOL_LATEST_RELEASE}" 80 35 35 0 \
"MEMPOOL_LIQUID_HTTP_HOST" 81 1 "${MEMPOOL_LIQUID_HTTP_HOST}" 81 35 35 0 \
"MEMPOOL_LIQUID_HTTP_PORT" 82 1 "${MEMPOOL_LIQUID_HTTP_PORT}" 82 35 35 0 \
"MEMPOOL_MAINNET_HTTP_HOST" 83 1 "${MEMPOOL_MAINNET_HTTP_HOST}" 83 35 35 0 \
"MEMPOOL_MAINNET_HTTP_PORT" 84 1 "${MEMPOOL_MAINNET_HTTP_PORT}" 84 35 35 0 \
"MEMPOOL_REPO_BRANCH" 85 1 "${MEMPOOL_REPO_BRANCH}" 85 35 35 0 \
"MEMPOOL_REPO_NAME" 86 1 "${MEMPOOL_REPO_NAME}" 86 35 35 0 \
"MEMPOOL_REPO_URL" 87 1 "${MEMPOOL_REPO_URL}" 87 35 35 0 \
"MEMPOOL_TESTNET_HTTP_HOST" 88 1 "${MEMPOOL_TESTNET_HTTP_HOST}" 88 35 35 0 \
"MEMPOOL_TESTNET_HTTP_PORT" 89 1 "${MEMPOOL_TESTNET_HTTP_PORT}" 89 35 35 0 \
"MEMPOOL_TOR_HS" 90 1 "${MEMPOOL_TOR_HS}" 90 35 35 0 \
"MEMPOOL_USER" 91 1 "${MEMPOOL_USER}" 91 35 35 0 \
"HOSTNAME" 92 1 "${HOSTNAME}" 92 35 35 0 \
"TOR_INSTALL" 93 1 "${TOR_INSTALL}" 93 35 35 0 \
"CERTBOT_INSTALL" 94 1 "${CERTBOT_INSTALL}" 94 35 35 0 \
2> $tempfile 2> $tempfile
retval=$? retval=$?
@ -802,6 +841,9 @@ case $OS in
FreeBSD) FreeBSD)
zfsCreateFilesystems zfsCreateFilesystems
;; ;;
Debian)
ext4CreateDir
;;
esac esac
############################### ###############################
@ -818,7 +860,7 @@ osPackageInstallAll
echo "[*] Creating Mempool user with Tor access" echo "[*] Creating Mempool user with Tor access"
osGroupCreate "${MEMPOOL_GROUP}" osGroupCreate "${MEMPOOL_GROUP}"
osUserCreate -d "${MEMPOOL_HOME}" -g "${MEMPOOL_GROUP}" -n "${MEMPOOL_USER}" osUserCreate "${MEMPOOL_USER}" "${MEMPOOL_HOME}" "${MEMPOOL_GROUP}"
osSudo "${ROOT_USER}" chsh -s `which zsh` "${MEMPOOL_USER}" osSudo "${ROOT_USER}" chsh -s `which zsh` "${MEMPOOL_USER}"
id "${MEMPOOL_USER}" id "${MEMPOOL_USER}"
@ -895,12 +937,12 @@ if [ "${BITCOIN_INSTALL}" = ON ];then
echo "[*] Creating Bitcoin user with Tor access" echo "[*] Creating Bitcoin user with Tor access"
osGroupCreate "${BITCOIN_GROUP}" osGroupCreate "${BITCOIN_GROUP}"
osUserCreate -d "${BITCOIN_HOME}" -g "${BITCOIN_GROUP}" -G "${TOR_GROUP}" -n "${BITCOIN_USER}" osUserCreate "${BITCOIN_USER}" "${BITCOIN_HOME}" "${BITCOIN_GROUP}" "${TOR_GROUP}"
osSudo "${ROOT_USER}" chsh -s `which zsh` "${BITCOIN_USER}" osSudo "${ROOT_USER}" chsh -s `which zsh` "${BITCOIN_USER}"
echo "[*] Creating Bitcoin minfee user with Tor access" echo "[*] Creating Bitcoin minfee user with Tor access"
osGroupCreate "${MINFEE_GROUP}" osGroupCreate "${MINFEE_GROUP}"
osUserCreate -d "${MINFEE_HOME}" -g "${MINFEE_GROUP}" -G "${TOR_GROUP}" -n "${MINFEE_USER}" osUserCreate "${MINFEE_USER}" "${MINFEE_HOME}" "${MINFEE_GROUP}" "${TOR_GROUP}"
osSudo "${ROOT_USER}" chown -R "${MINFEE_USER}:${MINFEE_GROUP}" "${MINFEE_HOME}" osSudo "${ROOT_USER}" chown -R "${MINFEE_USER}:${MINFEE_GROUP}" "${MINFEE_HOME}"
osSudo "${ROOT_USER}" chsh -s `which zsh` "${MINFEE_USER}" osSudo "${ROOT_USER}" chsh -s `which zsh` "${MINFEE_USER}"
osSudo "${MINFEE_USER}" touch "${MINFEE_HOME}/.zshrc" osSudo "${MINFEE_USER}" touch "${MINFEE_HOME}/.zshrc"
@ -934,10 +976,10 @@ if [ "${BITCOIN_INSTALL}" = ON ];then
osSudo "${ROOT_USER}" install -c -o "${MINFEE_USER}" -g "${MINFEE_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/bitcoin.minfee.conf" "${MINFEE_HOME}/bitcoin.conf" osSudo "${ROOT_USER}" install -c -o "${MINFEE_USER}" -g "${MINFEE_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/bitcoin.minfee.conf" "${MINFEE_HOME}/bitcoin.conf"
echo "[*] Installing Bitcoin RPC credentials" echo "[*] Installing Bitcoin RPC credentials"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_HOME}/bitcoin.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_HOME}/bitcoin.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_HOME}/bitcoin.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_HOME}/bitcoin.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${MINFEE_HOME}/bitcoin.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${MINFEE_HOME}/bitcoin.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${MINFEE_HOME}/bitcoin.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${MINFEE_HOME}/bitcoin.conf"
fi fi
######################### #########################
@ -948,7 +990,7 @@ if [ "${ELEMENTS_INSTALL}" = ON ];then
echo "[*] Creating Elements user with Tor access" echo "[*] Creating Elements user with Tor access"
osGroupCreate "${ELEMENTS_GROUP}" osGroupCreate "${ELEMENTS_GROUP}"
osUserCreate -d "${ELEMENTS_HOME}" -g "${ELEMENTS_GROUP}" -G "${TOR_GROUP}" -n "${ELEMENTS_USER}" osUserCreate "${ELEMENTS_USER}" "${ELEMENTS_HOME}" "${ELEMENTS_GROUP}" "${TOR_GROUP}"
osSudo "${ROOT_USER}" chsh -s `which zsh` "${ELEMENTS_USER}" osSudo "${ROOT_USER}" chsh -s `which zsh` "${ELEMENTS_USER}"
echo "[*] Creating Elements data folder" echo "[*] Creating Elements data folder"
@ -976,10 +1018,10 @@ if [ "${ELEMENTS_INSTALL}" = ON ];then
osSudo "${ROOT_USER}" install -c -o "${ELEMENTS_USER}" -g "${ELEMENTS_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/elements.conf" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" install -c -o "${ELEMENTS_USER}" -g "${ELEMENTS_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/elements.conf" "${ELEMENTS_HOME}/elements.conf"
echo "[*] Configuring Elements Liquid RPC credentials in elements.conf" echo "[*] Configuring Elements Liquid RPC credentials in elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf"
fi fi
################################### ###################################
@ -1013,10 +1055,16 @@ esac
echo "[*] Building Bitcoin Electrs release binary" echo "[*] Building Bitcoin Electrs release binary"
osSudo "${BITCOIN_USER}" sh -c "cd ${BITCOIN_ELECTRS_HOME} && cargo run --release --bin electrs -- --version" || true osSudo "${BITCOIN_USER}" sh -c "cd ${BITCOIN_ELECTRS_HOME} && cargo run --release --bin electrs -- --version" || true
echo "[*] Patching Bitcoin Electrs code for FreeBSD" case $OS in
osSudo "${BITCOIN_USER}" sh -c "cd \"${BITCOIN_HOME}/.cargo/registry/src/github.com-1ecc6299db9ec823/sysconf-0.3.4\" && patch -p1 < \"${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/freebsd/sysconf.patch\"" FreeBSD)
osSudo "${BITCOIN_USER}" sh -c "cd \"${BITCOIN_ELECTRS_HOME}/src/new_index/\" && sed -i .bak -e s/Snappy/None/ db.rs && rm db.rs.bak" echo "[*] Patching Bitcoin Electrs code for FreeBSD"
osSudo "${BITCOIN_USER}" sh -c "cd \"${BITCOIN_ELECTRS_HOME}/src/bin/\" && sed -i .bak -e 's/from_secs(5)/from_secs(1)/' electrs.rs && rm electrs.rs.bak" osSudo "${BITCOIN_USER}" sh -c "cd \"${BITCOIN_HOME}/.cargo/registry/src/github.com-1ecc6299db9ec823/sysconf-0.3.4\" && patch -p1 < \"${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/freebsd/sysconf.patch\""
osSudo "${BITCOIN_USER}" sh -c "cd \"${BITCOIN_ELECTRS_HOME}/src/new_index/\" && sed -i.bak -e s/Snappy/None/ db.rs && rm db.rs.bak"
osSudo "${BITCOIN_USER}" sh -c "cd \"${BITCOIN_ELECTRS_HOME}/src/bin/\" && sed -i.bak -e 's/from_secs(5)/from_secs(1)/' electrs.rs && rm electrs.rs.bak"
;;
Debian)
;;
esac
echo "[*] Building Bitcoin Electrs release binary" echo "[*] Building Bitcoin Electrs release binary"
osSudo "${BITCOIN_USER}" sh -c "cd ${BITCOIN_ELECTRS_HOME} && cargo run --release --bin electrs -- --version" osSudo "${BITCOIN_USER}" sh -c "cd ${BITCOIN_ELECTRS_HOME} && cargo run --release --bin electrs -- --version"
@ -1059,8 +1107,14 @@ esac
echo "[*] Building Liquid Electrs release binary" echo "[*] Building Liquid Electrs release binary"
osSudo "${ELEMENTS_USER}" sh -c "cd ${ELEMENTS_ELECTRS_HOME} && cargo run --release --features liquid --bin electrs -- --network liquid --version" || true osSudo "${ELEMENTS_USER}" sh -c "cd ${ELEMENTS_ELECTRS_HOME} && cargo run --release --features liquid --bin electrs -- --network liquid --version" || true
echo "[*] Patching Liquid Electrs code for FreeBSD" case $OS in
osSudo "${ELEMENTS_USER}" sh -c "cd \"${ELEMENTS_HOME}/.cargo/registry/src/github.com-1ecc6299db9ec823/sysconf-0.3.4\" && patch -p1 < \"${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/freebsd/sysconf.patch\"" FreeBSD)
echo "[*] Patching Liquid Electrs code for FreeBSD"
osSudo "${ELEMENTS_USER}" sh -c "cd \"${ELEMENTS_HOME}/.cargo/registry/src/github.com-1ecc6299db9ec823/sysconf-0.3.4\" && patch -p1 < \"${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/freebsd/sysconf.patch\""
;;
Debian)
;;
esac
echo "[*] Building Liquid Electrs release binary" echo "[*] Building Liquid Electrs release binary"
osSudo "${ELEMENTS_USER}" sh -c "cd ${ELEMENTS_ELECTRS_HOME} && cargo run --release --features liquid --bin electrs -- --network liquid --version" || true osSudo "${ELEMENTS_USER}" sh -c "cd ${ELEMENTS_ELECTRS_HOME} && cargo run --release --features liquid --bin electrs -- --network liquid --version" || true
@ -1073,7 +1127,7 @@ if [ "${BISQ_INSTALL}" = ON ];then
echo "[*] Creating Bisq user with Tor access" echo "[*] Creating Bisq user with Tor access"
osGroupCreate "${BISQ_GROUP}" osGroupCreate "${BISQ_GROUP}"
osUserCreate -d "${BISQ_HOME}" -g "${BISQ_GROUP}" -G "${TOR_GROUP}" -n "${BISQ_USER}" osUserCreate "${BISQ_USER}" "${BISQ_HOME}" "${BISQ_GROUP}" "${TOR_GROUP}"
osSudo "${ROOT_USER}" chsh -s `which zsh` "${BISQ_USER}" osSudo "${ROOT_USER}" chsh -s `which zsh` "${BISQ_USER}"
echo "[*] Creating Bisq data folder" echo "[*] Creating Bisq data folder"
@ -1092,8 +1146,8 @@ if [ "${BISQ_INSTALL}" = ON ];then
echo "[*] Cloning Bisq top-level repo" echo "[*] Cloning Bisq top-level repo"
osSudo "${BISQ_USER}" git clone --branch "${BISQ_REPO_BRANCH}" "${BISQ_REPO_URL}" "${BISQ_HOME}/${BISQ_REPO_NAME}" osSudo "${BISQ_USER}" git clone --branch "${BISQ_REPO_BRANCH}" "${BISQ_REPO_URL}" "${BISQ_HOME}/${BISQ_REPO_NAME}"
echo "[*] Installing OpenJDK 10.0.2 from Bisq install_java.sh script" echo "[*] Installing OpenJDK from Bisq install_java_linux.sh script"
osSudo "${ROOT_USER}" "${BISQ_HOME}/${BISQ_REPO_NAME}/scripts/install_java.sh" osSudo "${ROOT_USER}" "${BISQ_HOME}/${BISQ_REPO_NAME}/scripts/install_java_linux.sh"
echo "[*] Checking out Bisq ${BISQ_LATEST_RELEASE}" echo "[*] Checking out Bisq ${BISQ_LATEST_RELEASE}"
osSudo "${BISQ_USER}" sh -c "cd ${BISQ_HOME}/${BISQ_REPO_NAME} && git checkout ${BISQ_LATEST_RELEASE}" osSudo "${BISQ_USER}" sh -c "cd ${BISQ_HOME}/${BISQ_REPO_NAME} && git checkout ${BISQ_LATEST_RELEASE}"
@ -1116,26 +1170,26 @@ if [ "${BISQ_INSTALL}" = ON ];then
Debian) Debian)
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/bisq.service" "${DEBIAN_SERVICE_HOME}/bisq.service" osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/bisq.service" "${DEBIAN_SERVICE_HOME}/bisq.service"
osSudo "${ROOT_USER}" sed -i .orig "s/#Requires=bitcoin.service/Requires=bitcoin.service/" "${DEBIAN_SERVICE_HOME}/bisq.service" osSudo "${ROOT_USER}" sed -i.orig "s/#Requires=bitcoin.service/Requires=bitcoin.service/" "${DEBIAN_SERVICE_HOME}/bisq.service"
osSudo "${ROOT_USER}" sed -i .orig "s/#BindsTo=bitcoin.service/BindsTo=bitcoin.service/" "${DEBIAN_SERVICE_HOME}/bisq.service" osSudo "${ROOT_USER}" sed -i.orig "s/#BindsTo=bitcoin.service/BindsTo=bitcoin.service/" "${DEBIAN_SERVICE_HOME}/bisq.service"
osSudo "${ROOT_USER}" sed -i .orig "s/__BISQ_REPO_NAME__/${BISQ_REPO_NAME}/" "${DEBIAN_SERVICE_HOME}/bisq.service" osSudo "${ROOT_USER}" sed -i.orig "s/__BISQ_REPO_NAME__/${BISQ_REPO_NAME}/" "${DEBIAN_SERVICE_HOME}/bisq.service"
osSudo "${ROOT_USER}" sed -i .orig "s!__BISQ_HOME__!${BISQ_HOME}!" "${DEBIAN_SERVICE_HOME}/bisq.service" osSudo "${ROOT_USER}" sed -i.orig "s!__BISQ_HOME__!${BISQ_HOME}!" "${DEBIAN_SERVICE_HOME}/bisq.service"
echo "[*] Installing Bisq environment file" echo "[*] Installing Bisq environment file"
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/bisq.env" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/bisq.env" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s!__BISQ_APP_NAME__!${BISQ_APP_NAME}!" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s!__BISQ_APP_NAME__!${BISQ_APP_NAME}!" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s!__BISQ_HOME__!${BISQ_HOME}!" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s!__BISQ_HOME__!${BISQ_HOME}!" "${DEBIAN_ENV_HOME}/bisq.env"
echo "[*] Configuring Bisq environment file with Bitcoin RPC credentials" echo "[*] Configuring Bisq environment file with Bitcoin RPC credentials"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_P2P_HOST__/${BITCOIN_MAINNET_P2P_HOST}/" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_P2P_HOST__/${BITCOIN_MAINNET_P2P_HOST}/" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_P2P_PORT__/${BITCOIN_MAINNET_P2P_PORT}/" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_P2P_PORT__/${BITCOIN_MAINNET_P2P_PORT}/" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_HOST__/${BITCOIN_MAINNET_RPC_HOST}/" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_HOST__/${BITCOIN_MAINNET_RPC_HOST}/" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PORT__/${BITCOIN_MAINNET_RPC_PORT}/" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PORT__/${BITCOIN_MAINNET_RPC_PORT}/" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${DEBIAN_ENV_HOME}/bisq.env"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${DEBIAN_ENV_HOME}/bisq.env" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${DEBIAN_ENV_HOME}/bisq.env"
#echo "[*] Updating Bitcoin configuration for Bisq" #echo "[*] Updating Bitcoin configuration for Bisq"
#osSudo "${ROOT_USER}" sed -i .orig "s/#blocknotify/blocknotify/" "${BITCOIN_HOME}/bitcoin.conf" #osSudo "${ROOT_USER}" sed -i.orig "s/#blocknotify/blocknotify/" "${BITCOIN_HOME}/bitcoin.conf"
#osSudo "${BITCOIN_USER}" install -c -o "${BITCOIN_USER}" -g "${BITCOIN_GROUP}" -m 755 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/blocknotify.sh" "${BITCOIN_HOME}/blocknotify.sh" #osSudo "${BITCOIN_USER}" install -c -o "${BITCOIN_USER}" -g "${BITCOIN_GROUP}" -m 755 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/blocknotify.sh" "${BITCOIN_HOME}/blocknotify.sh"
;; ;;
@ -1155,7 +1209,61 @@ if [ "${BITCOIN_MAINNET_ENABLE}" = ON ];then
;; ;;
Debian) Debian)
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/bitcoin-mainnet.service" "${DEBIAN_SERVICE_HOME}" osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/linux/bitcoin.service" "${DEBIAN_SERVICE_HOME}"
;;
esac
fi
################################
# Bitcoin instance for Testnet #
################################
if [ "${BITCOIN_TESTNET_ENABLE}" = ON ];then
echo "[*] Installing Bitcoin Testnet service"
case $OS in
FreeBSD)
echo "[*] FIXME: Bitcoin Testnet service must be installed manually on FreeBSD"
;;
Debian)
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/linux/bitcoin-testnet.service" "${DEBIAN_SERVICE_HOME}"
;;
esac
fi
###############################
# Bitcoin instance for Signet #
###############################
if [ "${BITCOIN_SIGNET_ENABLE}" = ON ];then
echo "[*] Installing Bitcoin Signet service"
case $OS in
FreeBSD)
echo "[*] FIXME: Bitcoin Signet service must be installed manually on FreeBSD"
;;
Debian)
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/linux/bitcoin-signet.service" "${DEBIAN_SERVICE_HOME}"
;;
esac
fi
###############################
# Bitcoin instance for Liquid #
###############################
if [ "${ELEMENTS_LIQUID_ENABLE}" = ON ];then
echo "[*] Installing Bitcoin Liquid service"
case $OS in
FreeBSD)
echo "[*] FIXME: Bitcoin Liquid service must be installed manually on FreeBSD"
;;
Debian)
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/linux/liquid.service" "${DEBIAN_SERVICE_HOME}"
;; ;;
esac esac
fi fi
@ -1174,9 +1282,9 @@ if [ "${BITCOIN_MAINNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" crontab -u "${MINFEE_USER}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/minfee.crontab" osSudo "${ROOT_USER}" crontab -u "${MINFEE_USER}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/minfee.crontab"
echo "[*] Configuring Bitcoin Mainnet RPC credentials in electrs start script" echo "[*] Configuring Bitcoin Mainnet RPC credentials in electrs start script"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-mainnet" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-mainnet"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-mainnet" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-mainnet"
osSudo "${ROOT_USER}" sed -i .orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${BITCOIN_ELECTRS_HOME}/electrs-start-mainnet" osSudo "${ROOT_USER}" sed -i.orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${BITCOIN_ELECTRS_HOME}/electrs-start-mainnet"
fi fi
######################################## ########################################
@ -1188,9 +1296,9 @@ if [ "${BITCOIN_TESTNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" install -c -o "${BITCOIN_USER}" -g "${BITCOIN_GROUP}" -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/electrs-start-testnet" "${BITCOIN_ELECTRS_HOME}" osSudo "${ROOT_USER}" install -c -o "${BITCOIN_USER}" -g "${BITCOIN_GROUP}" -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/electrs-start-testnet" "${BITCOIN_ELECTRS_HOME}"
echo "[*] Configuring Bitcoin Testnet RPC credentials in electrs start script" echo "[*] Configuring Bitcoin Testnet RPC credentials in electrs start script"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-testnet" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-testnet"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-testnet" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-testnet"
osSudo "${ROOT_USER}" sed -i .orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${BITCOIN_ELECTRS_HOME}/electrs-start-testnet" osSudo "${ROOT_USER}" sed -i.orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${BITCOIN_ELECTRS_HOME}/electrs-start-testnet"
fi fi
####################################### #######################################
@ -1202,9 +1310,9 @@ if [ "${BITCOIN_SIGNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" install -c -o "${BITCOIN_USER}" -g "${BITCOIN_GROUP}" -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/electrs-start-signet" "${BITCOIN_ELECTRS_HOME}" osSudo "${ROOT_USER}" install -c -o "${BITCOIN_USER}" -g "${BITCOIN_GROUP}" -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/electrs-start-signet" "${BITCOIN_ELECTRS_HOME}"
echo "[*] Configuring Bitcoin Signet RPC credentials in electrs start script" echo "[*] Configuring Bitcoin Signet RPC credentials in electrs start script"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-signet" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-signet"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-signet" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${BITCOIN_ELECTRS_HOME}/electrs-start-signet"
osSudo "${ROOT_USER}" sed -i .orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${BITCOIN_ELECTRS_HOME}/electrs-start-signet" osSudo "${ROOT_USER}" sed -i.orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${BITCOIN_ELECTRS_HOME}/electrs-start-signet"
fi fi
######################################## ########################################
@ -1220,9 +1328,9 @@ if [ "${ELEMENTS_LIQUID_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" crontab -u "${ELEMENTS_USER}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/elements.crontab" osSudo "${ROOT_USER}" crontab -u "${ELEMENTS_USER}" "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/elements.crontab"
echo "[*] Configuring Elements Liquid RPC credentials in electrs start script" echo "[*] Configuring Elements Liquid RPC credentials in electrs start script"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquid" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquid"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquid" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquid"
osSudo "${ROOT_USER}" sed -i .orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquid" osSudo "${ROOT_USER}" sed -i.orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquid"
fi fi
################################################ ################################################
@ -1234,15 +1342,15 @@ if [ "${ELEMENTS_LIQUIDTESTNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" install -c -o "${ELEMENTS_USER}" -g "${ELEMENTS_GROUP}" -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/electrs-start-liquidtestnet" "${ELEMENTS_ELECTRS_HOME}" osSudo "${ROOT_USER}" install -c -o "${ELEMENTS_USER}" -g "${ELEMENTS_GROUP}" -m 755 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/electrs-start-liquidtestnet" "${ELEMENTS_ELECTRS_HOME}"
echo "[*] Installing Elements Liquid Testnet RPC credentials" echo "[*] Installing Elements Liquid Testnet RPC credentials"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_HOME}/elements.conf"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_HOME}/elements.conf"
echo "[*] Configuring Elements LiquidTestnet RPC credentials in electrs start script" echo "[*] Configuring Elements LiquidTestnet RPC credentials in electrs start script"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquidtestnet" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_USER__/${ELEMENTS_RPC_USER}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquidtestnet"
osSudo "${ROOT_USER}" sed -i .orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquidtestnet" osSudo "${ROOT_USER}" sed -i.orig "s/__ELEMENTS_RPC_PASS__/${ELEMENTS_RPC_PASS}/" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquidtestnet"
osSudo "${ROOT_USER}" sed -i .orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquidtestnet" osSudo "${ROOT_USER}" sed -i.orig "s!__ELECTRS_DATA_ROOT__!${ELECTRS_DATA_ROOT}!" "${ELEMENTS_ELECTRS_HOME}/electrs-start-liquidtestnet"
fi fi
##################################### #####################################
@ -1351,7 +1459,7 @@ case $OS in
;; ;;
Debian) Debian)
osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/nginx.conf" "${NGINX_CONFIGURATION}" osSudo "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/nginx/nginx.conf" "${NGINX_CONFIGURATION}"
#echo "[*] Restarting Nginx" #echo "[*] Restarting Nginx"
#osSudo "${ROOT_USER}" service nginx restart #osSudo "${ROOT_USER}" service nginx restart
;; ;;
@ -1372,21 +1480,22 @@ case $OS in
fi fi
if [ "${BITCOIN_MAINNET_ENABLE}" = ON ];then if [ "${BITCOIN_MAINNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" systemctl enable bitcoin.service osSudo "${ROOT_USER}" systemctl enable bitcoin.service
osSudo "${ROOT_USER}" systemctl enable electrs.service
osSudo "${ROOT_USER}" systemctl enable mempool.service osSudo "${ROOT_USER}" systemctl enable mempool.service
fi fi
if [ "${BITCOIN_TESTNET_ENABLE}" = ON ];then if [ "${BITCOIN_TESTNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" systemctl enable bitcoin-testnet.service osSudo "${ROOT_USER}" systemctl enable bitcoin-testnet.service
osSudo "${ROOT_USER}" systemctl enable electrs-testnet.service
osSudo "${ROOT_USER}" systemctl enable mempool-testnet.service osSudo "${ROOT_USER}" systemctl enable mempool-testnet.service
fi fi
if [ "${BITCOIN_SIGNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" systemctl enable bitcoin-signet.service
osSudo "${ROOT_USER}" systemctl enable mempool-signet.service
fi
if [ "${BISQ_MAINNET_ENABLE}" = ON ];then if [ "${BISQ_MAINNET_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" systemctl enable bisq.service osSudo "${ROOT_USER}" systemctl enable bisq.service
osSudo "${ROOT_USER}" systemctl enable mempool-bisq.service osSudo "${ROOT_USER}" systemctl enable mempool-bisq.service
fi fi
if [ "${ELEMENTS_LIQUID_ENABLE}" = ON ];then if [ "${ELEMENTS_LIQUID_ENABLE}" = ON ];then
osSudo "${ROOT_USER}" systemctl enable liquid.service osSudo "${ROOT_USER}" systemctl enable liquid.service
osSudo "${ROOT_USER}" systemctl enable electrs-liquid.service
osSudo "${ROOT_USER}" systemctl enable mempool-liquid.service osSudo "${ROOT_USER}" systemctl enable mempool-liquid.service
fi fi
;; ;;

View File

@ -0,0 +1,22 @@
[Unit]
Description=Bitcoind-signet
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -conf=bitcoin-signet.conf -daemon -signet -printtoconsole -pid=/bitcoin/bitcoind-signet.pid
ExecStop=/usr/local/bin/bitcoin-cli -signet stop
Type=forking
PIDFile=/bitcoin/bitcoind-signet.pid
Restart=on-failure
User=bitcoin
Group=bitcoin
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,22 @@
[Unit]
Description=Bitcoind-testnet
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -conf=bitcoin-testnet.conf -daemon -testnet -printtoconsole -pid=/bitcoin/bitcoind-testnet.pid
ExecStop=/usr/local/bin/bitcoin-cli -testnet stop
Type=forking
PIDFile=/bitcoin/bitcoind-testnet.pid
Restart=on-failure
User=bitcoin
Group=bitcoin
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,22 @@
[Unit]
Description=Bitcoind
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -daemon -printtoconsole -pid=/bitcoin/bitcoind.pid
ExecStop=/usr/local/bin/bitcoin-cli stop
Type=forking
PIDFile=/bitcoin/bitcoind.pid
Restart=on-failure
User=bitcoin
Group=bitcoin
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,22 @@
[Unit]
Description=Liquid
After=network.target
[Service]
ExecStart=/usr/local/bin/elementsd -daemon -printtoconsole -pid=/liquid/liquid.pid
ExecStop=/usr/local/bin/elements-cli stop
Type=forking
PIDFile=/liquid/liquid.pid
Restart=on-failure
User=liquid
Group=liquid
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target