From d3cd7354119eef36591d9389cf4a34993f960267 Mon Sep 17 00:00:00 2001 From: Andre Neves Date: Sun, 8 Sep 2019 13:37:07 -0400 Subject: [PATCH 1/2] chore(docs): Update README docs for more clarity chore(packagejson): clean up and standardize data inside package json - author taken from MIT license details chore(spacing): move tsconfig json to follow codebase standard indentation setup --- README.md | 211 +++++++++++++++++++++++------------------- backend/package.json | 12 ++- backend/tsconfig.json | 34 +++---- frontend/package.json | 11 ++- 4 files changed, 148 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index 1458651b0..af8d2c1f5 100644 --- a/README.md +++ b/README.md @@ -1,155 +1,174 @@ # mempool.space -🚨This is beta software, and may have issues!🚨 +🚨This is beta software, and may have issues!🚨 Please help us test and report bugs to our GitHub issue tracker. Mempool visualizer for the Bitcoin blockchain. Live demo: https://mempool.space/ ![blockchain](https://pbs.twimg.com/media/EAETXWAU8AAj4IP?format=jpg&name=4096x4096) ![mempool](https://pbs.twimg.com/media/EAETXWCU4AAv2v-?format=jpg&name=4096x4096) -## deps +## Dependencies * Bitcoin (full node required, no pruning, txindex=1) * NodeJS (official stable LTS) * MySQL or MariaDB (default config) * Nginx (use supplied nginx.conf) -## nodejs - -Install dependencies and build code: -``` -cd mempool.space -npm install -g typescript -cd frontend -npm install -cd ../backend/ -npm install -tsc -``` - -## bitcoind +## Bitcoin Core (bitcoind) Enable RPC and txindex in bitcoin.conf -``` -rpcuser=mempool -rpcpassword=71b61986da5b03a5694d7c7d5165ece5 -txindex=1 + +```bash + rpcuser=mempool + rpcpassword=71b61986da5b03a5694d7c7d5165ece5 + txindex=1 ``` -## mempool config -Make a copy of the sample config and edit it -``` -cp mempool-config.sample.json mempool-config.json +## NodeJS + +Install dependencies and build code: + +```bash + cd mempool.space + + # Install TypeScript Globally + npm install -g typescript + + # Frontend + cd frontend + npm install + npm run build + + # Backend + cd ../backend/ + npm install + npm run build ``` -Edit mempool-config.json to add your Bitcoin node RPC credentials: +## Mempool Configuration +In the `backend` folder, make a copy of the sample config and modify it to fit your settings. + +```bash + cp mempool-config.sample.json mempool-config.json ``` + +Edit `mempool-config.json` to add your Bitcoin Core node RPC credentials: +```bash "BITCOIN_NODE_HOST": "192.168.1.5", "BITCOIN_NODE_PORT": 8332, "BITCOIN_NODE_USER": "mempool", "BITCOIN_NODE_PASS": "71b61986da5b03a5694d7c7d5165ece5", ``` -## mysql +## MySQL -Install MariaDB: -``` -apt-get install mariadb-server mariadb-client +#Install MariaDB: + +```bash + # Linux + apt-get install mariadb-server mariadb-client + + # macOS + brew install mariadb + brew services start mariadb ``` Create database and grant privileges: -``` -MariaDB [(none)]> drop database mempool; -Query OK, 0 rows affected (0.00 sec) +```bash + MariaDB [(none)]> drop database mempool; + Query OK, 0 rows affected (0.00 sec) -MariaDB [(none)]> create database mempool; -Query OK, 1 row affected (0.00 sec) + MariaDB [(none)]> create database mempool; + Query OK, 1 row affected (0.00 sec) -MariaDB [(none)]> grant all privileges on mempool.* to 'mempool' identified by 'mempool'; -Query OK, 0 rows affected (0.00 sec) + MariaDB [(none)]> grant all privileges on mempool.* to 'mempool' identified by 'mempool'; + Query OK, 0 rows affected (0.00 sec) ``` -Initialize database structure: -``` -mysql -u mempool -p mempool < mariadb-structure.sql +From the root folder, initialize database structure: + +```bash + mysql -u mempool -p mempool < mariadb-structure.sql ``` -## mempool backend +## Running (Backend) Create an initial empty cache and start the app: -``` -touch cache.json -node dist/index.js + +```bash + touch cache.json + npm run start # node dist/index.js ``` After starting you should see: -``` -Server started on port 8999 :) -New block found (#586498)! 0 of 1986 found in mempool. 1985 not found. -New block found (#586499)! 0 of 1094 found in mempool. 1093 not found. -New block found (#586500)! 0 of 2735 found in mempool. 2734 not found. -New block found (#586501)! 0 of 2675 found in mempool. 2674 not found. -New block found (#586502)! 0 of 975 found in mempool. 974 not found. -New block found (#586503)! 0 of 2130 found in mempool. 2129 not found. -New block found (#586504)! 0 of 2770 found in mempool. 2769 not found. -New block found (#586505)! 0 of 2759 found in mempool. 2758 not found. -Updating mempool -Calculated fee for transaction 1 / 3257 -Calculated fee for transaction 2 / 3257 -Calculated fee for transaction 3 / 3257 -Calculated fee for transaction 4 / 3257 -Calculated fee for transaction 5 / 3257 -Calculated fee for transaction 6 / 3257 -Calculated fee for transaction 7 / 3257 -Calculated fee for transaction 8 / 3257 -Calculated fee for transaction 9 / 3257 -``` -You need to wait for 8 blocks to be mined, so please wait ~80 minutes. +```bash + Server started on port 8999 :) + New block found (#586498)! 0 of 1986 found in mempool. 1985 not found. + New block found (#586499)! 0 of 1094 found in mempool. 1093 not found. + New block found (#586500)! 0 of 2735 found in mempool. 2734 not found. + New block found (#586501)! 0 of 2675 found in mempool. 2674 not found. + New block found (#586502)! 0 of 975 found in mempool. 974 not found. + New block found (#586503)! 0 of 2130 found in mempool. 2129 not found. + New block found (#586504)! 0 of 2770 found in mempool. 2769 not found. + New block found (#586505)! 0 of 2759 found in mempool. 2758 not found. + Updating mempool + Calculated fee for transaction 1 / 3257 + Calculated fee for transaction 2 / 3257 + Calculated fee for transaction 3 / 3257 + Calculated fee for transaction 4 / 3257 + Calculated fee for transaction 5 / 3257 + Calculated fee for transaction 6 / 3257 + Calculated fee for transaction 7 / 3257 + Calculated fee for transaction 8 / 3257 + Calculated fee for transaction 9 / 3257 +``` +You need to wait for at least *8 blocks to be mined*, so please wait ~80 minutes. The backend also needs to index transactions, calculate fees, etc. When it's ready you will see output like this: -``` -Mempool updated in 0.189 seconds -Updating mempool -Mempool updated in 0.096 seconds -Updating mempool -Mempool updated in 0.099 seconds -Updating mempool -Calculated fee for transaction 1 / 10 -Calculated fee for transaction 2 / 10 -Calculated fee for transaction 3 / 10 -Calculated fee for transaction 4 / 10 -Calculated fee for transaction 5 / 10 -Calculated fee for transaction 6 / 10 -Calculated fee for transaction 7 / 10 -Calculated fee for transaction 8 / 10 -Calculated fee for transaction 9 / 10 -Calculated fee for transaction 10 / 10 -Mempool updated in 0.243 seconds -Updating mempool +```bash + Mempool updated in 0.189 seconds + Updating mempool + Mempool updated in 0.096 seconds + Updating mempool + Mempool updated in 0.099 seconds + Updating mempool + Calculated fee for transaction 1 / 10 + Calculated fee for transaction 2 / 10 + Calculated fee for transaction 3 / 10 + Calculated fee for transaction 4 / 10 + Calculated fee for transaction 5 / 10 + Calculated fee for transaction 6 / 10 + Calculated fee for transaction 7 / 10 + Calculated fee for transaction 8 / 10 + Calculated fee for transaction 9 / 10 + Calculated fee for transaction 10 / 10 + Mempool updated in 0.243 seconds + Updating mempool ``` -## nginx + certbot (let's encrypt) -Setup nginx using the supplied nginx.conf, replacing example.com with your domain name. -``` -apt-get install -y nginx python-certbot-nginx -cp nginx.conf /etc/nginx/nginx.conf -certbot -d example.com # replace with your domain name +## nginx + CertBot (LetsEncrypt) +Setup nginx using the supplied nginx.conf, replacing `example.com` with your domain name. + +```bash + apt-get install -y nginx python-certbot-nginx + cp nginx.conf /etc/nginx/nginx.conf + certbot -d example.com # replace with your domain name ``` Make sure you can access https://example.com/ in browser before proceeding -## mempool frontend +## Running (Frontend) Build the frontend static HTML/CSS/JS, rsync the output into nginx folder: -``` -cd frontend/ -npm run build -sudo rsync -av --delete dist/mempool/ /var/www/html/ +```bash + cd frontend/ + npm run build + sudo rsync -av --delete dist/mempool/ /var/www/html/ ``` -## try it out +## Try It Out If everything went okay you should see the beautiful mempool :grin: diff --git a/backend/package.json b/backend/package.json index 2a3e39e6a..533d13fd8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,13 +1,17 @@ { "name": "mempool-backend", "version": "1.0.0", - "description": "Bitcoin mempool visualizer", + "description": "Bitcoin Mempool Visualizer", "main": "index.ts", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "tsc", + "start": "npm run build && node dist/index.js" }, - "author": "", - "license": "ISC", + "author": { + "name": "Simon Lindh", + "url": "https://github.com/mempool-space/mempool.space" + }, + "license": "MIT", "dependencies": { "bitcoin": "^3.0.1", "compression": "^1.7.3", diff --git a/backend/tsconfig.json b/backend/tsconfig.json index fb1b48c6e..9b3cb6248 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -1,20 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es2015", - "strict": true, - "noImplicitAny": false, - "sourceMap": false, - "outDir": "dist", - "moduleResolution": "node", - "typeRoots": [ - "node_modules/@types" - ] - }, - "include": [ - "src/**/*.ts", - ], - "exclude": [ - "dist/**" + "compilerOptions": { + "module": "commonjs", + "target": "es2015", + "strict": true, + "noImplicitAny": false, + "sourceMap": false, + "outDir": "dist", + "moduleResolution": "node", + "typeRoots": [ + "node_modules/@types" ] + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "dist/**" + ] } \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 9d8d6dfdc..971d9c292 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,7 @@ { - "name": "mempool", - "version": "0.0.0", + "name": "mempool-frontend", + "version": "1.0.0", + "description": "Bitcoin Mempool Visualizer", "scripts": { "ng": "ng", "start": "ng serve --aot --proxy-config proxy.conf.json", @@ -9,7 +10,11 @@ "lint": "ng lint", "e2e": "ng e2e" }, - "private": true, + "author": { + "name": "Simon Lindh", + "url": "https://github.com/mempool-space/mempool.space" + }, + "license": "MIT", "dependencies": { "@angular/animations": "^8.0.0", "@angular/common": "^8.0.0", From 7b4732ba6e1c2164c76610112098af5ee79ebd77 Mon Sep 17 00:00:00 2001 From: Andre Neves Date: Sun, 8 Sep 2019 13:41:28 -0400 Subject: [PATCH 2/2] hotfix(docs): remove extraneous hash --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af8d2c1f5..65c21185f 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Edit `mempool-config.json` to add your Bitcoin Core node RPC credentials: ## MySQL -#Install MariaDB: +Install MariaDB: ```bash # Linux