From b0593b4349eed68b290ee15f724754a2fc0456f4 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Mon, 16 Apr 2018 17:33:19 -0500 Subject: [PATCH 01/20] Fixes --- btcp_store_demo.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index b5552b3..5974524 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -38,7 +38,15 @@ cd $PREV clone_and_build_btcp() { # Clone latest Bitcoin Private source, and checkout explorer-btcp -git clone -b explorer-btcp https://github.com/BTCPrivate/BitcoinPrivate +if [ ! -e ~/BitcoinPrivate ] +then + git clone -b explorer-btcp https://github.com/BTCPrivate/BitcoinPrivate +fi + +# Freshen up +#git checkout explorer-btcp +#git checkout -- . +#git pull # Fetch BTCP/Zcash ceremony params ./BitcoinPrivate/btcputil/fetch-params.sh @@ -92,6 +100,8 @@ sudo mkdir -p /data/db install_bitcore() { +cd ~ + # Install Bitcore (Headless) npm install BTCPrivate/bitcore-node-btcp @@ -161,7 +171,7 @@ esac install_nvm_npm -#install_mongodb +install_mongodb install_bitcore From e4c910b7c6260531337e0cca2b71e1f3868a1b64 Mon Sep 17 00:00:00 2001 From: J62 Date: Fri, 13 Apr 2018 08:46:39 -0700 Subject: [PATCH 02/20] added blockchain download and extract --- btcp_store_demo.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 5974524..3c955f7 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -54,12 +54,26 @@ fi # Build Bitcoin Private ./BitcoinPrivate/btcputil/build.sh -j$(nproc) +#Make +if [ ! -e ~/.btcprivate/ ] +then + echo "does not exist, creating folder" + mkdir ~/.btcprivate +fi + echo "folder does exist..copying files" + +wget https://storage.googleapis.com/btcp-blockchain/BTCprivate.7z +sudo apt install p7zip-full +7z x BTCprivate.7z + # Make initial, empty btcprivate.conf if needed if [ ! -e ~/.btcprivate/btcprivate.conf ] then touch ~/.btcprivate/btcprivate.conf fi + + } install_nvm_npm() { @@ -169,11 +183,11 @@ case "$response" in esac -install_nvm_npm +##install_nvm_npm install_mongodb -install_bitcore +##install_bitcore echo "Complete." echo "" From d14d77482c52c92a04b64514931b4285ae5fb8ed Mon Sep 17 00:00:00 2001 From: J62 Date: Fri, 13 Apr 2018 08:47:41 -0700 Subject: [PATCH 03/20] removed commented out lines for testing --- btcp_store_demo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 3c955f7..d2896df 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -183,11 +183,11 @@ case "$response" in esac -##install_nvm_npm +install_nvm_npm install_mongodb -##install_bitcore +install_bitcore echo "Complete." echo "" From 6489c48aee887068523d4f762599b7f0b1d23934 Mon Sep 17 00:00:00 2001 From: J62 Date: Fri, 13 Apr 2018 08:51:30 -0700 Subject: [PATCH 04/20] expanded on comments --- btcp_store_demo.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index d2896df..e682bf8 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -54,17 +54,19 @@ fi # Build Bitcoin Private ./BitcoinPrivate/btcputil/build.sh -j$(nproc) -#Make +#Make hidden .btcprivate dir because the daemon has not ran and created the folder yet +#Then download the blockchain zip and extract to speed up the initial syncing when first starting if [ ! -e ~/.btcprivate/ ] then - echo "does not exist, creating folder" + echo "Bitcoin Private Data Dir(.btcprivate) does not exist in the current user home directory, creating folder..." mkdir ~/.btcprivate fi - echo "folder does exist..copying files" + echo "Bitcoin Private Data Dir(.btcprivate) does exist in the current user home directory. Downloading and Extracting files" wget https://storage.googleapis.com/btcp-blockchain/BTCprivate.7z sudo apt install p7zip-full 7z x BTCprivate.7z + echo "Downloading and extracting of blockchain files completed" # Make initial, empty btcprivate.conf if needed if [ ! -e ~/.btcprivate/btcprivate.conf ] From 958907def06becb9aec951f752720f1209eac0c4 Mon Sep 17 00:00:00 2001 From: J62 Date: Fri, 13 Apr 2018 10:49:40 -0700 Subject: [PATCH 05/20] update blockchain download url and remove 7z --- btcp_store_demo.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index e682bf8..af8a06f 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -61,12 +61,11 @@ then echo "Bitcoin Private Data Dir(.btcprivate) does not exist in the current user home directory, creating folder..." mkdir ~/.btcprivate fi - echo "Bitcoin Private Data Dir(.btcprivate) does exist in the current user home directory. Downloading and Extracting files" - -wget https://storage.googleapis.com/btcp-blockchain/BTCprivate.7z -sudo apt install p7zip-full -7z x BTCprivate.7z - echo "Downloading and extracting of blockchain files completed" +echo "Bitcoin Private Data Dir(.btcprivate) does exist in the current user home directory. Downloading and Extracting files" +cd ~/.btcprivate +wget https://storage.googleapis.com/btcpblockchain/blockchain.tar.gz +tar -zxvf blockchain.tar.gz +echo "Downloading and extracting of blockchain files completed" # Make initial, empty btcprivate.conf if needed if [ ! -e ~/.btcprivate/btcprivate.conf ] From be5b95bc9ba7e96fc9ddc43db1b598abfcf33273 Mon Sep 17 00:00:00 2001 From: J62 Date: Fri, 13 Apr 2018 11:19:29 -0700 Subject: [PATCH 06/20] Update btcp_store_demo.sh --- btcp_store_demo.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index af8a06f..a2b1462 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -55,12 +55,13 @@ fi ./BitcoinPrivate/btcputil/build.sh -j$(nproc) #Make hidden .btcprivate dir because the daemon has not ran and created the folder yet -#Then download the blockchain zip and extract to speed up the initial syncing when first starting if [ ! -e ~/.btcprivate/ ] then echo "Bitcoin Private Data Dir(.btcprivate) does not exist in the current user home directory, creating folder..." mkdir ~/.btcprivate fi + +#Then download the blockchain.tar.gz and extract to speed up the initial syncing when first starting echo "Bitcoin Private Data Dir(.btcprivate) does exist in the current user home directory. Downloading and Extracting files" cd ~/.btcprivate wget https://storage.googleapis.com/btcpblockchain/blockchain.tar.gz From 48190adfb81e63a6c21147253fbb43438d605471 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 18 Apr 2018 03:00:03 +0000 Subject: [PATCH 07/20] Fetch prebuilt btcpd, modularize --- btcp_store_demo.sh | 105 ++++++++++++++++++++++++++++++++------------- 1 file changed, 75 insertions(+), 30 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index a2b1462..7c50e0e 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -1,7 +1,5 @@ #!/bin/bash -# BTCP Bitcore API + Explorer + Store / AddressWatch Demo - # !!! EC2 - Make sure port 8001 is in your security group install_ubuntu() { @@ -19,12 +17,11 @@ sudo apt-get -y install libzmq3-dev } - make_swapfile() { -# You must have enough memory for the installation to succeed. +# You must have enough memory for the BTCP build to succeed. -PREV=$PWD +local PREV=$PWD cd / sudo dd if=/dev/zero of=swapfile bs=1M count=3000 sudo mkswap swapfile @@ -35,6 +32,24 @@ cd $PREV } + +prompt_swapfile() { + +echo "" +echo "Can we make you a 3gb swapfile? EC2 Micro needs it because it takes a lot of memory to build BTCP." +echo "" +read -r -p "[y/N] " response +case "$response" in + [yY][eE][sS]|[yY]) + make_swapfile + ;; + *) + echo "Not creating swapfile." + ;; +esac + +} + clone_and_build_btcp() { # Clone latest Bitcoin Private source, and checkout explorer-btcp @@ -54,32 +69,51 @@ fi # Build Bitcoin Private ./BitcoinPrivate/btcputil/build.sh -j$(nproc) -#Make hidden .btcprivate dir because the daemon has not ran and created the folder yet +# Make .btcprivate dir (btcpd hasn't been run) if [ ! -e ~/.btcprivate/ ] then - echo "Bitcoin Private Data Dir(.btcprivate) does not exist in the current user home directory, creating folder..." mkdir ~/.btcprivate fi -#Then download the blockchain.tar.gz and extract to speed up the initial syncing when first starting -echo "Bitcoin Private Data Dir(.btcprivate) does exist in the current user home directory. Downloading and Extracting files" -cd ~/.btcprivate -wget https://storage.googleapis.com/btcpblockchain/blockchain.tar.gz -tar -zxvf blockchain.tar.gz -echo "Downloading and extracting of blockchain files completed" - -# Make initial, empty btcprivate.conf if needed +# Make empty btcprivate.conf if needed; otherwise use existing if [ ! -e ~/.btcprivate/btcprivate.conf ] then touch ~/.btcprivate/btcprivate.conf fi +fetch_btcp_blockchain +} + +# Download + decompress blockchain.tar.gz (chainstate) to quickly sync past block 300,000 + +fetch_btcp_blockchain() { + +cd ~/.btcprivate + +wget https://storage.googleapis.com/btcpblockchain/blockchain.tar.gz +tar -zxvf blockchain.tar.gz +echo "Downloading and extracting blockchain files - Done." +rm -rf blockchain.tar.gz + +} + +fetch_btcp_binaries() { + +mkdir -p ~/BitcoinPrivate/src +cd ~/BitcoinPrivate/src + +wget https://github.com/BTCPrivate/BitcoinPrivate/releases/1.0.12/btcp-linux-1.0.12.tar.gz +tar -zxvf btcp-1.0.12-linux.tar.gz +echo "Downloading and extracting BTCP files - Done." +rm -rf btcp-1.0.12-linux.tar.gz } install_nvm_npm() { +cd ~ + # Install npm sudo apt-get -y install npm @@ -89,7 +123,7 @@ wget -qO- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | b # Set up nvm export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Install node v4 nvm install v4 @@ -98,7 +132,7 @@ nvm alias default v4 } -# MongoDB dependency for bitcore-wallet-service: +# MongoDB dependency for bitcore: install_mongodb() { @@ -113,7 +147,6 @@ sudo mkdir -p /data/db } - install_bitcore() { cd ~ @@ -129,7 +162,6 @@ cd btcp-explorer ../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp BTCPrivate/store-demo # (BTCPrivate/address-watch) (BTCPrivate/bitcore-wallet-service (untested)) - # Create config file for Bitcore cat << EOF > bitcore-node.json { @@ -162,26 +194,30 @@ EOF } -# -- Begin Fetching + Building -- -cd ~ + +run_install() { echo "Begin Setup." echo "" install_ubuntu + +echo "How would you like to build BTCP (btcpd and btcp-cli):" +echo "1) From source code (takes a long time)" +echo "2) Just download latest btcpd + btcp-cli binary" echo "" -echo "Can we make you a 3gb swapfile? EC2 Micro needs it because it takes a lot of memory to build BTCP." -echo "" -read -r -p "[y/N] " response +read -r -p "[1/2] " local response case "$response" in - [yY][eE][sS]|[yY]) - make_swapfile + [1]) + prompt_swapfile clone_and_build_btcp ;; - *) - clone_and_build_btcp + [2]) + fetch_btcp_binaries ;; + *) + echo "Neither; Skipped." esac @@ -199,9 +235,18 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" +#echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" echo "To start the bitcore-node, run:" echo "cd ~/btcp-explorer; nvm use v4; ./node_modules/bitcore-node-btcp/bin/bitcore-node start" echo "" -echo "To view the explorer in your browser - http://server_ip:8001" +echo "To view the explorer - http://server_ip:8001" +echo "To view the store demo in your browser - http://server_ip:8001" echo "For https, we recommend you route through Cloudflare. bitcore-node also supports it via the config; provide certs." + +} + +# *** INSTALL SCRIPT START *** + +cd ~ +run_install + From 9f60d72f53235501afc5345b5499286f9c8e7d25 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 18 Apr 2018 14:59:02 +0000 Subject: [PATCH 08/20] Disable binaries for now --- btcp_store_demo.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 657c389..4a914d5 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -106,10 +106,13 @@ fetch_btcp_binaries() { mkdir -p ~/BitcoinPrivate/src cd ~/BitcoinPrivate/src -wget https://github.com/BTCPrivate/BitcoinPrivate/releases/1.0.12/btcp-linux-1.0.12.tar.gz -tar -zxvf btcp-1.0.12-linux.tar.gz +# TODO create -explorer releases +local RELEASE = "1.0.11-5d06772-explorer" + +wget https://github.com/BTCPrivate/BitcoinPrivate/releases/$RELEASE/btcp-linux-$RELEASE.tar.gz +tar -zxvf btcp-${RELEASE}-linux.tar.gz echo "Downloading and extracting BTCP files - Done." -rm -rf btcp-1.0.12-linux.tar.gz +rm -rf btcp-${RELEASE}-linux.tar.gz } @@ -200,27 +203,32 @@ EOF run_install() { +echo "" echo "Begin Setup." echo "" install_ubuntu +echo "" echo "How would you like to build BTCP (btcpd and btcp-cli):" echo "1) From source code (takes a long time)" echo "2) Just download latest btcpd + btcp-cli binary" echo "" -read -r -p "[1/2] " local response +read -r -p "[1] " response case "$response" in [1]) prompt_swapfile clone_and_build_btcp ;; +''' [2]) fetch_btcp_binaries ;; +''' *) echo "Neither; Skipped." + ;; esac init_btcprivate_dotdir @@ -237,7 +245,7 @@ echo "" # Verify that nvm is exported export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion #echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" echo "To start the bitcore-node, run:" From 1e5b01c4ef57e4fadc55ea1e9b96853b18a07fb8 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 18 Apr 2018 16:38:03 +0000 Subject: [PATCH 09/20] Cleaned up dir structure, added info about working scripts to readme --- README.md | 30 +++++++++++++++---- btcp_basic_node.sh => btcp_explorer_demo.sh | 0 btcp_store_demo.sh | 9 +++--- .../btcp_explorer_upgrade.sh | 0 .../btcp_node_v5.sh | 0 start_v5.sh => experimental/start_v5.sh | 0 6 files changed, 29 insertions(+), 10 deletions(-) rename btcp_basic_node.sh => btcp_explorer_demo.sh (100%) rename btcp_explorer_upgrade.sh => experimental/btcp_explorer_upgrade.sh (100%) rename btcp_node_v5.sh => experimental/btcp_node_v5.sh (100%) rename start_v5.sh => experimental/start_v5.sh (100%) diff --git a/README.md b/README.md index 4f5817f..b381463 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,29 @@ -# bitcore-btcp +# bitcore-install -To build and install Bitcoin Private, [bitcore-node-btcp](https://github.com/BTCPrivate/bitcore-node-btcp) and its dependencies, and the bitcoind + [insight-api-btcp](https://github.com/BTCPrivate/insight-api-btcp) + [insight-ui-btcp](https://github.com/BTCPrivate/insight-ui-btcp) services: +### Vendor backend samples for BTCP (Javascript, Bitcore) -`./btcp-explorer.sh` +Run any one of these in a fresh Ubuntu VM to get started. -To run: +`btcp_store_demo.sh` - Creates a bitcore fullnode configured for `store-demo`, as well as block explorer + api + +`btcp_explorer_demo.sh` - Creates a bitcore fullnode configured for block explorer + api (`insight-ui-btcp` and `insight-api-btcp`) + +`btcp_fetch_wallet.sh` - Acquires `btcpd` and `btcp-cli`, by either fetching the [source on the explorer-btcp branch](https://github.com/BTCPrivate/BitcoinPrivate/tree/explorer-btcp) and building, or downloading the corresponding release binaries + + +# Related Repos + +- [store-demo](https://github.com/BTCPrivate/store-demo) +- [address-watch](https://github.com/BTCPrivate/address-watch) +- [bitcore-node-btcp](https://github.com/BTCPrivate/bitcore-node-btcp) +- [bitcore-lib-btcp](https://github.com/BTCPrivate/bitcore-lib-btcp) +- [bitcore-p2p-btcp](https://github.com/BTCP-community/bitcore-p2p-btcp) +- [bitcore-message-btcp](https://github.com/BTCPrivate/bitcore-message-btcp) +- [bitcore-build-btcp](https://github.com/BTCPrivate/bitcore-build-btcp) +- [insight-ui-btcp](https://github.com/BTCPrivate/insight-ui-btcp) +- [insight-api-btcp](https://github.com/BTCPrivate/insight-api-btcp) + +- [Bitcoin Private Daemon + CLI](https://github.com/BTCPrivate/BitcoinPrivate/tree/explorer-btcp) + +Runs with bitcore-node-btcp (fork of bitcore-node v4) on bitcore v3.1. Original work: [str4d/insight-api-zcash](https://github.com/str4d/insight-api-zcash). -`./start.sh` diff --git a/btcp_basic_node.sh b/btcp_explorer_demo.sh similarity index 100% rename from btcp_basic_node.sh rename to btcp_explorer_demo.sh diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 4a914d5..d29f96a 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -1,6 +1,7 @@ #!/bin/bash # !!! EC2 - Make sure port 8001 is in your security group +# Run this in a fresh environment. install_ubuntu() { @@ -215,17 +216,15 @@ echo "How would you like to build BTCP (btcpd and btcp-cli):" echo "1) From source code (takes a long time)" echo "2) Just download latest btcpd + btcp-cli binary" echo "" -read -r -p "[1] " response +read -r -p "[1/2] " response case "$response" in [1]) prompt_swapfile clone_and_build_btcp ;; -''' [2]) - fetch_btcp_binaries + #fetch_btcp_binaries ;; -''' *) echo "Neither; Skipped." ;; @@ -253,7 +252,7 @@ echo "cd ~/btcp-explorer; nvm use v4; ./node_modules/bitcore-node-btcp/bin/bitco echo "" echo "To view the explorer - http://server_ip:8001" echo "To view the store demo in your browser - http://server_ip:8001" -echo "For https, we recommend you route through Cloudflare. bitcore-node also supports it via the config; provide certs." +echo "For https, provide certs in the config" } diff --git a/btcp_explorer_upgrade.sh b/experimental/btcp_explorer_upgrade.sh similarity index 100% rename from btcp_explorer_upgrade.sh rename to experimental/btcp_explorer_upgrade.sh diff --git a/btcp_node_v5.sh b/experimental/btcp_node_v5.sh similarity index 100% rename from btcp_node_v5.sh rename to experimental/btcp_node_v5.sh diff --git a/start_v5.sh b/experimental/start_v5.sh similarity index 100% rename from start_v5.sh rename to experimental/start_v5.sh From 543c0cd21555b3904222d58da07a6a0151b23f45 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Thu, 19 Apr 2018 13:40:33 -0500 Subject: [PATCH 10/20] Explorer release for download --- btcp_store_demo.sh | 55 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index d29f96a..5bf28d0 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -1,7 +1,8 @@ #!/bin/bash # !!! EC2 - Make sure port 8001 is in your security group -# Run this in a fresh environment. + +# !!! Run this in a fresh environment. install_ubuntu() { @@ -33,7 +34,6 @@ cd $PREV } - prompt_swapfile() { echo "" @@ -88,7 +88,7 @@ fi cd ~/.btcprivate -# Download + decompress blockchain.tar.gz (chainstate) to quickly sync past block 300,000 +# Download + decompress blockchain.tar.gz (blocks/, chainstate/) to quickly sync past block 300,000 fetch_btcp_blockchain } @@ -107,13 +107,13 @@ fetch_btcp_binaries() { mkdir -p ~/BitcoinPrivate/src cd ~/BitcoinPrivate/src -# TODO create -explorer releases -local RELEASE = "1.0.11-5d06772-explorer" - -wget https://github.com/BTCPrivate/BitcoinPrivate/releases/$RELEASE/btcp-linux-$RELEASE.tar.gz -tar -zxvf btcp-${RELEASE}-linux.tar.gz +local RELEASE = "1.0.11" +local COMMIT = "d3905b0" +local FILE = "btcp-${RELEASE}-explorer-${COMMIT}-linux.tar.gz" +wget https://github.com/BTCPrivate/BitcoinPrivate/releases/download/v${RELEASE}-${COMMIT}/${FILE} +tar -zxvf $FILE echo "Downloading and extracting BTCP files - Done." -rm -rf btcp-${RELEASE}-linux.tar.gz +rm -rf $FILE } @@ -167,9 +167,10 @@ cd btcp-explorer # Install Insight API / UI (Explorer) (Headless) ../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp BTCPrivate/store-demo -# (BTCPrivate/address-watch) (BTCPrivate/bitcore-wallet-service (untested)) +# BTCPrivate/address-watch, BTCPrivate/bitcore-wallet-service (untested) # Create config file for Bitcore +local BITCORE_SERVICE_APP = "store-demo" #address-watch, bitcore-wallet-service cat << EOF > bitcore-node.json { "network": "livenet", @@ -178,7 +179,7 @@ cat << EOF > bitcore-node.json "bitcoind", "insight-api-btcp", "insight-ui-btcp", - "store-demo", + "$BITCORE_SERVICE_APP", "web" ], "servicesConfig": { @@ -199,31 +200,35 @@ cat << EOF > bitcore-node.json } EOF +#TODO Prompt option + Automate SSL Setup (LetsEncrypt) +#"https": true, +#"privateKeyFile": "/etc/ssl/bws.bitpay.com.key", +#"certificateFile": "/etc/ssl/bws.bitpay.com.crt", + } run_install() { echo "" -echo "Begin Setup." +echo "Begin Setup - Installing required packages." echo "" install_ubuntu - echo "" -echo "How would you like to build BTCP (btcpd and btcp-cli):" -echo "1) From source code (takes a long time)" -echo "2) Just download latest btcpd + btcp-cli binary" +echo "How would you like to fetch BTCP (btcpd and btcp-cli):" +echo "1) [fast] Download the latest binaries" +echo "2) [slow] Download + build from source code" echo "" read -r -p "[1/2] " response case "$response" in [1]) - prompt_swapfile - clone_and_build_btcp + fetch_btcp_binaries ;; [2]) - #fetch_btcp_binaries + prompt_swapfile + clone_and_build_btcp ;; *) echo "Neither; Skipped." @@ -246,17 +251,17 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -#echo "To start mongodb for bitcore-wallet-service, run 'mongod &'" -echo "To start the bitcore-node, run:" +echo "To start the demo, run:" echo "cd ~/btcp-explorer; nvm use v4; ./node_modules/bitcore-node-btcp/bin/bitcore-node start" echo "" -echo "To view the explorer - http://server_ip:8001" -echo "To view the store demo in your browser - http://server_ip:8001" -echo "For https, provide certs in the config" +echo "To view the demo in your browser:" +echo "http://my_ip:8001" +echo "" } -# *** INSTALL SCRIPT START *** + +# *** SCRIPT START *** cd ~ run_install From e3f11bc240eee73465f1129ac8b585d7735a9bde Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Thu, 19 Apr 2018 14:36:16 -0500 Subject: [PATCH 11/20] blockchain-explorer.tar.gz --- btcp_store_demo.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 5bf28d0..bb4de1c 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -95,10 +95,13 @@ fetch_btcp_blockchain fetch_btcp_blockchain() { -wget https://storage.googleapis.com/btcpblockchain/blockchain.tar.gz -tar -zxvf blockchain.tar.gz +cd ~/.btcprivate + +local FILE = "blockchain-explorer.tar.gz" +wget https://storage.googleapis.com/btcpblockchain/$FILE +tar -zxvf $FILE echo "Downloading and extracting blockchain files - Done." -rm -rf blockchain.tar.gz +rm -rf $FILE } From 7bf903fdd1f506cde33e0973f82e23d86ed31b76 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Thu, 19 Apr 2018 14:48:48 -0500 Subject: [PATCH 12/20] No spaces allowed in bash assignment --- btcp_store_demo.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index bb4de1c..3c301c4 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -97,7 +97,7 @@ fetch_btcp_blockchain() { cd ~/.btcprivate -local FILE = "blockchain-explorer.tar.gz" +local FILE="blockchain-explorer.tar.gz" wget https://storage.googleapis.com/btcpblockchain/$FILE tar -zxvf $FILE echo "Downloading and extracting blockchain files - Done." @@ -110,9 +110,9 @@ fetch_btcp_binaries() { mkdir -p ~/BitcoinPrivate/src cd ~/BitcoinPrivate/src -local RELEASE = "1.0.11" -local COMMIT = "d3905b0" -local FILE = "btcp-${RELEASE}-explorer-${COMMIT}-linux.tar.gz" +local RELEASE="1.0.11" +local COMMIT="d3905b0" +local FILE="btcp-${RELEASE}-explorer-${COMMIT}-linux.tar.gz" wget https://github.com/BTCPrivate/BitcoinPrivate/releases/download/v${RELEASE}-${COMMIT}/${FILE} tar -zxvf $FILE echo "Downloading and extracting BTCP files - Done." @@ -169,11 +169,11 @@ npm install BTCPrivate/bitcore-node-btcp cd btcp-explorer # Install Insight API / UI (Explorer) (Headless) -../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp BTCPrivate/store-demo -# BTCPrivate/address-watch, BTCPrivate/bitcore-wallet-service (untested) +../node_modules/bitcore-node-btcp/bin/bitcore-node install BTCPrivate/insight-api-btcp BTCPrivate/insight-ui-btcp BTCPrivate/store-demo # BTCPrivate/address-watch, BTCPrivate/bitcore-wallet-service (untested) + +local BITCORE_SERVICE_APP="store-demo" #address-watch, bitcore-wallet-service # Create config file for Bitcore -local BITCORE_SERVICE_APP = "store-demo" #address-watch, bitcore-wallet-service cat << EOF > bitcore-node.json { "network": "livenet", From 5458ded936c38ef2a6fb9533e86f22586d77ca37 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Thu, 19 Apr 2018 14:53:12 -0500 Subject: [PATCH 13/20] Handle apt-get output --- btcp_store_demo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 3c301c4..62bb69d 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -217,7 +217,7 @@ echo "" echo "Begin Setup - Installing required packages." echo "" -install_ubuntu +install_ubuntu > /dev/null echo "" echo "How would you like to fetch BTCP (btcpd and btcp-cli):" From db7914563af2c680aa4b7a7a901afa026cb6c44c Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Thu, 19 Apr 2018 15:52:09 -0500 Subject: [PATCH 14/20] Fetch .zcash-params for binaries --- btcp_store_demo.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 62bb69d..4856864 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -93,6 +93,12 @@ fetch_btcp_blockchain } +fetch_zcash_params() { + +wget -qO- https://raw.githubusercontent.com/BTCPrivate/BitcoinPrivate/master/btcputil/fetch-params.sh | bash + +} + fetch_btcp_blockchain() { cd ~/.btcprivate @@ -227,6 +233,7 @@ echo "" read -r -p "[1/2] " response case "$response" in [1]) + fetch_zcash_params fetch_btcp_binaries ;; [2]) From 345378fbdd79b6c9adfa81dae6e60e3756c3df10 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Thu, 19 Apr 2018 16:02:17 -0500 Subject: [PATCH 15/20] v0.0.1 --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b381463..a8b1a35 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@ -# bitcore-install +# bitcore-install - v0.0.1 ### Vendor backend samples for BTCP (Javascript, Bitcore) -Run any one of these in a fresh Ubuntu VM to get started. +Run any one of these in a fresh Ubuntu VM to get started: -`btcp_store_demo.sh` - Creates a bitcore fullnode configured for `store-demo`, as well as block explorer + api +#### `btcp_store_demo.sh` +- Creates a bitcore fullnode configured for `store-demo`, as well as block explorer + api +- **Public AMI:** BTCP-store-demo -`btcp_explorer_demo.sh` - Creates a bitcore fullnode configured for block explorer + api (`insight-ui-btcp` and `insight-api-btcp`) +#### `btcp_explorer_demo.sh` +- Creates a bitcore fullnode configured for block explorer + api (`insight-ui-btcp` and `insight-api-btcp`) -`btcp_fetch_wallet.sh` - Acquires `btcpd` and `btcp-cli`, by either fetching the [source on the explorer-btcp branch](https://github.com/BTCPrivate/BitcoinPrivate/tree/explorer-btcp) and building, or downloading the corresponding release binaries +#### `btcp_fetch_wallet.sh` +- Acquires `btcpd` and `btcp-cli` by either downloading the [latest indexing-enabled binaries](https://github.com/BTCPrivate/BitcoinPrivate/releases/tag/v1.0.11-d3905b0), or by fetching the [source on the explorer-btcp branch](https://github.com/BTCPrivate/BitcoinPrivate/tree/explorer-btcp) and building # Related Repos From 10f674ecd4ce59cc16c6b49f77490bd6a211c2a0 Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Fri, 27 Apr 2018 08:16:56 -0400 Subject: [PATCH 16/20] btcprivate.conf defaults --- btcp_store_demo.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 4856864..4d61703 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -83,7 +83,28 @@ fi # Make empty btcprivate.conf if needed; otherwise use existing if [ ! -e ~/.btcprivate/btcprivate.conf ] then - touch ~/.btcprivate/btcprivate.conf + +touch ~/.btcprivate/btcprivate.conf +cat << EOF > ~/.btcprivate/btcprivate.conf +#gen=1 +#reindex=1 +#showmetrics=0 +#rpcport=7932 +rpcuser=bitcoin +rpcpassword=local321 +server=1 +whitelist=127.0.0.1 +txindex=1 +addressindex=1 +timestampindex=1 +spentindex=1 +zmqpubrawtx=tcp://127.0.0.1:28332 +zmqpubhashblock=tcp://127.0.0.1:28332 +rpcallowip=127.0.0.1 +uacomment=bitcore +addnode=dnsseed.btcprivate.org +EOF + fi cd ~/.btcprivate From 015318bd95193dae5c8d5942e1c186a69b310596 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 27 Apr 2018 14:41:34 +0100 Subject: [PATCH 17/20] Install bower, browserify and get JS files --- btcp_store_demo.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 4856864..1609a7a 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -216,6 +216,13 @@ EOF } +install_bower_browserify_js_libs() { + cd ~/btcp-explorer/node_modules/store-demo + npm install -g bower browserify + bower install + cd node_modules/bitcore-lib-btcp + browserify --require ./index.js:bitcore-lib-btcp -o bitcore-lib-btcp.js +} run_install() { @@ -253,6 +260,8 @@ install_mongodb install_bitcore +install_bower_browserify_js_libs + echo "Complete." echo "" From d1b1b343e09e40f2c611f0cf938b88a8acef94d3 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 27 Apr 2018 14:57:16 +0100 Subject: [PATCH 18/20] Copy JS file to static served location --- btcp_store_demo.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 1609a7a..45c979e 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -222,6 +222,7 @@ install_bower_browserify_js_libs() { bower install cd node_modules/bitcore-lib-btcp browserify --require ./index.js:bitcore-lib-btcp -o bitcore-lib-btcp.js + cp bitcore-lib-btcp.js ~/btcp-explorer/node_modules/store-demo/static/js/bitcore-lib-btcp } run_install() { From 637044a18eb767584cad211797935c4f29d5885e Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 27 Apr 2018 15:33:44 +0100 Subject: [PATCH 19/20] Update to AMI name and reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8b1a35..e156e14 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Run any one of these in a fresh Ubuntu VM to get started: #### `btcp_store_demo.sh` - Creates a bitcore fullnode configured for `store-demo`, as well as block explorer + api -- **Public AMI:** BTCP-store-demo +- **Public AMI:** BTCP-Store (ami-62e3881a) #### `btcp_explorer_demo.sh` - Creates a bitcore fullnode configured for block explorer + api (`insight-ui-btcp` and `insight-api-btcp`) From 20a44e3bda1f8407d8c5c16593b6ae7409b59a6d Mon Sep 17 00:00:00 2001 From: Jon Layton Date: Fri, 27 Apr 2018 11:28:28 -0400 Subject: [PATCH 20/20] rpcpassword randomized --- btcp_store_demo.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/btcp_store_demo.sh b/btcp_store_demo.sh index 4d61703..eaa0678 100755 --- a/btcp_store_demo.sh +++ b/btcp_store_demo.sh @@ -84,6 +84,7 @@ fi if [ ! -e ~/.btcprivate/btcprivate.conf ] then +local RPCPASSWORD=$(head -c 32 /dev/urandom | base64) touch ~/.btcprivate/btcprivate.conf cat << EOF > ~/.btcprivate/btcprivate.conf #gen=1 @@ -91,7 +92,7 @@ cat << EOF > ~/.btcprivate/btcprivate.conf #showmetrics=0 #rpcport=7932 rpcuser=bitcoin -rpcpassword=local321 +rpcpassword=$RPCPASSWORD server=1 whitelist=127.0.0.1 txindex=1