diff --git a/README.md b/README.md index c15d9673..7303a37e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ This masternode installation script vastly simplifies the setup of a Phore masternode running on a virtual private server (VPS), and it also adds a number of other powerful features, including: -* IPv6 Support -* Installs 1-100 (or more!) Phore masternodes in parallel on one VPS, with individual phore.conf and data directories +* IPv6/IPv4 Support +* With IPv6 Installs 1-100 (or more!) Phore masternodes in parallel on one VPS, with individual phore.conf and data directories +* With IPv4, You can install 1 Phore masternodes per IPv4 address * It can install masternodes for other coins on the same VPS as Phore * 100% auto-compilation and 99% of configuration on the masternode side of things * Automatically compiling from the latest Phore release tag, or another tag can be specified @@ -13,8 +14,8 @@ This masternode installation script vastly simplifies the setup of a Phore maste Some notes and requirements: * Script has only been tested on a Vultr VPS, but should work almost anywhere where IPv6 addresses are available -* Currently only Ubunto 16.04 Linux is supported -* This script needs to run as root or with sudo, the masternodes will and should not! +* Currently only Ubuntu 16.04, 18.04 LTS is supported +* This script needs to run as root! This project was forked from https://github.com/masternodes/vps. @marsmensch (Florian) is the primary author behind this VPS installation script for masternodes. If you would like to donate to him, you can use the BTC address below @@ -28,7 +29,7 @@ BTC 33ENWZ9RCYBG7nv6ac8KxBUSuQX64Hx3x3 ## How to get VPS server -For new masternode owners, **Vultr** is recommended as a VPS hosting provider, but other providers that allow direct root SSH login access and offer Ubunto 16.04 may work. +For new masternode owners, **Vultr** is recommended as a VPS hosting provider, but other providers that allow direct root SSH login access and offer Ubuntu 16.04, 18.04 may work. You can use the following referral link to sign up with Vultr for VPS hosting: @@ -46,9 +47,9 @@ You can choose any location. You may wish to have it hosted in a city/country ne VPS location choice -## Linux distribution (Ubuntu 16.04 LTS) +## Linux distribution (Ubuntu 16.04/18.04 LTS) -Select Ubuntu 16.04. +Select Ubuntu 16.04/18.04. VPS location choice @@ -106,163 +107,131 @@ For Mac users, open Terminal (e.g., Press Command-Space and type Terminal and pr ``` ssh -l root ``` + ## Install Masternode Login to your newly installed node as "root". VPS sizing -Enter this command to copy the Masternode installation script and install a single Phore Masternode: +### Install One Phore Masternode +Enter this command to copy the Masternode installation script and install a single Phore Masternode with IPv6: ```bash -git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore +git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -g -x ``` -If you have your masternode private key, please use this (you can generate masternode private key with Step 2 below). - +With IPv4 address: ```bash -git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -k **PRIVATE KEY** +git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -n 4 -g -x ``` -Using this command, you can skip "Configure masternode configuration files" below, because the command abopve adds the masternode private key to the masternode configuration files. - -This prepares the system and installs the Phore Masternode daemon. This includes downloading the latest Phore masternode release, creating a swap file, configuring the firewall, and compiling the Phore Masternode from source code. This process takes about 10-15 minutes. +This prepares the system and installs the Phore Masternode daemon. This includes downloading the latest Phore masternode release, creating a swap file, configuring the firewall, and compiling the Phore Masternode from source code, generate configuration file and masternode privkey. This process takes about 20-30 minutes. VPS configuration While that is underway, go back to your local desktop and open phore-qt. -### More complex situations (ignore if you are installing a single masternode on a new VPS) - -If you wish to install more than one masternode on the same VPS, you can add a -c parameter to tell the script how many to configure, so for example this would install three Phore masternodes (all entered on one line): - +### Install Multiple Phore Masternode +Enter this command to copy the Masternode installation script and install a single Phore Masternode with IPv6: ```bash -git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -c 3 +git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -c 3 -g -x ``` +`-c 3` term means 3 phore masternodes. + +IPv4: You can't install automatically with multiple IPv4 address with this script. + +## Update Mastenode + You should first remove the old version of the VPS script so that the new one you download is tagged with the latest version, and then you add a -u parameter to upgrade existing nodes: + + ```bash + rm -rf /root/vps + ``` + ```bash + git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -u + ``` + + The project is configured to use the latest official release of the Phore masternode code, and we will update this project each time a new release is issued, but without downloading the latest version of this project and using the -u parameter, the script will not update an existing Phore node that is already installed. + +### Complex Situations +- In single masternode installation, if you already generated masternode private key + Enter this command. + ```bash + git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -x -k **PRIVATE KEY** + ``` + + **PRIVATE KEY** means your generated masternode private key. For example, + ```bash + git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -x -k 87AqVXXXXXERNJxqBGdSS9LDS2vXXXXX5RdiiNd1zM7YAM7SHWX + ``` + In this script, you can find configuration in masternode.conf in your PC. + enter this to check it. + ```bash + cat /tmp/phore_masternode.conf + ``` + and add these lines to your masternode.conf. + +- In multiple masternodes installation and if you already have your masternode private keys, you can add them as shown below (all entered on one line): + + ```bash + git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -c 3 -x --key **PRIVATE KEY 01** --key2 **PRIVATE KEY 02** --key3 **PRIVATE KEY 03** + ``` + Using this command, you can skip the step for "Configure masternode configuration files", because the command above adds the masternode private keys to the masternode configuration files. + +- If you are adding new masternode, (and if you installed 2 masternodes already) + ``` + git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -x -c 3 + ``` + if you want to use --key option, add --key3 **MASTERNODE PRIVKEY 03**. You are able to use + ``` + git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -c 3 -g -x + ``` + for new 3rd masternode. -If you already have your masternode private keys, you can add them as shown below (all entered on one line): +## End of installations -```bash -git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -c 3 --key **PRIVATE KEY 01** --key2 **PRIVATE KEY 02** --key3 **PRIVATE KEY 03** -``` -Using this command, you can skip the step for "Configure masternode configuration files", because the command above adds the masternode private keys to the masternode configuration files. +When the script finishes, it will look similar to this: +installation ended -If you are upgrading your masternode(s) to a new release, you should first remove the old version of the VPS script so that the new one you download is tagged with the latest version, and then you add a -u parameter to upgrade existing nodes: +Copy **VPS IP** and **Priv Key** to a text file. It will be needed for configuration in Phore wallet(in this example, VPS IP is [2001:19f0:7001:fd4:e2b7::1]:11771, Priv Key is 87KsYyqumG9HJjG000008jtpSEQUKSuEWkBG9xov19cuEsXH5vB). -```bash -rm -rf /root/ -``` -```bash -git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -u -``` +*Tips*: If you installed multiple masternode, copy each *VPS IP*, *Priv Key*. -The project is configured to use the latest official release of the Phore masternode code, and we will update this project each time a new release is issued, but without downloading the latest version of this project and using the -u parameter, the script will not update an existing Phore node that is already installed. +You only have a few steps remaining to complete your masternode configuration. ## Configure Phore Wallet ### Step1 - Create Collateral Transaction -Once the wallet is open on your local computer, generate a new receive address and label it however you want to identify your masternode rewards (e.g., Phore-MN-1). This label will show up in your transactions each time you receive a block reward. + +Once the wallet is open on your local computer, generate a new receive address in *Receive* tab and label it however you want to identify your masternode rewards (e.g., Phore-MN-1). This label will show up in your transactions each time you receive a block reward. Click the Request payment button, and copy the address. making new address -Now go to the Send tab, paste the copied address, and send *exactly* 10,000 PHR to it in a single transaction. Wait for it to confirm on the blockchain. This is the collateral transaction that will be locked and paired with your new masternode. If you are setting up more than one masternode at one time, repeat this process for each one. +Now go to the *Send* tab, paste the copied address, and send *exactly* 10,000 PHR to it in a single transaction. Wait for it to confirm on the blockchain. This is the collateral transaction that will be locked and paired with your new masternode. If you are setting up more than one masternode at one time, repeat this process for each one. sending 10kPHR -### Step 2 - Generate Masternode Private Key -Go to the **[Tools > Debug Console]** and enter these commands below: - -```bash -masternode genkey -``` -This will produce a masternode private key: - -generating masternode private key - -Copy this value to a text file. It will be needed for both the phore configuration file on the masternode VPS, and the masternode configuration file on the computer with the controlling Phore wallet. - -If you are setting up multiple masternodes, repeat this step for each one. Each time you run the masternode genkey command it will give you a new private key--it doesn't matter which one you use, but it is important that it is unique for each masternode and that the VPS phore configuration file and wallet masternode configuration file match (see below). - -### Step 3 - Masternode Outputs - -This will give you the rest of the information you need to configure your masternode in your Phore wallet--the transaction ID and the output index. - -```bash -masternode outputs -``` - -getting transaction id - -The long string of characters is the *Transaction ID* for your masternode collateral transaction. The number after the long string is the *Index*. Copy and paste these into the text file next to the private key you generated in Step 2. - -If you have multiple masternodes in the same wallet and have done the 10,000 PHR transactions for each of them, masternode outputs will display transaction IDs and indexes for each one. You can choose which private key to go with each transaction ID and index, as long as they are all different, and you make sure the corresponding lines in masternode.conf and the VPS phore configuration files match (see below). - -## End of installations -When the script finishes, it will look similar to this: - -installation ended +### Step 2 - Make New Masternode Configuration +Go to the *Masternodes* Tab and click **ADD MASTERNODE** button. -You only have a few steps remaining to complete your masternode configuration. -## Configure masternode configuration files -Since this installation method supports multiple masternodes, the phore configuration files have a node number added to them (e.g., phore_n1.conf, phore_n2.conf), stored in the /etc/masternodes directory. If you have a single masternode on the VPS, you will only need to edit /etc/masternodes/phore_n1.conf. +This will open *New Masternode Alias* window. +New Masternode Alias window -To open phore_n1.conf for editing, enter these commands: -```bash -sudo apt-get install nano -nano /etc/masternodes/phore_n1.conf -``` -The next step adds your masternode private key. +Click **AUTOFIL OUTPUTS** button. It autofills Priv Key, Output, Output ID. +If Output(ID) isn't filled, wait 1~2 mins. +Then enter *Alias Name*, *VPS IP*, *Priv Key*. +*Alias Name* means your masternode name(Only for identify), *VPS IP* is your VPS server IP which was copied in [End of installations](#End-of-installations). +In this example, *Alias Name* is phore-mn01 and *VPS IP* is [2001:19f0:7001:fd4:e2b7::1]:11771, *Priv Key* is 87KsYyqumG9HJjG000008jtpSEQUKSuEWkBG9xov19cuEsXH5vB. -## Add masternode private key -What you need to change is only masternode private key. -(We recommend using IPv6 which is the default, but if you choose IPv4 when you ran the installation script, please edit #NEW_IPv4_ADDRESS_FOR_MASTERNODE_NUMBER to your VPS IP address). -After typing the nano command, you will see something similar to this. +New Masternode Alias inputed -add private key +If you are setting up multiple masternodes, repeat this step for each one. -Copy the masternode private key from the text file you saved it in, and replace HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_phore_1 with that private key (this typically begins with an 8). +*Tips:* If you want, you can generate Priv Key here, but you will need to edit masternode configuration file manually on VPS(See [Add masternode private key](#Add-masternode-private-key)). -While you have this file opened, copy the information that follows after masternodeaddr=, starting with the open bracket. This is the masternode's IPv6 address and port, and will be needed for the wallet's masternode.conf file. - -Once you have your masternode private key entered, press Ctrl+X . -Then press Y to save, and press Enter to exit. - -Finally, close and restart your Phore wallet so that it will have the new masternode configuration. - -## Start your masternodes -A script for starting all masternodes on the VPS has been created at /usr/local/bin/activate_masternodes_phore.sh. -Run this command after your masternode configuration written above. - -```bash -/usr/local/bin/activate_masternodes_phore -``` - -The masternode daemons will start and begin loading the Phore blockchain. - -## Finishing Wallet Configuration & Activate Masternode -To activate your nodes from your wallet, one of the last steps is to add a line for the masternode in the masternode.conf file. This file has the following format, with each value separated with a space: - -* alias IP:Port masternodeprivatekey collateral_transaction_ID collateral_output_index -* alias - A short name you use to identify the masternode, you can choose this name as long as it is without spaces (e.g., Phore-MN-1) -* IP:Port - The IP address (either IPv6 or IPv4) and the Port where the masternode is running, separated by a colon (:). You copied this from the phore.conf file on the VPS. -* collateral_transaction_ID: This is the transaction ID you copied from masternode outputs. -* collateral_output_index: This is the index you copied from masternode outputs. - -From the wallet menu, edit the local wallet **masternode.conf** file. **[Tools > Open Masternode Configuration File]** -Add the MN conf line, like the example below to the masternode.conf file. Save it, and close the file. It will look like the following example, using your values for each of the fields above. A common mistake is mixing up the private key and the collateral transaction ID--to make this easier, the private key usually begins with an 8. - -example. -``` -Phore-MN-1 [2001:19f0:5001:ca6:2085::1]:11771 88xrxxxxxxxxxxxxxxxxxxxxxxx7K 6b4c9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7ee23 0 -``` - -The image below shows another example using an IPv4 IP address. If you followed this guide you are probably using an IPv6 address that looks like the line above. - -editing masternode.conf - -If you are running multiple masternodes, you need to add one of these lines for each masternode, and make sure the private key on each line matches the corresponding private key you entered in the VPS phore configuration file for that masternode. ## Check syncing status of masternode + The masternode cannot complete activation until it is fully synced with the Phore blockchain network. To check the status of your masternode, please enter this command in the VPS terminal. If you have multiple masternodes on the same VPS, you can change n1 to n2 etc. below to check the status of each one. @@ -273,12 +242,12 @@ To check the status of your masternode, please enter this command in the VPS ter The output will look like this: ``` { - "version": 1010000, - "protocolversion": 7002, + "version": 1050100, + "protocolversion": 70006, "walletversion": 61000, "balance": 0.00000000, "privatesend_balance": 0.00000000, - "blocks": 176209, + "blocks": 606209, "timeoffset": 0, "connections": 44, "proxy": "", @@ -313,7 +282,9 @@ Once your masternode has synced up to the latest block, go to next step. The syn ## Start Masternode -Go to the debug console of your Phore wallet **[Tools->Debug Console]** and enter the following command, replacing **mn-alias** with the name of the masternode in the Alias column of the Masternodes tab: +Go *Masternodes* tab and click each masternode then click **START ALIAS** button. If you get "successful started", your masternode was finally activated! + +Tips: Sometimes you get *error*, go to the debug console of your Phore wallet **[Tools->Debug Console]** and enter the following command, replacing **mn-alias** with the name of the masternode in the Alias column of the Masternodes tab: ``` startmasternode alias false mn-alias @@ -336,14 +307,117 @@ If you are setting up multiple masternodes, repeat this for each one. You can no It should say ENABLED, and within an hour, the timer in the Active column should start increasing. -Your Phore masternode is now set up and running! Depending on how many masternodes there are, it may take 12-24 hours before you see your first masternode reward--this is normal and rewards should come at more regular intervals after the first one. +Your Phore masternode is now set up and running! Depending on how many masternodes there are, it may take 24-30 hours before you see your first masternode reward--this is normal and rewards should come at more regular intervals after the first one. rewards +## With Manually installation +## Configure masternode configuration files + +Since this installation method supports multiple masternodes, the phore configuration files have a node number added to them (e.g., phore_n1.conf, phore_n2.conf), stored in the /etc/masternodes directory. If you have a single masternode on the VPS, you will only need to edit /etc/masternodes/phore_n1.conf. + +To open phore_n1.conf for editing, enter these commands: +```bash +sudo apt-get install nano +nano /etc/masternodes/phore_n1.conf +``` +The next step adds your masternode private key. + +## Add masternode private key + +What you need to change is only masternode private key. +(We recommend using IPv6 which is the default, but if you choose IPv4 when you ran the installation script, please edit #NEW_IPv4_ADDRESS_FOR_MASTERNODE_NUMBER to your VPS IP address). +After typing the nano command, you will see something similar to this. + +add private key + +Copy the masternode private key from the text file you saved it in, and replace HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_phore_1 with that private key (this typically begins with an 8). + +While you have this file opened, copy the information that follows after masternodeaddr=, starting with the open bracket. This is the masternode's IPv6 address and port, and will be needed for the wallet's masternode.conf file. + +Once you have your masternode private key entered, press Ctrl+X . +Then press Y to save, and press Enter to exit. + +Finally, close and restart your Phore wallet so that it will have the new masternode configuration. + +## Tips +### Check masternode status on VPS Server +You can check your masternode status on VPS server. Use this command. +``` +/usr/local/bin/phore-cli -pid=/var/lib/masternodes/phore1/phore.pid -conf=/etc/masternodes/phore_n1.conf -datadir=/var/lib/masternodes/phore1 masternode status +``` +If it returns +``` +{ + "txhash": "a7eba991be786ce80948e9099e26f6a816317b2142f9e5e12abea357f885d0f2", + "outputidx": 1, + "netaddr": "[2001:19f0:5c01:457:2044::6]:11771", + "addr": "PEtMbHEuqo1QHs7Xy2wCTTmugAuemyd2mU", + "status": 4, + "message": "Masternode successfully started" +} +``` +like this, Your masternode is successfully started(Please check txhash, outputidx are same as your masternode.conf). + +You can start and stop masternode client manually. Enter this commands. +### To stop +``` +/usr/local/bin/phore-cli -pid=/var/lib/masternodes/phore1/phore.pid -conf=/etc/masternodes/phore_n1.conf -datadir=/var/lib/masternodes/phore1 stop +``` + +if use this command, masternode client will restart automatically in 5sec. +To stop completely, +``` +service phore_n1 stop +``` + +### To start +``` +/usr/local/bin/phored -daemon -pid=/var/lib/masternodes/phore1/phore.pid -conf=/etc/masternodes/phore_n1.conf -datadir=/var/lib/masternodes/phore1 +``` + +If you stopped service "phore_n1", use +``` +service phore_n1 start +``` + +### To resync +``` +service phore_n1 stop +``` +then start phore daemon with resync mode +``` +/usr/local/bin/phored -pid=/var/lib/masternodes/phore1/phore.pid -conf=/etc/masternodes/phore_n1.conf -datadir=/var/lib/masternodes/phore1 -resync +``` + +You can check syncing status with +``` +phore-cli -conf=/etc/masternodes/phore_n1.conf getinfo +``` + +## Options of this script + +The _install.sh_ script support the following parameters: + +| Long Option | Short Option | Values | Description | +| :----------- | :----------- | ------------------- | ------------------------------------------------------------------- | +| --project | -p | project, ex. "phore"| shortname for the project | +| --net | -n | "4" / "6" | ip type for masternode. (ipv)6 is default | +| --release | -r | e.g. "tags/v1.3.3.1"| a specific git tag/branch, defaults to latest tested | +| --count | -c | number | amount of masternodes to be configured | +| --update | -u | -- | update specified masternode daemon, combine with -p flag | +| --sentinel | -s | -- | install and configure sentinel for node monitoring | +| --wipe | -w | -- | uninstall & wipe all related master node data, combine with -p flag | +| --help | -h | -- | print help info | +| --startnodes | -x | -- | starts masternode(s) after installation | +| --key | -k | masternode privkey | preinput masternode private key to configuration files | +| --generate | -g | -- | generate and preinput masternode private key | + ## Issues and Questions + Please open a GitHub Issue if there are problems with this installation method. Many Phore team members activel support people installing masternodes and can provide assistance in the Phore Discord channel. Here is a Discord invitation: -https://discord.gg/sbgdcdv +https://discord.gg/Aucncz5 If you would like to make a donation to Phore's ongoing development, you can send Phore to the core team at this address: PDjGJMDzvJnvbxxgR1bgPm77fFLxn3KAg8 diff --git a/README_JP.md b/README_JP.md new file mode 100644 index 00000000..ed2e2c1d --- /dev/null +++ b/README_JP.md @@ -0,0 +1,349 @@ +# Phore マスターノード VPS インストール + +Phoreのマスターノードを簡単に・複数インストールするためのスクリプトです。次の特徴があります。 + +* IPv6 対応 +* 1-100以上のマスターノードを同一VPSサーバーへインストールすることが出来ます(ipv4アドレスはマスターノードの数だけ必要)。 +* Phoreと同じように、他の通貨のマスターノードも対応していればインストール可能です。 +* マスターノードの設定のほとんどをこのスクリプトで実行可能です(現在はPhoreのみプライベートキー生成対応) +* Phoreやその他の通貨においてもリリースタグを利用して自動でコンパイルを行います。 +* セキュリティ向上のため、ユーザーの分離などの施策を実施しています。 + +ノート・必要なこと: + +* Script has only been tested on a Vultr VPS, but should work almost anywhere where IPv6 addresses are available +* Currently only Ubunto 16.04 Linux is supported +* This script needs to run as root or with sudo, the masternodes will and should not! + +This project was forked from https://github.com/masternodes/vps. @marsmensch (Florian) is the primary author behind this VPS installation script for masternodes. If you would like to donate to him, you can use the BTC address below + +**Have fun, this is crypto after all!** + +``` +BTC 33ENWZ9RCYBG7nv6ac8KxBUSuQX64Hx3x3 +``` + +# Install guide on vultr + +## How to get VPS server + +For new masternode owners, **Vultr** is recommended as a VPS hosting provider, but other providers that allow direct root SSH login access and offer Ubunto 16.04 may work. + +You can use the following referral link to sign up with Vultr for VPS hosting: + + + +## Deploy a new system + +First, create a new VPS by clicking that small "+" button. + +VPS creation + +## Location choice + +You can choose any location. You may wish to have it hosted in a city/country near you, or choose a different area to help with the global decentralization of the Phore masternode network. + +VPS location choice + +## Linux distribution (Ubuntu 16.04 LTS) + +Select Ubuntu 16.04. + +VPS location choice + +## VPS size + +The 25 GB SSD / 1024MBB Memory instance is enough for 2-3 masternodes. You may need more memory as the Phore blockchain grows over time, or if you want to run more masternodes. + +VPS sizing + +## Activating additional features (IPv6) + +Toggle "Enable IPv6" to activate that feature--at Vultr there is no additional cost for this. + +VPS sizing + +You may wish to enable DDOS Protection to protect your masternodes against a potential denial of service attack, especially if you are running multiple masternodes from one VPS. Vultr charges an additional fee for this. + +## Hostnames & number of VPS + +Choose how many instances you want and click "Deploy Now". + +VPS sizing + +## Installation of PuTTY as SSH client (Windows) +If you are running your wallet from Windows, install PuTTY while the server is being set up. You can download PuTTY from here: http://www.putty.org/. Skip this step if you are using a Mac--you will use the built in Terminal application instead. + +Once PuTTY is installed, return to the Vultr dashboard to get the login details by clicking on the ... to the right of your server, and select Server Details. + +## Accessing your VPS via SSH + +Copy your password for SSH access from the server details page. +check hostname and password + +Now open PuTTY to add the server. + +login to VPS + +Enter the IP address in the Host Name field, and enter the server name you wish to use for this VPS (e.g., MN01) to Saved Sessions. Click save. + +Click the open button. When the console has opened, click Yes in the PuTTY Security Alert box. +Alert from PuTTY + +Now enter your server login details provided in your Vultr account. +You cannot Ctrl+V to paste in the console. Either right click the mouse or type shift+insert (sometimes +on keyboard it will just be INS key) + +User: root +Password: (paste or type password) + +When you paste it will not display, so don't try to paste again. +Just paste once and press Enter. + +For Mac users, open Terminal (e.g., Press Command-Space and type Terminal and press Enter). Then type: + +``` +ssh -l root +``` +## Install Masternode + +Login to your newly installed node as "root". + +VPS sizing + +Enter this command to copy the Masternode installation script and install a single Phore Masternode: + +```bash +git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore +``` + +If you have masternode private key, please use this(You can generate masternode private key on below Step 2). + +```bash +git clone https://github.com/phoreproject/vps.git && cd vps && ./install.sh -p phore -k **PRIVATE KEY** +``` +You can skip below "Configure masternode configuration files". Because above command inputs masternode private key to masternode configuration files. + + +This prepares the system and installs the Phore Masternode daemon. This includes downloading the latest Phore masternode release, creating a swap file, configuring the firewall, and compiling the Phore Masternode from source code. This process takes about 10-15 minutes. + +VPS configuration + +While that is underway, go back to your local desktop and open phore-qt. + +### More complex situations (ignore if you are installing a single masternode on a new VPS) + +If you wish to install more than one masternode on the same VPS, you can add a -c parameter to tell the script how many to configure, so for example this would install three Phore masternodes: + +```bash +git clone https://github.com/phoreproject/vps.git && cd vps +./install.sh -p phore -c 3 +``` + +If you have masternode private key, + +```bash +git clone https://github.com/phoreproject/vps.git && cd vps +./install.sh -p phore -c 3 --key **PRIVATE KEY 01** --key2 **PRIVATE KEY 02** --key3 **PRIVATE KEY 03** +``` +You can skip below "Configure masternode configuration files". Because above command inputs masternode private key to masternode configuration files. + + +If you are upgrading your masternode(s) to a new release, you can add a -u parameter: + +```bash +git clone https://github.com/phoreproject/vps.git && cd vps +./install.sh -p phore -u +``` + +The project is configured to use the latest official release of the Phore masternode code, and we will update this project each time a new release is issued, but without downloading the latest version of this project and using the -u parameter, the script will not update an existing Phore node that is already installed. + +## Configure Phore Wallet +### Step1 - Create Collateral Transaction +Once the wallet is open on your local computer, generate a new receive address and label it however you want to identify your masternode rewards (e.g., Phore-MN-1). This label will show up in your transactions each time you receive a block reward. + +Click the Request payment button, and copy the address. + +making new address + +Now go to the Send tab, paste the copied address, and send *exactly* 10,000 PHR to it in a single transaction. Wait for it to confirm on the blockchain. This is the collateral transaction that will be locked and paired with your new masternode. If you are setting up more than one masternode at one time, repeat this process for each one. + +sending 10kPHR + +### Step 2 - Generate Masternode Private Key +Go to the **[Tools > Debug Console]** and enter these commands below: + +```bash +masternode genkey +``` +This will produce a masternode private key: + +generating masternode private key + +Copy this value to a text file.t will be needed for both the phore configuration file on the masternode VPS, and the masternode configuration file on the wallet computer. + +If you are setting up multiple masternodes, repeat this step for each one. Each time you run the masternode genkey command it will give you a new private key--it doesn't matter which one you use, but it is important that it is unique for each masternode and that the VPS phore configuration file and wallet masternode configuration file match (see below). + +### Step 3 - Masternode Outputs + +This will give you the rest of the information you need to configure your masternode in your Phore wallet--the transaction ID and the output index. + +```bash +masternode outputs +``` + +getting transaction id + +The long string of characters is the *Transaction ID* for your masternode collateral transaction. The number after the long string is the *Index*. Copy and paste these into the text file next to the private key you generated in Step 2. + +If you have multiple masternodes in the same wallet and have done the 10,000 PHR transactions for each of them, masternode outputs will display transaction IDs and indexes for each one. You can choose which private key to go with each transaction ID and index, as long as they are all different, and you make sure the corresponding lines in masternode.conf and the VPS phore configuration files match (see below). + +## End of installations +When the script finishes, it will look similar to this: + +installation ended + +You only have a few steps remaining to complete your masternode configuration. +## Configure masternode configuration files +Since this installation method supports multiple masternodes, the phore configuration files have a node number added to them (e.g., phore_n1.conf, phore_n2.conf), stored in the /etc/masternodes directory. If you have a single masternode on the VPS, you will only need to edit /etc/masternodes/phore_n1.conf. + +To open phore_n1.conf for editing, enter these commands: +```bash +sudo apt-get install nano +nano /etc/masternodes/phore_n1.conf +``` +The next step adds your masternode private key. + +## Add masternode private key +What you need to change is only masternode private key. +(We recommend using IPv6 which is the default, but if you choose IPv4 when you ran the installation script, please edit #NEW_IPv4_ADDRESS_FOR_MASTERNODE_NUMBER to your VPS IP address). +After typing the nano command, you will see something similar to this. + +add private key + +Copy the masternode private key from the text file you saved it in, and replace HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_phore_1 with that private key (this typically begins with an 8). + +While you have this file opened, copy the information that follows after masternodeaddr=, starting with the open bracket. This is the masternode's IPv6 address and port, and will be needed for the wallet's masternode.conf file. + +Once you have your masternode private key entered, press Ctrl+X . +Then press Y to save, and press Enter to exit. + +Finally, close and restart your Phore wallet so that it will have the new masternode configuration. + +## Start your masternodes +A script for starting all masternodes on the VPS has been created at /usr/local/bin/activate_masternodes_phore.sh. +Run this command after your masternode configuration written above. + +```bash +/usr/local/bin/activate_masternodes_phore +``` + +The masternode daemons will start and begin loading the Phore blockchain. + +## Finishing Wallet Configuration & Activate Masternode +To activate your nodes from your wallet, one of the last steps is to add a line for the masternode in the masternode.conf file. This file has the following format, with each value separated with a space: + +* alias IP:Port masternodeprivatekey collateral_transaction_ID collateral_output_index +* alias - A short name you use to identify the masternode, you can choose this name as long as it is without spaces (e.g., Phore-MN-1) +* IP:Port - The IP address (either IPv6 or IPv4) and the Port where the masternode is running, separated by a colon (:). You copied this from the phore.conf file on the VPS. +* collateral_transaction_ID: This is the transaction ID you copied from masternode outputs. +* collateral_output_index: This is the index you copied from masternode outputs. + +From the wallet menu, edit the local wallet **masternode.conf** file. **[Tools > Open Masternode Configuration File]** +Add the MN conf line, like the example below to the masternode.conf file. Save it, and close the file. It will look like the following example, using your values for each of the fields above. A common mistake is mixing up the private key and the collateral transaction ID--to make this easier, the private key usually begins with an 8. + +example. +``` +Phore-MN-1 [2001:19f0:5001:ca6:2085::1]:11771 88xrxxxxxxxxxxxxxxxxxxxxxxx7K 6b4c9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7ee23 0 +``` + +The image below shows another example using an IPv4 IP address. If you followed this guide you are probably using an IPv6 address that looks like the line above. + +editing masternode.conf + +If you are running multiple masternodes, you need to add one of these lines for each masternode, and make sure the private key on each line matches the corresponding private key you entered in the VPS phore configuration file for that masternode. +## Check syncing status of masternode +The masternode cannot complete activation until it is fully synced with the Phore blockchain network. + +To check the status of your masternode, please enter this command in the VPS terminal. If you have multiple masternodes on the same VPS, you can change n1 to n2 etc. below to check the status of each one. + +```bash +/usr/local/bin/phore-cli -conf=/etc/masternodes/phore_n1.conf getinfo +``` +The output will look like this: +``` +{ + "version": 1010000, + "protocolversion": 7002, + "walletversion": 61000, + "balance": 0.00000000, + "privatesend_balance": 0.00000000, + "blocks": 176209, + "timeoffset": 0, + "connections": 44, + "proxy": "", + "difficulty": 42882.54964804553, + "testnet": false, + "moneysupply" : 11814171.53907114, + "zPHRsupply" : { + "1" : 263.00000000, + "5" : 135.00000000, + "10" : 500.00000000, + "50" : 700.00000000, + "100" : 1300.00000000, + "500" : 5000.00000000, + "1000" : 11000.00000000, + "5000" : 90000.00000000, + "total" : 108898.00000000 + }, + "keypoololdest" : 1507302593, + "keypoolsize" : 1001, + "paytxfee" : 0.00000000, + "relayfee" : 0.00010000, + "staking status" : "Staking Not Active", + "errors" : "" +} +``` + +We're looking at the *blocks*, and need that to be the latest block in the blockchain. You can check your local wallet to see the latest block by hovering over the green check mark. + +checking syncing status + +Once your masternode has synced up to the latest block, go to next step. The syncing process may take 15-30 minutes or more as the Phore blockchain grows. You can keep checking progress with the command above, by pressing the up arrow and Enter to repeat it. + +## Start Masternode + +Go to the debug console of your Phore wallet **[Tools->Debug Console]** and enter the following command, replacing **mn-alias** with the name of the masternode in the Alias column of the Masternodes tab: + +``` +startmasternode alias false mn-alias +``` + +You may need to unlock the wallet **[Settings->Unlock Wallet]** before you run this command, entering your passphrase. You can lock the wallet after it is finished. + +If everything was setup correctly, after entering the command you will see something like this: +``` +{ +"overall" : "Successfully started 1 masternodes, failed to start 0, total 1", +"detail" : { +"status" : { +"alias" : "phore-mn01", +"result" : "successful" +} +``` +If you are setting up multiple masternodes, repeat this for each one. You can now close the debug console, return the Masternodes tab and check the status: +checking syncing status + +It should say ENABLED, and within an hour, the timer in the Active column should start increasing. + +Your Phore masternode is now set up and running! Depending on how many masternodes there are, it may take 12-24 hours before you see your first masternode reward--this is normal and rewards should come at more regular intervals after the first one. + +rewards + +## Issues and Questions +Please open a GitHub Issue if there are problems with this installation method. Many Phore team members activel support people installing masternodes and can provide assistance in the Phore Discord channel. +Here is a Discord invitation: + +https://discord.gg/sbgdcdv + +If you would like to make a donation to Phore's ongoing development, you can send Phore to the core team at this address: PDjGJMDzvJnvbxxgR1bgPm77fFLxn3KAg8 diff --git a/assets/zenzo.png b/assets/zenzo.png new file mode 100644 index 00000000..2df8af34 Binary files /dev/null and b/assets/zenzo.png differ diff --git a/config/fxtc/fxtc.compile b/config/fxtc/fxtc.compile new file mode 100644 index 00000000..af05c4c7 --- /dev/null +++ b/config/fxtc/fxtc.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --disable-dependency-tracking --enable-tests=no --without-gui --without-miniupnpc --with-incompatible-bdb CFLAGS="-march=native" LIBS="-lcurl -lssl -lcrypto -lz" +make +make install \ No newline at end of file diff --git a/config/fxtc/fxtc.env b/config/fxtc/fxtc.env new file mode 100644 index 00000000..4d9fe058 --- /dev/null +++ b/config/fxtc/fxtc.env @@ -0,0 +1,6 @@ +CODENAME=fxtc +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/fxtcd +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-9468} +GIT_URL=https://github.com/fxtc/fxtc.git +SCVERSION="tags/master" +NETWORK_BASE_TAG="2012" \ No newline at end of file diff --git a/config/hppcoin/hppcoin.compile b/config/hppcoin/hppcoin.compile new file mode 100644 index 00000000..c8eb99bc --- /dev/null +++ b/config/hppcoin/hppcoin.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --disable-dependency-tracking --enable-tests=no --without-gui --without-miniupnpc --with-incompatible-bdb CFLAGS="-march=native" LIBS="-lcurl -lssl -lcrypto -lz" +make +make install \ No newline at end of file diff --git a/config/hppcoin/hppcoin.conf b/config/hppcoin/hppcoin.conf new file mode 100644 index 00000000..20635c61 --- /dev/null +++ b/config/hppcoin/hppcoin.conf @@ -0,0 +1,50 @@ +################################ +# basic settings +################################ +txindex=1 +logtimestamps=1 +listen=1 +daemon=1 +staking=0 +gen=0 +maxconnections=256 +bind=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX +externalip=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX + +############################# +# nodes we want to stick to +############################# +addnode=51.255.53.77:28878 +addnode=209.250.239.118:28878 + +################################ +# lmnode specific settings +################################ +lmnode=1 +#### INSERT YOUR lmnode PRIVATEKEY BELOW #################################################### +lmnodeprivkey=HERE_GOES_YOUR_lmnode_KEY_FOR_lmnode_XXX_GIT_PROJECT_XXX_XXX_NUM_XXX +################################################################################################# +# +# b. +# 88b Insert your generated lmnode privkey here +# 888b. +# 88888b +# 888888b. +# 8888P" +# P" `8. +# `8. +# `8 +################################################################################################# + +############################# +# optional indices +############################# + +############################# +# JSONRPC +############################# +server=1 +rpcuser=XXX_GIT_PROJECT_XXXrpc +rpcpassword=XXX_PASS_XXX +rpcallowip=127.0.0.1 +rpcport=555XXX_NUM_XXX diff --git a/config/hppcoin/hppcoin.env b/config/hppcoin/hppcoin.env new file mode 100644 index 00000000..40fdbb3b --- /dev/null +++ b/config/hppcoin/hppcoin.env @@ -0,0 +1,6 @@ +CODENAME=hppcoin +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/hppcoind} +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-28878} +GIT_URL=https://github.com/hppcoin/hppcoin.git +SCVERSION="tags/v1.0.1" +NETWORK_BASE_TAG="2044" diff --git a/config/phore/phore.env b/config/phore/phore.env index 4c71dd18..4f6ee08a 100644 --- a/config/phore/phore.env +++ b/config/phore/phore.env @@ -2,5 +2,5 @@ CODENAME=phore MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/phored} MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-11771} GIT_URL=https://github.com/phoreproject/Phore.git -SCVERSION="tags/v1.3.3" +SCVERSION="tags/v1.5.1" NETWORK_BASE_TAG="2044" diff --git a/config/quaz/quaz.compile b/config/quaz/quaz.compile new file mode 100644 index 00000000..c8eb99bc --- /dev/null +++ b/config/quaz/quaz.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --disable-dependency-tracking --enable-tests=no --without-gui --without-miniupnpc --with-incompatible-bdb CFLAGS="-march=native" LIBS="-lcurl -lssl -lcrypto -lz" +make +make install \ No newline at end of file diff --git a/config/quaz/quaz.conf b/config/quaz/quaz.conf new file mode 100644 index 00000000..f6bc79e5 --- /dev/null +++ b/config/quaz/quaz.conf @@ -0,0 +1,53 @@ +################################ +# basic settings +################################ +txindex=1 +logtimestamps=1 +listen=1 +daemon=1 +staking=0 +gen=0 +maxconnections=256 +bind=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX +externalip=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY +masternodeaddr=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX + +############################# +# nodes we want to stick to +############################# +addnode=104.207.141.159:11771 +addnode=45.32.192.99:11771 +addnode=45.32.19.50:11771 +addnode=45.32.122.97:11771 + +################################ +# masternode specific settings +################################ +masternode=1 +#### INSERT YOUR MASTERNODE PRIVATEKEY BELOW #################################################### +masternodeprivkey=HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_XXX_GIT_PROJECT_XXX_XXX_NUM_XXX +################################################################################################# +# +# b. +# 88b Insert your generated masternode privkey here +# 888b. +# 88888b +# 888888b. +# 8888P" +# P" `8. +# `8. +# `8 +################################################################################################# + +############################# +# optional indices +############################# + +############################# +# JSONRPC +############################# +server=1 +rpcuser=XXX_GIT_PROJECT_XXXrpc +rpcpassword=XXX_PASS_XXX +rpcallowip=127.0.0.1 +rpcport=555XXX_NUM_XXX \ No newline at end of file diff --git a/config/quaz/quaz.env b/config/quaz/quaz.env new file mode 100644 index 00000000..d9abb45d --- /dev/null +++ b/config/quaz/quaz.env @@ -0,0 +1,6 @@ +CODENAME=phore +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/phored} +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-11771} +GIT_URL=https://github.com/phoreproject/Phore.git +SCVERSION="tags/v1.2.0.0" +NETWORK_BASE_TAG="2044" diff --git a/config/snx/snx.compile b/config/snx/snx.compile new file mode 100644 index 00000000..c8eb99bc --- /dev/null +++ b/config/snx/snx.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --disable-dependency-tracking --enable-tests=no --without-gui --without-miniupnpc --with-incompatible-bdb CFLAGS="-march=native" LIBS="-lcurl -lssl -lcrypto -lz" +make +make install \ No newline at end of file diff --git a/config/snx/snx.conf b/config/snx/snx.conf new file mode 100644 index 00000000..5ae7a2f0 --- /dev/null +++ b/config/snx/snx.conf @@ -0,0 +1,49 @@ +################################ +# basic settings +################################ +txindex=1 +logtimestamps=1 +listen=1 +daemon=1 +staking=0 +gen=0 +maxconnections=256 +bind=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX +externalip=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY +masternodeaddr=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX + +############################# +# nodes we want to stick to +############################# + +################################ +# masternode specific settings +################################ +masternode=1 +#### INSERT YOUR MASTERNODE PRIVATEKEY BELOW #################################################### +masternodeprivkey=HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_XXX_GIT_PROJECT_XXX_XXX_NUM_XXX +################################################################################################# +# +# b. +# 88b Insert your generated masternode privkey here +# 888b. +# 88888b +# 888888b. +# 8888P" +# P" `8. +# `8. +# `8 +################################################################################################# + +############################# +# optional indices +############################# + +############################# +# JSONRPC +############################# +server=1 +rpcuser=XXX_GIT_PROJECT_XXXrpc +rpcpassword=XXX_PASS_XXX +rpcallowip=127.0.0.1 +rpcport=555XXX_NUM_XXX \ No newline at end of file diff --git a/config/snx/snx.env b/config/snx/snx.env new file mode 100644 index 00000000..67b04209 --- /dev/null +++ b/config/snx/snx.env @@ -0,0 +1,6 @@ +CODENAME=snx +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/snxd} +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-43101} +GIT_URL=https://github.com/ipedrero/snx.git +SCVERSION="master" +NETWORK_BASE_TAG="2044" diff --git a/config/vizeh/vizeh.compile b/config/vizeh/vizeh.compile new file mode 100644 index 00000000..c8eb99bc --- /dev/null +++ b/config/vizeh/vizeh.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --disable-dependency-tracking --enable-tests=no --without-gui --without-miniupnpc --with-incompatible-bdb CFLAGS="-march=native" LIBS="-lcurl -lssl -lcrypto -lz" +make +make install \ No newline at end of file diff --git a/config/vizeh/vizeh.conf b/config/vizeh/vizeh.conf new file mode 100644 index 00000000..6e161562 --- /dev/null +++ b/config/vizeh/vizeh.conf @@ -0,0 +1,49 @@ +################################ +# basic settings +################################ +txindex=1 +logtimestamps=1 +listen=1 +daemon=1 +staking=0 +gen=0 +maxconnections=256 +bind=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX +externalip=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY +masternodeaddr=XXX_IPV6_INT_BASE_XXX:XXX_NETWORK_BASE_TAG_XXX::XXX_NUM_XXY:XXX_MNODE_INBOUND_PORT_XXX + +############################# +# nodes we want to stick to +############################# + +################################ +# masternode specific settings +################################ +masternode=1 +#### INSERT YOUR MASTERNODE PRIVATEKEY BELOW #################################################### +masternodeprivkey=HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_XXX_GIT_PROJECT_XXX_XXX_NUM_XXX +################################################################################################# +# +# b. +# 88b Insert your generated masternode privkey here +# 888b. +# 88888b +# 888888b. +# 8888P" +# P" `8. +# `8. +# `8 +################################################################################################# + +############################# +# optional indices +############################# + +############################# +# JSONRPC +############################# +server=1 +rpcuser=XXX_GIT_PROJECT_XXXrpc +rpcpassword=XXX_PASS_XXX +rpcallowip=127.0.0.1 +rpcport=555XXX_NUM_XXX diff --git a/config/vizeh/vizeh.env b/config/vizeh/vizeh.env new file mode 100644 index 00000000..23710bc1 --- /dev/null +++ b/config/vizeh/vizeh.env @@ -0,0 +1,6 @@ +CODENAME=vizeh +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/vizehd} +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-28157} +GIT_URL=https://github.com/VIZEH-PROJECT/VIZEH.git +SCVERSION="tags/v2.2.1.1" +NETWORK_BASE_TAG="2044" diff --git a/config/zenzo/zenzo.compile b/config/zenzo/zenzo.compile new file mode 100644 index 00000000..c8eb99bc --- /dev/null +++ b/config/zenzo/zenzo.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --disable-dependency-tracking --enable-tests=no --without-gui --without-miniupnpc --with-incompatible-bdb CFLAGS="-march=native" LIBS="-lcurl -lssl -lcrypto -lz" +make +make install \ No newline at end of file diff --git a/config/zenzo/zenzo.env b/config/zenzo/zenzo.env new file mode 100644 index 00000000..43e62e7d --- /dev/null +++ b/config/zenzo/zenzo.env @@ -0,0 +1,6 @@ +CODENAME=zenzo +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/zenzod} +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-26210} +GIT_URL=https://github.com/Zenzo-Ecosystem/ZENZO-Core.git +SCVERSION="tags/v1.0.0" +NETWORK_BASE_TAG="2003" diff --git a/docs/images/masternode_vps/check-blocks-number.png b/docs/images/masternode_vps/check-blocks-number.png index 2293e785..0c8f93ef 100644 Binary files a/docs/images/masternode_vps/check-blocks-number.png and b/docs/images/masternode_vps/check-blocks-number.png differ diff --git a/docs/images/masternode_vps/check-masternode-status.png b/docs/images/masternode_vps/check-masternode-status.png index 2b53d359..976d74a9 100644 Binary files a/docs/images/masternode_vps/check-masternode-status.png and b/docs/images/masternode_vps/check-masternode-status.png differ diff --git a/docs/images/masternode_vps/end-of-installation.png b/docs/images/masternode_vps/end-of-installation.png index 9c7c3be3..04f45bbf 100644 Binary files a/docs/images/masternode_vps/end-of-installation.png and b/docs/images/masternode_vps/end-of-installation.png differ diff --git a/docs/images/masternode_vps/install-the-desired-masternode-and-amount.png b/docs/images/masternode_vps/install-the-desired-masternode-and-amount.png index 738f425d..f23f780f 100644 Binary files a/docs/images/masternode_vps/install-the-desired-masternode-and-amount.png and b/docs/images/masternode_vps/install-the-desired-masternode-and-amount.png differ diff --git a/docs/images/masternode_vps/rewards.png b/docs/images/masternode_vps/rewards.png index f6ecea11..1500d8ed 100644 Binary files a/docs/images/masternode_vps/rewards.png and b/docs/images/masternode_vps/rewards.png differ diff --git a/docs/images/masternode_vps/step1-newaddress.png b/docs/images/masternode_vps/step1-newaddress.png index 57fd54ec..7c7ab595 100644 Binary files a/docs/images/masternode_vps/step1-newaddress.png and b/docs/images/masternode_vps/step1-newaddress.png differ diff --git a/docs/images/masternode_vps/step1-newmasternodealias.png b/docs/images/masternode_vps/step1-newmasternodealias.png new file mode 100644 index 00000000..06c372ab Binary files /dev/null and b/docs/images/masternode_vps/step1-newmasternodealias.png differ diff --git a/docs/images/masternode_vps/step1-newmasternodealias_inputed.png b/docs/images/masternode_vps/step1-newmasternodealias_inputed.png new file mode 100644 index 00000000..26023fa6 Binary files /dev/null and b/docs/images/masternode_vps/step1-newmasternodealias_inputed.png differ diff --git a/docs/images/masternode_vps/step1-send10kphr.png b/docs/images/masternode_vps/step1-send10kphr.png index dfcb898f..8f361952 100644 Binary files a/docs/images/masternode_vps/step1-send10kphr.png and b/docs/images/masternode_vps/step1-send10kphr.png differ diff --git a/install.sh b/install.sh index 7351b3b9..9599e1a6 100755 --- a/install.sh +++ b/install.sh @@ -5,10 +5,10 @@ # ██║╚██╗██║██║ ██║██║ ██║██╔══╝ ██║╚██╔╝██║██╔══██║╚════██║ ██║ ██╔══╝ ██╔══██╗ # ██║ ╚████║╚██████╔╝██████╔╝███████╗██║ ╚═╝ ██║██║ ██║███████║ ██║ ███████╗██║ ██║ # ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ -# ╚╗ @marsmensch 2016-2018 ╔╝ -# -# version v0.9.4 -# date 2018-04-04 +# ╚╗ @marsmensch 2016-2018 ╔╝ +# +# version v1.0.0 +# date 2018-12-14 # # function: part of the masternode scripts, source the proper config file # @@ -16,7 +16,7 @@ # Run this script w/ the desired parameters. Leave blank or use -h for help. # # Platforms: -# - Linux Ubuntu 16.04 LTS ONLY on a Vultr, Hetzner or DigitalOcean VPS +# - Linux Ubuntu ONLY 16.04/18.04 LTS on a Vultr, Hetzner or DigitalOcean VPS # - Generic Ubuntu support will be added at a later point in time # # Twitter @marsmensch @@ -24,15 +24,18 @@ # Useful variables declare -r CRYPTOS=`ls -l config/ | egrep '^d' | awk '{print $9}' | xargs echo -n; echo` declare -r DATE_STAMP="$(date +%y-%m-%d-%s)" -declare -r SCRIPTPATH=$( cd $(dirname ${BASH_SOURCE[0]}) > /dev/null; pwd -P ) +declare -r SCRIPTPATH="$( cd $(dirname ${BASH_SOURCE[0]}) > /dev/null; pwd -P )" declare -r MASTERPATH="$(dirname "${SCRIPTPATH}")" -declare -r SCRIPT_VERSION="v0.9.4" +declare -r SCRIPT_VERSION="v1.0.0" declare -r SCRIPT_LOGFILE="/tmp/nodemaster_${DATE_STAMP}_out.log" declare -r IPV4_DOC_LINK="https://www.vultr.com/docs/add-secondary-ipv4-address" declare -r DO_NET_CONF="/etc/network/interfaces.d/50-cloud-init.cfg" +declare -r NETWORK_BASE_TAG="$(dd if=/dev/urandom bs=2 count=1 2>/dev/null | od -x -A n | sed -e 's/^[[:space:]]*//g')" function showbanner() { -cat << "EOF" + + echo $(tput bold)$(tput setaf 2) + cat << "EOF" ███╗ ██╗ ██████╗ ██████╗ ███████╗███╗ ███╗ █████╗ ███████╗████████╗███████╗██████╗ ████╗ ██║██╔═══██╗██╔══██╗██╔════╝████╗ ████║██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██╗ ██╔██╗ ██║██║ ██║██║ ██║█████╗ ██╔████╔██║███████║███████╗ ██║ █████╗ ██████╔╝ @@ -41,6 +44,9 @@ cat << "EOF" ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚╗ @marsmensch 2016-2018 ╔╝ EOF + echo "$(tput sgr0)$(tput setaf 3)Have fun, this is crypto after all!$(tput sgr0)" + echo "$(tput setaf 6)Donations for @marsmensch (BTC): 33ENWZ9RCYBG7nv6ac8KxBUSuQX64Hx3x3" + } # /* @@ -49,22 +55,25 @@ EOF # */ # function get_confirmation() { + # call with a prompt string or use a default read -r -p "${1:-Are you sure? [y/N]} " response case "$response" in [yY][eE][sS]|[yY]) true - ;; + ;; *) false - ;; + ;; esac + } # # /* no parameters, displays the help message */ # function show_help(){ + clear showbanner echo "install.sh, version $SCRIPT_VERSION"; @@ -80,63 +89,77 @@ function show_help(){ echo "-w or --wipe: Wipe ALL local data for a node type. Combine with the -p option"; echo "-u or --update: Update a specific masternode daemon. Combine with the -p option"; echo "-r or --release: Release version to be installed."; - echo "-x or --startnodes: Start masternodes after installation to sync with blockchain"; + echo "-k or --key: Set private key to masternode configuration files directly"; + echo "-x or --startnodes: Start masternodes after installation to sync with blockchain"; + echo "-g or --generate: Generate masternode private key and use" exit 1; + } # # /* no parameters, checks if we are running on a supported Ubuntu release */ # function check_distro() { - # currently only for Ubuntu 16.04 - if [[ -r /etc/os-release ]]; then - . /etc/os-release - if [[ "${VERSION_ID}" != "16.04" ]]; then - echo "This script only supports ubuntu 16.04 LTS, exiting." - exit 1 - fi - else - # no, thats not ok! - echo "This script only supports ubuntu 16.04 LTS, exiting." - exit 1 - fi + + # currently only for Ubuntu 16.04 & 18.04 + if [[ -r /etc/os-release ]]; then + . /etc/os-release + if [[ "${VERSION_ID}" != "16.04" ]] && [[ "${VERSION_ID}" != "18.04" ]] ; then + echo "This script only supports Ubuntu 16.04 & 18.04 LTS, exiting." + exit 1 + fi + else + # no, thats not ok! + echo "This script only supports Ubuntu 16.04 & 18.04 LTS, exiting." + exit 1 + fi + } # # /* no parameters, installs the base set of packages that are required for all projects */ # function install_packages() { - # development and build packages - # these are common on all cryptos - echo "* Package installation!" - apt-get -qq -o=Dpkg::Use-Pty=0 -o=Acquire::ForceIPv4=true update - apt-get -qqy -o=Dpkg::Use-Pty=0 -o=Acquire::ForceIPv4=true install build-essential g++ \ - protobuf-compiler libboost-all-dev autotools-dev \ - automake libcurl4-openssl-dev libboost-all-dev libssl-dev libdb++-dev \ - make autoconf automake libtool git apt-utils libprotobuf-dev pkg-config \ - libcurl3-dev libudev-dev libqrencode-dev bsdmainutils pkg-config libssl-dev \ - libgmp3-dev libevent-dev jp2a pv virtualenv &>> ${SCRIPT_LOGFILE} + + # development and build packages + # these are common on all cryptos + echo "* Package installation!" + add-apt-repository -yu ppa:bitcoin/bitcoin &>> ${SCRIPT_LOGFILE} + apt-get -qq -o=Dpkg::Use-Pty=0 -o=Acquire::ForceIPv4=true update &>> ${SCRIPT_LOGFILE} + apt-get -qqy -o=Dpkg::Use-Pty=0 -o=Acquire::ForceIPv4=true install build-essential \ + libcurl4-gnutls-dev protobuf-compiler libboost-all-dev autotools-dev automake \ + libboost-all-dev libssl-dev make autoconf libtool git apt-utils g++ \ + libprotobuf-dev pkg-config libudev-dev libqrencode-dev bsdmainutils \ + pkg-config libgmp3-dev libevent-dev jp2a pv virtualenv libdb4.8-dev libdb4.8++-dev &>> ${SCRIPT_LOGFILE} + + # only for 18.04 // openssl + if [[ "${VERSION_ID}" == "18.04" ]] ; then + apt-get -qqy -o=Dpkg::Use-Pty=0 -o=Acquire::ForceIPv4=true install libssl1.0-dev + fi + } # # /* no parameters, creates and activates a swapfile since VPS servers often do not have enough RAM for compilation */ # function swaphack() { -#check if swap is available -if [ $(free | awk '/^Swap:/ {exit !$2}') ] || [ ! -f "/var/mnode_swap.img" ];then - echo "* No proper swap, creating it" - # needed because ant servers are ants - rm -f /var/mnode_swap.img - dd if=/dev/zero of=/var/mnode_swap.img bs=1024k count=${MNODE_SWAPSIZE} &>> ${SCRIPT_LOGFILE} - chmod 0600 /var/mnode_swap.img - mkswap /var/mnode_swap.img &>> ${SCRIPT_LOGFILE} - swapon /var/mnode_swap.img &>> ${SCRIPT_LOGFILE} - echo '/var/mnode_swap.img none swap sw 0 0' | tee -a /etc/fstab &>> ${SCRIPT_LOGFILE} - echo 'vm.swappiness=10' | tee -a /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo 'vm.vfs_cache_pressure=50' | tee -a /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} -else - echo "* All good, we have a swap" -fi + + #check if swap is available + if [ $(free | awk '/^Swap:/ {exit !$2}') ] || [ ! -f "/var/mnode_swap.img" ];then + echo "* No proper swap, creating it" + # needed because ant servers are ants + rm -f /var/mnode_swap.img + dd if=/dev/zero of=/var/mnode_swap.img bs=1024k count=${MNODE_SWAPSIZE} &>> ${SCRIPT_LOGFILE} + chmod 0600 /var/mnode_swap.img + mkswap /var/mnode_swap.img &>> ${SCRIPT_LOGFILE} + swapon /var/mnode_swap.img &>> ${SCRIPT_LOGFILE} + echo '/var/mnode_swap.img none swap sw 0 0' | tee -a /etc/fstab &>> ${SCRIPT_LOGFILE} + echo 'vm.swappiness=10' | tee -a /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo 'vm.vfs_cache_pressure=50' | tee -a /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + else + echo "* All good, we have a swap" + fi + } # @@ -162,12 +185,12 @@ function create_mn_dirs() { # individual data dirs for now to avoid problems echo "* Creating masternode directories" mkdir -p ${MNODE_CONF_BASE} - for NUM in $(seq 1 ${count}); do - if [ ! -d "${MNODE_DATA_BASE}/${CODENAME}${NUM}" ]; then - echo "creating data directory ${MNODE_DATA_BASE}/${CODENAME}${NUM}" &>> ${SCRIPT_LOGFILE} - mkdir -p ${MNODE_DATA_BASE}/${CODENAME}${NUM} &>> ${SCRIPT_LOGFILE} + for NUM in $(seq 1 ${count}); do + if [ ! -d "${MNODE_DATA_BASE}/${CODENAME}${NUM}" ]; then + echo "creating data directory ${MNODE_DATA_BASE}/${CODENAME}${NUM}" &>> ${SCRIPT_LOGFILE} + mkdir -p ${MNODE_DATA_BASE}/${CODENAME}${NUM} &>> ${SCRIPT_LOGFILE} fi - done + done } @@ -176,39 +199,45 @@ function create_mn_dirs() { # function create_sentinel_setup() { - # if code directory does not exists, we create it clone the src - if [ ! -d /usr/share/sentinel ]; then - cd /usr/share &>> ${SCRIPT_LOGFILE} - git clone https://github.com/dashpay/sentinel.git sentinel &>> ${SCRIPT_LOGFILE} - cd sentinel &>> ${SCRIPT_LOGFILE} - rm -f rm sentinel.conf &>> ${SCRIPT_LOGFILE} - else - echo "* Updating the existing sentinel GIT repo" - cd /usr/share/sentinel &>> ${SCRIPT_LOGFILE} - git pull &>> ${SCRIPT_LOGFILE} - rm -f rm sentinel.conf &>> ${SCRIPT_LOGFILE} - fi - - # create a globally accessible venv and install sentinel requirements - virtualenv --system-site-packages /usr/share/sentinelvenv &>> ${SCRIPT_LOGFILE} - /usr/share/sentinelvenv/bin/pip install -r requirements.txt &>> ${SCRIPT_LOGFILE} + SENTINEL_BASE=/usr/share/sentinel + SENTINEL_ENV=/usr/share/sentinelenv + + # if code directory does not exists, we create it clone the src + if [ ! -d ${SENTINEL_BASE} ]; then + cd /usr/share &>> ${SCRIPT_LOGFILE} + git clone https://github.com/dashpay/sentinel.git sentinel &>> ${SCRIPT_LOGFILE} + cd sentinel &>> ${SCRIPT_LOGFILE} + rm -f rm sentinel.conf &>> ${SCRIPT_LOGFILE} + else + echo "* Updating the existing sentinel GIT repo" + cd ${SENTINEL_BASE} &>> ${SCRIPT_LOGFILE} + git pull &>> ${SCRIPT_LOGFILE} + rm -f rm sentinel.conf &>> ${SCRIPT_LOGFILE} + fi + + # create a globally accessible venv and install sentinel requirements + virtualenv --system-site-packages ${SENTINEL_BASE} &>> ${SCRIPT_LOGFILE} + ${SENTINEL_BASE}/bin/pip install -r requirements.txt &>> ${SCRIPT_LOGFILE} # create one sentinel config file per masternode - for NUM in $(seq 1 ${count}); do - if [ ! -f "/usr/share/sentinel/${CODENAME}${NUM}_sentinel.conf" ]; then - echo "* Creating sentinel configuration for ${CODENAME} masternode number ${NUM}" &>> ${SCRIPT_LOGFILE} - echo "dash_conf=${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf" > /usr/share/sentinel/${CODENAME}${NUM}_sentinel.conf - echo "network=mainnet" >> /usr/share/sentinel/${CODENAME}${NUM}_sentinel.conf - echo "db_name=database/${CODENAME}_${NUM}_sentinel.db" >> /usr/share/sentinel/${CODENAME}${NUM}_sentinel.conf - echo "db_driver=sqlite" >> /usr/share/sentinel/${CODENAME}${NUM}_sentinel.conf + for NUM in $(seq 1 ${count}); do + if [ ! -f "${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf" ]; then + echo "* Creating sentinel configuration for ${CODENAME} masternode number ${NUM}" &>> ${SCRIPT_LOGFILE} + echo "dash_conf=${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf" > ${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf + echo "network=mainnet" >> ${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf + echo "db_name=database/${CODENAME}_${NUM}_sentinel.db" >> ${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf + echo "db_driver=sqlite" >> ${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf fi - done + done - echo "Generated a Sentinel config for you. To activate Sentinel run" - echo "export SENTINEL_CONFIG=${MNODE_CONF_BASE}/${CODENAME}${NUM}_sentinel.conf; /usr/share/sentinelvenv/bin/python /usr/share/sentinel/bin/sentinel.py" + export SENTINEL_CONFIG=${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf; cd ${SENTINEL_BASE} && ${SENTINEL_ENV}/bin/python ${SENTINEL_BASE}/bin/sentinel.py + + + echo "$(tput sgr0)$(tput setaf 3)Generated a Sentinel config for you. To activate Sentinel run:$(tput sgr0)" + echo "$(tput sgr0)$(tput setaf 2)export SENTINEL_CONFIG=${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf; cd ${SENTINEL_BASE} && ${SENTINEL_ENV}/bin/python ${SENTINEL_BASE}/bin/sentinel.py$(tput sgr0)" echo "" - echo "If it works, add the command as cronjob: " - echo "* * * * * export SENTINEL_CONFIG=${MNODE_CONF_BASE}/${CODENAME}${NUM}_sentinel.conf; /usr/share/sentinelvenv/bin/python /usr/share/sentinel/bin/sentinel.py 2>&1 >> /var/log/sentinel/sentinel-cron.log" + echo "$(tput sgr0)$(tput setaf 2)If it works, add the command as cronjob: $(tput sgr0)" + echo "$(tput sgr0)$(tput setaf 2)* * * * * export SENTINEL_CONFIG=${SENTINEL_BASE}/${CODENAME}${NUM}_sentinel.conf; cd ${SENTINEL_BASE} && ${SENTINEL_ENV}/bin/python ${SENTINEL_BASE}/bin/sentinel.py >> /var/log/sentinel/sentinel-cron.log$(tput sgr0) 2>&1" } @@ -218,16 +247,16 @@ function create_sentinel_setup() { function configure_firewall() { echo "* Configuring firewall rules" - # disallow everything except ssh and masternode inbound ports - ufw default deny &>> ${SCRIPT_LOGFILE} - ufw logging on &>> ${SCRIPT_LOGFILE} - ufw allow ${SSH_INBOUND_PORT}/tcp &>> ${SCRIPT_LOGFILE} - # KISS, its always the same port for all interfaces - ufw allow ${MNODE_INBOUND_PORT}/tcp &>> ${SCRIPT_LOGFILE} - # This will only allow 6 connections every 30 seconds from the same IP address. - ufw limit OpenSSH &>> ${SCRIPT_LOGFILE} - ufw --force enable &>> ${SCRIPT_LOGFILE} - echo "* Firewall ufw is active and enabled on system startup" + # disallow everything except ssh and masternode inbound ports + ufw default deny &>> ${SCRIPT_LOGFILE} + ufw logging on &>> ${SCRIPT_LOGFILE} + ufw allow ${SSH_INBOUND_PORT}/tcp &>> ${SCRIPT_LOGFILE} + # KISS, its always the same port for all interfaces + ufw allow ${MNODE_INBOUND_PORT}/tcp &>> ${SCRIPT_LOGFILE} + # This will only allow 6 connections every 30 seconds from the same IP address. + ufw limit OpenSSH &>> ${SCRIPT_LOGFILE} + ufw --force enable &>> ${SCRIPT_LOGFILE} + echo "* Firewall ufw is active and enabled on system startup" } @@ -238,18 +267,18 @@ function validate_netchoice() { echo "* Validating network rules" - # break here of net isn't 4 or 6 - if [ ${net} -ne 4 ] && [ ${net} -ne 6 ]; then - echo "invalid NETWORK setting, can only be 4 or 6!" - exit 1; - fi + # break here of net isn't 4 or 6 + if [ ${net} -ne 4 ] && [ ${net} -ne 6 ]; then + echo "invalid NETWORK setting, can only be 4 or 6!" + exit 1; + fi - # generate the required ipv6 config - if [ "${net}" -eq 4 ]; then - IPV6_INT_BASE="#NEW_IPv4_ADDRESS_FOR_MASTERNODE_NUMBER" - NETWORK_BASE_TAG="" - echo "IPv4 address generation needs to be done manually atm!" &>> ${SCRIPT_LOGFILE} - fi # end ifneteq4 + # Generate IPv4 Address + if [ "${net}" -eq 4 ]; then + IPV6_INT_BASE="#NEW_IPv4_ADDRESS_FOR_MASTERNODE_NUMBER" + IPV4_ADDRESS=$(curl -s inet-ip.info) + echo "IPv4 address: ${IPV4_ADDRESS} was configured with inet-ip.info. You can't host multiple ${CODENAME} masternodes with same IPv4 address: ${IPV4_ADDRESS}." &>> ${SCRIPT_LOGFILE} + fi # end ifneteq4 } @@ -259,77 +288,142 @@ function validate_netchoice() { # function create_mn_configuration() { - # always return to the script root - cd ${SCRIPTPATH} - for NUM in $(seq 1 ${count}); do - if [ -n "${PRIVKEY[${NUM}]}" ]; then + # always return to the script root + cd ${SCRIPTPATH} + + # recode inputed private key to tmp.txt, check the keys + for NUM in $(seq 1 ${count}); do + if [ -n "${PRIVKEY[${NUM}]}" ]; then echo ${PRIVKEY[${NUM}]} >> tmp.txt - fi - done - if [ -f tmp.txt ]; then - dup=$(sort -t 8 tmp.txt | uniq -c | sort -nr | head -1 | awk '{print substr($0, 7, 1)}') - if [ 1 -ne "$dup" ]; then - echo "Private key was duplicated. Please restart this script." - rm -r /etc/masternodes - rm tmp.txt - exit 1 - fi + fi + done + + if [ -f tmp.txt ]; then + dup=$(sort -t 8 tmp.txt | uniq -c | sort -nr | head -1 | awk '{print substr($0, 7, 1)}') + if [ 1 -ne "$dup" ]; then + echo "Private key was duplicated. Please restart this script." + rm -r /etc/masternodes rm tmp.txt + exit 1 fi + rm tmp.txt + fi - # create one config file per masternode - for NUM in $(seq 1 ${count}); do + # create one config file per masternode + for NUM in $(seq 1 ${count}); do PASS=$(date | md5sum | cut -c1-24) - # we dont want to overwrite an existing config file - if [ ! -f ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf ]; then - echo "individual masternode config doesn't exist, generate it!" &>> ${SCRIPT_LOGFILE} - # if a template exists, use this instead of the default - if [ -e config/${CODENAME}/${CODENAME}.conf ]; then - echo "custom configuration template for ${CODENAME} found, use this instead" &>> ${SCRIPT_LOGFILE} - cp ${SCRIPTPATH}/config/${CODENAME}/${CODENAME}.conf ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf &>> ${SCRIPT_LOGFILE} - else - echo "No ${CODENAME} template found, using the default configuration template" &>> ${SCRIPT_LOGFILE} - cp ${SCRIPTPATH}/config/default.conf ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf &>> ${SCRIPT_LOGFILE} - fi - # replace placeholders - echo "running sed on file ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf" &>> ${SCRIPT_LOGFILE} - fi - + # we dont want to overwrite an existing config file + if [ ! -f ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf ]; then + echo "individual masternode config doesn't exist, generate it!" &>> ${SCRIPT_LOGFILE} + + # if a template exists, use this instead of the default + if [ -e config/${CODENAME}/${CODENAME}.conf ]; then + echo "custom configuration template for ${CODENAME} found, use this instead" &>> ${SCRIPT_LOGFILE} + cp ${SCRIPTPATH}/config/${CODENAME}/${CODENAME}.conf ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf &>> ${SCRIPT_LOGFILE} + else + echo "No ${CODENAME} template found, using the default configuration template" &>> ${SCRIPT_LOGFILE} + cp ${SCRIPTPATH}/config/default.conf ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf &>> ${SCRIPT_LOGFILE} + fi + + # replace placeholders + echo "running sed on file ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf" &>> ${SCRIPT_LOGFILE} + fi + + # Write inputed private key to project.conf if [ -n "${PRIVKEY[${NUM}]}" ]; then - if [ ${#PRIVKEY[${NUM}]} -eq 51 ]; then - sed -e "s/HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_XXX_GIT_PROJECT_XXX_XXX_NUM_XXX/${PRIVKEY[${NUM}]}/" -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf - else - echo "input private key ${PRIVKEY[${NUM}]} was invalid. Please check the key, and restart this script." - rm -r /etc/masternodes - exit 1 - fi + if [ ${#PRIVKEY[${NUM}]} -eq 51 ]; then + sed -e "s/HERE_GOES_YOUR_MASTERNODE_KEY_FOR_MASTERNODE_XXX_GIT_PROJECT_XXX_XXX_NUM_XXX/${PRIVKEY[${NUM}]}/" -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf + else + echo "input private key ${PRIVKEY[${NUM}]} was invalid. Please check the key, and restart this script." + rm -r /etc/masternodes + exit 1 + fi else : fi - sed -e "s/XXX_GIT_PROJECT_XXX/${CODENAME}/" -e "s/XXX_NUM_XXY/${NUM}]/" -e "s/XXX_NUM_XXX/${NUM}/" -e "s/XXX_PASS_XXX/${PASS}/" -e "s/XXX_IPV6_INT_BASE_XXX/[${IPV6_INT_BASE}/" -e "s/XXX_NETWORK_BASE_TAG_XXX/${NETWORK_BASE_TAG}/" -e "s/XXX_MNODE_INBOUND_PORT_XXX/${MNODE_INBOUND_PORT}/" -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf - if [ -z "${PRIVKEY[${NUM}]}" ]; then - if [ "$startnodes" -eq 1 ]; then - #uncomment masternode= and masternodeprivkey= so the node can autostart and sync - sed 's/\(^.*masternode\(\|privkey\)=.*$\)/#\1/' -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf - fi - fi - done + if [ ${net} -eq 4 ]; then + sed -e "s/XXX_GIT_PROJECT_XXX/${CODENAME}/" -e "s/XXX_NUM_XXY//" -e "s/XXX_NUM_XXX/${NUM}/" -e "s/XXX_PASS_XXX/${PASS}/" -e "s/XXX_IPV6_INT_BASE_XXX/${IPV4_ADDRESS}/" -e "s/:XXX_NETWORK_BASE_TAG_XXX:://" -e "s/XXX_MNODE_INBOUND_PORT_XXX/${MNODE_INBOUND_PORT}/" -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf + else + sed -e "s/XXX_GIT_PROJECT_XXX/${CODENAME}/" -e "s/XXX_NUM_XXY/${NUM}]/" -e "s/XXX_NUM_XXX/${NUM}/" -e "s/XXX_PASS_XXX/${PASS}/" -e "s/XXX_IPV6_INT_BASE_XXX/[${IPV6_INT_BASE}/" -e "s/XXX_NETWORK_BASE_TAG_XXX/${NETWORK_BASE_TAG}/" -e "s/XXX_MNODE_INBOUND_PORT_XXX/${MNODE_INBOUND_PORT}/" -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf + fi + if [ -z "${PRIVKEY[${NUM}]}" ]; then + if [ "$startnodes" -eq 1 ]; then + #uncomment masternode= and masternodeprivkey= so the node can autostart and sync + sed 's/\(^.*masternode\(\|privkey\)=.*$\)/#\1/' -i ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf + fi + fi + done + } # # /* no parameters, generates a masternode configuration file per masternode in the default */ # function create_control_configuration() { - # delete any old stuff that's still around - rm -f /tmp/${CODENAME}_masternode.conf &>> ${SCRIPT_LOGFILE} - # create one line per masternode with the data we have - for NUM in $(seq 1 ${count}); do - if [ -n "${PRIVKEY[${NUM}]}" ]; then - echo ${CODENAME}MN${NUM} [${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}]:${MNODE_INBOUND_PORT} ${PRIVKEY[${NUM}]} COLLATERAL_TX_FOR_${CODENAME}MN${NUM} OUTPUT_NO_FOR_${CODENAME}MN${NUM} >> /tmp/${CODENAME}_masternode.conf - else - echo ${CODENAME}MN${NUM} [${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}]:${MNODE_INBOUND_PORT} MASTERNODE_PRIVKEY_FOR_${CODENAME}MN${NUM} COLLATERAL_TX_FOR_${CODENAME}MN${NUM} OUTPUT_NO_FOR_${CODENAME}MN${NUM} >> /tmp/${CODENAME}_masternode.conf - fi - done + + # delete any old stuff that's still around + rm -f /tmp/${CODENAME}_masternode.conf &>> ${SCRIPT_LOGFILE} + + # create one line per masternode with the data we have + for NUM in $(seq 1 ${count}); do + if [ -n "${PRIVKEY[${NUM}]}" ]; then + PRIVKEY[${NUM}]=$(cat ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf | grep masternodeprivkey) + PRIVKEY[${NUM}]=${PRIVKEY[${NUM}]:18} + echo ${CODENAME}MN${NUM} [${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}]:${MNODE_INBOUND_PORT} ${PRIVKEY[${NUM}]} COLLATERAL_TX_FOR_${CODENAME}MN${NUM} OUTPUT_NO_FOR_${CODENAME}MN${NUM} >> /tmp/${CODENAME}_masternode.conf + else + echo ${CODENAME}MN${NUM} [${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}]:${MNODE_INBOUND_PORT} MASTERNODE_PRIVKEY_FOR_${CODENAME}MN${NUM} COLLATERAL_TX_FOR_${CODENAME}MN${NUM} OUTPUT_NO_FOR_${CODENAME}MN${NUM} >> /tmp/${CODENAME}_masternode.conf + fi + done + + # add well layout text for GUI Configuration + rm -f /tmp/${CODENAME}_gui.conf &>> ${SCRIPT_LOGFILE} + + for NUM in $(seq 1 ${count}); do + if [ -n "${PRIVKEY[${NUM}]}" ]; then + PRIVKEY[${NUM}]=$(cat ${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf | grep masternodeprivkey) + PRIVKEY[${NUM}]=${PRIVKEY[${NUM}]:18} + if [ "${net}" -eq 4 ]; then + cat >> /tmp/${CODENAME}_gui.conf <> /tmp/${CODENAME}_gui.conf <> /tmp/${CODENAME}_gui.conf <> /tmp/${CODENAME}_gui.conf <> ${SCRIPT_LOGFILE} - cat > ${SYSTEMD_CONF}/${CODENAME}_n${NUM}.service <<-EOF - [Unit] - Description=${CODENAME} distributed currency daemon - After=network.target - - [Service] - User=${MNODE_USER} - Group=${MNODE_USER} - - Type=forking - PIDFile=${MNODE_DATA_BASE}/${CODENAME}${NUM}/${CODENAME}.pid - ExecStart=${MNODE_DAEMON} -daemon -pid=${MNODE_DATA_BASE}/${CODENAME}${NUM}/${CODENAME}.pid \ - -conf=${MNODE_CONF_BASE}/${CODENAME}_n${NUM}.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}${NUM} - - Restart=always - RestartSec=5 - PrivateTmp=true - TimeoutStopSec=60s - TimeoutStartSec=5s - StartLimitInterval=120s - StartLimitBurst=15 - - [Install] - WantedBy=multi-user.target - EOF - done + # create one config file per masternode + for NUM in $(seq 1 ${count}); do + PASS=$(date | md5sum | cut -c1-24) + echo "* (over)writing systemd config file ${SYSTEMD_CONF}/${CODENAME}_n${NUM}.service" &>> ${SCRIPT_LOGFILE} + cat > ${SYSTEMD_CONF}/${CODENAME}_n${NUM}.service <> ${SCRIPT_LOGFILE} - # make group permissions same as user, so vps-user can be added to masternode group - chmod -R g=u ${MNODE_CONF_BASE} ${MNODE_DATA_BASE} /var/log/sentinel &>> ${SCRIPT_LOGFILE} + # maybe add a sudoers entry later + mkdir -p /var/log/sentinel &>> ${SCRIPT_LOGFILE} + chown -R ${MNODE_USER}:${MNODE_USER} ${MNODE_CONF_BASE} ${MNODE_DATA_BASE} /var/log/sentinel ${SENTINEL_BASE}/database &>> ${SCRIPT_LOGFILE} + # make group permissions same as user, so vps-user can be added to masternode group + chmod -R g=u ${MNODE_CONF_BASE} ${MNODE_DATA_BASE} /var/log/sentinel &>> ${SCRIPT_LOGFILE} } @@ -388,33 +482,37 @@ function set_permissions() { # function wipe_all() { - echo "Deleting all ${project} related data!" - rm -f /etc/masternodes/${project}_n*.conf - rmdir --ignore-fail-on-non-empty -p /var/lib/masternodes/${project}* - rm -f /etc/systemd/system/${project}_n*.service - rm -f ${MNODE_DAEMON} - echo "DONE!" - exit 0 + echo "Deleting all ${project} related data!" + rm -f /etc/masternodes/${project}_n*.conf + rmdir --ignore-fail-on-non-empty -p /var/lib/masternodes/${project}* + rm -f /etc/systemd/system/${project}_n*.service + rm -f ${MNODE_DAEMON} + echo "DONE!" + exit 0 } # -#Generate masternode private key +# /* +# Generate masternode private key +# */ # function generate_privkey() { - echo -e "rpcuser=test\nrpcpassword=passtest" >> ${MNODE_CONF_BASE}/${CODENAME}_test.conf - mkdir -p ${MNODE_DATA_BASE}/${CODENAME}_test - phored -daemon -conf=${MNODE_CONF_BASE}/${CODENAME}_test.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}_test - sleep 5 - - for NUM in $(seq 1 ${count}); do - if [ -z "${PRIVKEY[${NUM}]}" ]; then - PRIVKEY[${NUM}]=$(phore-cli -conf=${MNODE_CONF_BASE}/${CODENAME}_test.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}_test masternode genkey) - fi - done - phore-cli -conf=${MNODE_CONF_BASE}/${CODENAME}_test.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}_test stop - sleep 5 - rm -r ${MNODE_CONF_BASE}/${CODENAME}_test.conf ${MNODE_DATA_BASE}/${CODENAME}_test + + echo -e "rpcuser=test\nrpcpassword=passtest" >> ${MNODE_CONF_BASE}/${CODENAME}_test.conf + mkdir -p ${MNODE_DATA_BASE}/${CODENAME}_test + ${CODENAME}d -daemon -conf=${MNODE_CONF_BASE}/${CODENAME}_test.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}_test + sleep 20 + + for NUM in $(seq 1 ${count}); do + if [ -z "${PRIVKEY[${NUM}]}" ]; then + PRIVKEY[${NUM}]=$(${CODENAME}-cli -conf=${MNODE_CONF_BASE}/${CODENAME}_test.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}_test masternode genkey) + fi + done + ${CODENAME}-cli -conf=${MNODE_CONF_BASE}/${CODENAME}_test.conf -datadir=${MNODE_DATA_BASE}/${CODENAME}_test stop + sleep 5 + rm -r ${MNODE_CONF_BASE}/${CODENAME}_test.conf ${MNODE_DATA_BASE}/${CODENAME}_test + } # @@ -425,23 +523,23 @@ function generate_privkey() { # function cleanup_after() { - apt-get -qqy -o=Dpkg::Use-Pty=0 --force-yes autoremove - apt-get -qqy -o=Dpkg::Use-Pty=0 --force-yes autoclean - - echo "kernel.randomize_va_space=1" > /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.conf.all.rp_filter=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.conf.all.accept_source_route=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.icmp_echo_ignore_broadcasts=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.conf.all.log_martians=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.conf.default.log_martians=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.conf.all.accept_redirects=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv6.conf.all.accept_redirects=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.conf.all.send_redirects=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "kernel.sysrq=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.tcp_timestamps=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - echo "net.ipv4.icmp_ignore_bogus_error_responses=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} - sysctl -p + #apt-get -qqy -o=Dpkg::Use-Pty=0 --force-yes autoremove + apt-get -qqy -o=Dpkg::Use-Pty=0 --allow-downgrades --allow-change-held-packages autoclean + + echo "kernel.randomize_va_space=1" > /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.conf.all.rp_filter=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.conf.all.accept_source_route=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.icmp_echo_ignore_broadcasts=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.conf.all.log_martians=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.conf.default.log_martians=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.conf.all.accept_redirects=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv6.conf.all.accept_redirects=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.conf.all.send_redirects=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "kernel.sysrq=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.tcp_timestamps=0" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + echo "net.ipv4.icmp_ignore_bogus_error_responses=1" >> /etc/sysctl.conf &>> ${SCRIPT_LOGFILE} + sysctl -p } @@ -457,121 +555,144 @@ function source_config() { # first things first, to break early if things are missing or weird check_distro - if [ -f ${SETUP_CONF_FILE} ]; then - echo "Script version ${SCRIPT_VERSION}, you picked: ${project}" - echo "apply config file for ${project}" &>> ${SCRIPT_LOGFILE} - source "${SETUP_CONF_FILE}" - - # count is from the default config but can ultimately be - # overwritten at runtime - if [ -z "${count}" ] - then - count=${SETUP_MNODES_COUNT} - echo "No number given, installing default number of nodes: ${SETUP_MNODES_COUNT}" &>> ${SCRIPT_LOGFILE} - fi - - # release is from the default project config but can ultimately be - # overwritten at runtime - if [ -z "$release" ] - then - release=${SCVERSION} - echo "release empty, setting to project default: ${SCVERSION}" &>> ${SCRIPT_LOGFILE} - fi - - # net is from the default config but can ultimately be - # overwritten at runtime - if [ -z "${net}" ]; then - net=${NETWORK_TYPE} - echo "net EMPTY, setting to default: ${NETWORK_TYPE}" &>> ${SCRIPT_LOGFILE} - fi - - # main block of function logic starts here - # if update flag was given, delete the old daemon binary first & proceed - if [ "$update" -eq 1 ]; then - echo "update given, deleting the old daemon NOW!" &>> ${SCRIPT_LOGFILE} - rm -f ${MNODE_DAEMON} - fi - - echo "************************* Installation Plan *****************************************" - echo "" - echo "I am going to install and configure " - echo "=> ${count} ${project} masternode(s) in version ${release}" - echo "for you now." - echo "" - echo "You have to add your masternode private key to the individual config files afterwards" - echo "" - echo "Stay tuned!" - echo "" - # show a hint for MANUAL IPv4 configuration - if [ "${net}" -eq 4 ]; then - NETWORK_TYPE=4 - echo "WARNING:" - echo "You selected IPv4 for networking but there is no automatic workflow for this part." - echo "This means you will have some mamual work to do to after this configuration run." - echo "" - echo "See the following link for instructions how to add multiple ipv4 addresses on vultr:" - echo "${IPV4_DOC_LINK}" - fi - # sentinel setup - if [ "$sentinel" -eq 1 ]; then - echo "I will also generate a Sentinel configuration for you." - fi - # start nodes after setup - if [ "$startnodes" -eq 1 ]; then - echo "I will start your masternodes after the installation." - fi - echo "" - echo "A logfile for this run can be found at the following location:" - echo "${SCRIPT_LOGFILE}" - echo "" - echo "*************************************************************************************" - sleep 5 - - # main routine - print_logo - prepare_mn_interfaces - swaphack - install_packages - build_mn_from_source - create_mn_user - create_mn_dirs - - # private key initialize - if [ "$generate" -eq 1 ]; then - echo "Generating masternode private key" &>> ${SCRIPT_LOGFILE} - generate_privkey - fi - - # sentinel setup - if [ "$sentinel" -eq 1 ]; then - echo "* Sentinel setup chosen" &>> ${SCRIPT_LOGFILE} - create_sentinel_setup - fi - - configure_firewall - create_mn_configuration - create_control_configuration - create_systemd_configuration - set_permissions - cleanup_after - showbanner - final_call - else - echo "required file ${SETUP_CONF_FILE} does not exist, abort!" - exit 1 - fi + if [ -f ${SETUP_CONF_FILE} ]; then + echo "Script version ${SCRIPT_VERSION}, you picked: $(tput bold)$(tput setaf 2) ${project} $(tput sgr0), running on Ubuntu ${VERSION_ID}" + echo "apply config file for ${project}" &>> ${SCRIPT_LOGFILE} + source "${SETUP_CONF_FILE}" + + # count is from the default config but can ultimately be + # overwritten at runtime + if [ -z "${count}" ] + then + count=${SETUP_MNODES_COUNT} + echo "No number given, installing default number of nodes: ${SETUP_MNODES_COUNT}" &>> ${SCRIPT_LOGFILE} + fi + + # release is from the default project config but can ultimately be + # overwritten at runtime + if [ -z "$release" ] + then + release=${SCVERSION} + echo "release empty, setting to project default: ${SCVERSION}" &>> ${SCRIPT_LOGFILE} + fi + + # net is from the default config but can ultimately be + # overwritten at runtime + if [ -z "${net}" ]; then + net=${NETWORK_TYPE} + echo "net EMPTY, setting to default: ${NETWORK_TYPE}" &>> ${SCRIPT_LOGFILE} + fi + + # main block of function logic starts here + # if update flag was given, delete the old daemon binary first & proceed + if [ "$update" -eq 1 ]; then + if [ ! -f ${MNODE_DAEMON} ]; then + echo "UPDATE FAILED! Daemon hasn't been found. Please try the normal installation process by omitting the upgrade parameter." + exit 1 + fi + if [ ! -f ${MNODE_HELPER}_${CODENAME} ]; then + echo "UPDATE FAILED! Masternode activation file ${MNODE_HELPER}_${CODENAME} hasn't been found. Please try the normal installation process by omitting the upgrade parameter." + exit 1 + fi + if [ ! -d ${MNODE_DATA_BASE} ]; then + echo "UPDATE FAILED! ${MNODE_DATA_BASE} hasn't been found. Please try the normal installation process by omitting the upgrade parameter." + exit 1 + fi + fi + + echo "************************* Installation Plan *****************************************" + echo "" + if [ "$update" -eq 1 ]; then + echo "I am going to update your existing" + echo "$(tput bold)$(tput setaf 2) => ${project} masternode(s) in version ${release} $(tput sgr0)" + else + echo "I am going to install and configure" + echo "$(tput bold)$(tput setaf 2) => ${count} ${project} masternode(s) in version ${release} $(tput sgr0)" + fi + echo "for you now." + echo "" + if [ "$update" -eq 0 ]; then + # only needed if fresh installation + echo "If you didn't set generate, key option, you have to add your masternode private key to the individual config files afterwards." + echo "" + fi + echo "" + echo "Stay tuned!" + echo "" + + # show a hint for MANUAL IPv4 configuration + if [ "${net}" -eq 4 ]; then + NETWORK_TYPE=4 + echo "CAUTION:" + echo "You selected IPv4 for networking. If you want to use 2nd IPv4 address, please edit each configuration file manually. Because this script only uses primary IPv4 address." + echo "See the following link for instructions how to add multiple ipv4 addresses on vultr:" + echo "${IPV4_DOC_LINK}" + fi + + # sentinel setup + if [ "$sentinel" -eq 1 ]; then + echo "I will also generate a Sentinel configuration for you." + fi + + # start nodes after setup + if [ "$startnodes" -eq 1 ]; then + echo "I will start your masternodes after the installation." + fi + echo "" + echo "A logfile for this run can be found at the following location:" + echo "${SCRIPT_LOGFILE}" + echo "" + echo "*************************************************************************************" + sleep 5 + + # main routine + if [ "$update" -eq 0 ]; then + prepare_mn_interfaces + swaphack + fi + install_packages + print_logo + build_mn_from_source + if [ "$update" -eq 0 ]; then + create_mn_user + create_mn_dirs + + # private key initialize + if [ "$generate" -eq 1 ]; then + echo "Generating masternode private key" &>> ${SCRIPT_LOGFILE} + generate_privkey + fi + + # sentinel setup + if [ "$sentinel" -eq 1 ]; then + echo "* Sentinel setup chosen" &>> ${SCRIPT_LOGFILE} + create_sentinel_setup + fi + configure_firewall + create_mn_configuration + create_control_configuration + create_systemd_configuration + fi + set_permissions + cleanup_after + showbanner + final_call + else + echo "required file ${SETUP_CONF_FILE} does not exist, abort!" + exit 1 + fi } function print_logo() { - # print ascii banner if a logo exists - echo -e "* Starting the compilation process for ${CODENAME}, stay tuned" - if [ -f "${SCRIPTPATH}/assets/$CODENAME.jpg" ]; then - jp2a -b --colors --width=56 ${SCRIPTPATH}/assets/${CODENAME}.jpg - else - jp2a -b --colors --width=56 ${SCRIPTPATH}/assets/default.jpg - fi + # print ascii banner if a logo exists + echo -e "* Starting the compilation process for ${CODENAME}, stay tuned" + if [ -f "${SCRIPTPATH}/assets/$CODENAME.jpg" ]; then + jp2a -b --colors --width=56 ${SCRIPTPATH}/assets/${CODENAME}.jpg + else + jp2a -b --colors --width=56 ${SCRIPTPATH}/assets/default.jpg + fi } @@ -579,76 +700,100 @@ function print_logo() { # /* no parameters, builds the required masternode binary from sources. Exits if already exists and "update" not given */ # function build_mn_from_source() { - # daemon not found compile it - if [ ! -f ${MNODE_DAEMON} ]; then - mkdir -p ${SCRIPTPATH}/${CODE_DIR} &>> ${SCRIPT_LOGFILE} - # if code directory does not exists, we create it clone the src - if [ ! -d ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} ]; then - mkdir -p ${CODE_DIR} && cd ${SCRIPTPATH}/${CODE_DIR} &>> ${SCRIPT_LOGFILE} - git clone ${GIT_URL} ${CODENAME} &>> ${SCRIPT_LOGFILE} - cd ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} &>> ${SCRIPT_LOGFILE} - echo "* Checking out desired GIT tag: ${release}" - git checkout ${release} &>> ${SCRIPT_LOGFILE} - else - echo "* Updating the existing GIT repo" - cd ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} &>> ${SCRIPT_LOGFILE} - git pull &>> ${SCRIPT_LOGFILE} - echo "* Checking out desired GIT tag: ${release}" - git checkout ${release} &>> ${SCRIPT_LOGFILE} - fi - - # print ascii banner if a logo exists - echo -e "* Starting the compilation process for ${CODENAME}, stay tuned" - if [ -f "${SCRIPTPATH}/assets/$CODENAME.jpg" ]; then - jp2a -b --colors --width=56 ${SCRIPTPATH}/assets/${CODENAME}.jpg - else - jp2a -b --colors --width=56 ${SCRIPTPATH}/assets/default.jpg - fi - # compilation starts here - source ${SCRIPTPATH}/config/${CODENAME}/${CODENAME}.compile | pv -t -i0.1 - else - echo "* Daemon already in place at ${MNODE_DAEMON}, not compiling" + # daemon not found compile it + if [ ! -f ${MNODE_DAEMON} ] || [ "$update" -eq 1 ]; then + # create code directory if it doesn't exist + if [ ! -d ${SCRIPTPATH}/${CODE_DIR} ]; then + mkdir -p ${SCRIPTPATH}/${CODE_DIR} &>> ${SCRIPT_LOGFILE} fi - - # if it's not available after compilation, theres something wrong - if [ ! -f ${MNODE_DAEMON} ]; then - echo "COMPILATION FAILED! Please open an issue at https://github.com/masternodes/vps/issues. Thank you!" + # if coin directory (CODENAME) exists, we remove it, to make a clean git clone + if [ -d ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} ]; then + echo "deleting ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} for clean cloning" &>> ${SCRIPT_LOGFILE} + rm -rf ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} &>> ${SCRIPT_LOGFILE} + fi + mkdir -p ${CODE_DIR} && cd ${SCRIPTPATH}/${CODE_DIR} &>> ${SCRIPT_LOGFILE} + git clone ${GIT_URL} ${CODENAME} &>> ${SCRIPT_LOGFILE} + cd ${SCRIPTPATH}/${CODE_DIR}/${CODENAME} &>> ${SCRIPT_LOGFILE} + echo "* Checking out desired GIT tag: ${release}" + git checkout ${release} &>> ${SCRIPT_LOGFILE} + + if [ "$update" -eq 1 ]; then + echo "update given, deleting the old daemon NOW!" &>> ${SCRIPT_LOGFILE} + rm -f ${MNODE_DAEMON} + # old daemon must be removed before compilation. Would be better to remove it afterwards, however not possible with current structure + if [ -f ${MNODE_DAEMON} ]; then + echo "UPDATE FAILED! Daemon ${MNODE_DAEMON} couldn't be removed. Please open an issue at https://github.com/masternodes/vps/issues. Thank you!" exit 1 + fi fi + + # compilation starts here + source ${SCRIPTPATH}/config/${CODENAME}/${CODENAME}.compile | pv -t -i0.1 + else + echo "* Daemon already in place at ${MNODE_DAEMON}, not compiling" + fi + + # if it's not available after compilation, theres something wrong + if [ ! -f ${MNODE_DAEMON} ]; then + echo "COMPILATION FAILED! Please open an issue at https://github.com/phoreproject/vps/issues. Thank you!" + exit 1 + fi + } # # /* no parameters, print some (hopefully) helpful advice */ # function final_call() { - # note outstanding tasks that need manual work + # note outstanding tasks that need manual work echo "************! ALMOST DONE !******************************" - echo "There is still work to do in the configuration templates." - echo "These are located at ${MNODE_CONF_BASE}, one per masternode." - echo "Add your masternode private keys now." - echo "eg in /etc/masternodes/${CODENAME}_n1.conf" - echo "" - echo "=> All configuration files are in: ${MNODE_CONF_BASE}" - echo "=> All Data directories are in: ${MNODE_DATA_BASE}" - echo "" - echo "last but not least, run /usr/local/bin/activate_masternodes_${CODENAME} as root to activate your nodes." + if [ "$update" -eq 0 ]; then + echo "There is still work to do in the configuration templates." + echo "These are located at ${MNODE_CONF_BASE}, one per masternode." + echo "If you didn't set generate or key option, add your masternode private keys now." + echo "eg in /etc/masternodes/${CODENAME}_n1.conf" + else + echo "Your ${CODENAME} masternode daemon has been updated! (but not yet activated)" + fi + echo "" + echo "=> $(tput bold)$(tput setaf 2) All configuration files are in: ${MNODE_CONF_BASE} $(tput sgr0)" + echo "=> $(tput bold)$(tput setaf 2) All Data directories are in: ${MNODE_DATA_BASE} $(tput sgr0)" + echo "" + echo "$(tput bold)$(tput setaf 1)Important:$(tput sgr0) run $(tput setaf 2) /usr/local/bin/activate_masternodes_${CODENAME} $(tput sgr0) as root to activate your nodes." # place future helper script accordingly - cp ${SCRIPTPATH}/scripts/activate_masternodes.sh ${MNODE_HELPER}_${CODENAME} - echo "">> ${MNODE_HELPER}_${CODENAME} - - for NUM in $(seq 1 ${count}); do - echo "systemctl enable ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} - echo "systemctl restart ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} - done - - chmod u+x ${MNODE_HELPER}_${CODENAME} - if [ "$startnodes" -eq 1 ]; then - echo "" - echo "** Your nodes are starting up. If you haven't set masternode private key, Don't forget to change the masternodeprivkey later." - ${MNODE_HELPER}_${CODENAME} - fi - tput sgr0 + if [ "$update" -eq 0 ]; then + cp ${SCRIPTPATH}/scripts/activate_masternodes.sh ${MNODE_HELPER}_${CODENAME} + echo "">> ${MNODE_HELPER}_${CODENAME} + + for NUM in $(seq 1 ${count}); do + echo "systemctl enable ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} + echo "systemctl restart ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} + done + + chmod u+x ${MNODE_HELPER}_${CODENAME} + fi + + if [ "$startnodes" -eq 1 ]; then + echo "" + echo "** Your nodes are starting up. If you haven't set masternode private key, Don't forget to change the masternodeprivkey later." + ${MNODE_HELPER}_${CODENAME} + fi + echo "**ALL YOUR MASTERNODE CONFIGURATION IS HERE. INPUT THESE LINES TO YOUR MASTERNODE.CONF**" + echo "" + cat /tmp/${CODENAME}_masternode.conf + echo "" + echo "**This configuration lines are on /tmp/${CODENAME}_masternode.conf. You can check this file with**" + echo "" + echo "cat /tmp/${CODENAME}_masternode.conf" + cat /tmp/${CODENAME}_gui.conf + echo "" + echo "**For GUI Installation user, configuration files are on /tmp/${CODENAME}_gui.conf. You can check this file with**" + echo "" + echo "cat /tmp/${CODENAME}_gui.conf" + echo "" + tput sgr0 + } # @@ -667,6 +812,16 @@ function prepare_mn_interfaces() { export ETH_INTERFACE="eth0" fi + # check for the nuse case <3 + if [ -f /sys/class/net/ens160/operstate ]; then + export ETH_INTERFACE="ens160" + fi + + # check for scaleway - TODO + #if [ -f /sys/class/net/ens2/operstate ]; then + # export ETH_INTERFACE="ens2" + #fi + # get the current interface state ETH_STATUS=$(cat /sys/class/net/${ETH_INTERFACE}/operstate) @@ -680,58 +835,58 @@ function prepare_mn_interfaces() { # check for DO network config file if [ -f ${DO_NET_CONF} ]; then # found the DO config - if ! grep -q "::8888" ${DO_NET_CONF}; then - echo "ipv6 fix not found, applying!" - sed -i '/iface eth0 inet6 static/a dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888 8.8.8.8 127.0.0.1' ${DO_NET_CONF} - ifdown ${ETH_INTERFACE}; ifup ${ETH_INTERFACE}; - fi + if ! grep -q "::8888" ${DO_NET_CONF}; then + echo "ipv6 fix not found, applying!" + sed -i '/iface eth0 inet6 static/a dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888 8.8.8.8 127.0.0.1' ${DO_NET_CONF} + ifdown ${ETH_INTERFACE}; ifup ${ETH_INTERFACE}; + fi fi IPV6_INT_BASE="$(ip -6 addr show dev ${ETH_INTERFACE} | grep inet6 | awk -F '[ \t]+|/' '{print $3}' | grep -v ^fe80 | grep -v ^::1 | cut -f1-4 -d':' | head -1)" &>> ${SCRIPT_LOGFILE} - validate_netchoice - echo "IPV6_INT_BASE AFTER : ${IPV6_INT_BASE}" &>> ${SCRIPT_LOGFILE} + validate_netchoice + echo "IPV6_INT_BASE AFTER : ${IPV6_INT_BASE}" &>> ${SCRIPT_LOGFILE} # user opted for ipv6 (default), so we have to check for ipv6 support - # check for vultr ipv6 box active - if [ -z "${IPV6_INT_BASE}" ] && [ ${net} -ne 4 ]; then - echo "No IPv6 support on the VPS but IPv6 is the setup default. Please switch to ipv4 with flag \"-n 4\" if you want to continue." - echo "" - echo "See the following link for instructions how to add multiple ipv4 addresses on vultr:" - echo "${IPV4_DOC_LINK}" - exit 1 - fi - - # generate the required ipv6 config - if [ "${net}" -eq 6 ]; then + # check for vultr ipv6 box active + if [ -z "${IPV6_INT_BASE}" ] && [ ${net} -ne 4 ]; then + echo "No IPv6 support on the VPS but IPv6 is the setup default. Please switch to ipv4 with flag \"-n 4\" if you want to continue." + echo "" + echo "See the following link for instructions how to add multiple ipv4 addresses on vultr:" + echo "${IPV4_DOC_LINK}" + exit 1 + fi + + # generate the required ipv6 config + if [ "${net}" -eq 6 ]; then # vultr specific, needed to work - sed -ie '/iface ${ETH_INTERFACE} inet6 auto/s/^/#/' ${NETWORK_CONFIG} - - # move current config out of the way first - cp ${NETWORK_CONFIG} ${NETWORK_CONFIG}.${DATE_STAMP}.bkp - - # create the additional ipv6 interfaces, rc.local because it's more generic - for NUM in $(seq 1 ${count}); do - - # check if the interfaces exist - ip -6 addr | grep -qi "${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}" - if [ $? -eq 0 ] - then - echo "IP for masternode already exists, skipping creation" &>> ${SCRIPT_LOGFILE} - else - echo "Creating new IP address for ${CODENAME} masternode nr ${NUM}" &>> ${SCRIPT_LOGFILE} - if [ "${NETWORK_CONFIG}" = "/etc/rc.local" ]; then - # need to put network config in front of "exit 0" in rc.local - sed -e '$i ip -6 addr add '"${IPV6_INT_BASE}"':'"${NETWORK_BASE_TAG}"'::'"${NUM}"'/64 dev '"${ETH_INTERFACE}"'\n' -i ${NETWORK_CONFIG} - else - # if not using rc.local, append normally - echo "ip -6 addr add ${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}/64 dev ${ETH_INTERFACE}" >> ${NETWORK_CONFIG} - fi - sleep 2 - ip -6 addr add ${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}/64 dev ${ETH_INTERFACE} &>> ${SCRIPT_LOGFILE} - fi - done # end forloop - fi # end ifneteq6 + sed -ie '/iface ${ETH_INTERFACE} inet6 auto/s/^/#/' ${NETWORK_CONFIG} &>> ${SCRIPT_LOGFILE} + + # move current config out of the way first + cp ${NETWORK_CONFIG} ${NETWORK_CONFIG}.${DATE_STAMP}.bkp &>> ${SCRIPT_LOGFILE} + + # create the additional ipv6 interfaces, rc.local because it's more generic + for NUM in $(seq 1 ${count}); do + + # check if the interfaces exist + ip -6 addr | grep -qi "${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}" + if [ $? -eq 0 ] + then + echo "IP for masternode already exists, skipping creation" &>> ${SCRIPT_LOGFILE} + else + echo "Creating new IP address for ${CODENAME} masternode ${NUM}" &>> ${SCRIPT_LOGFILE} + if [ "${NETWORK_CONFIG}" = "/etc/rc.local" ]; then + # need to put network config in front of "exit 0" in rc.local + sed -e '$i ip -6 addr add '"${IPV6_INT_BASE}"':'"${NETWORK_BASE_TAG}"'::'"${NUM}"'/64 dev '"${ETH_INTERFACE}"'\n' -i ${NETWORK_CONFIG} &>> ${SCRIPT_LOGFILE} + else + # if not using rc.local, append normally + echo "ip -6 addr add ${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}/64 dev ${ETH_INTERFACE}" >> ${NETWORK_CONFIG} &>> ${SCRIPT_LOGFILE} + fi + sleep 2 + ip -6 addr add ${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}/64 dev ${ETH_INTERFACE} &>> ${SCRIPT_LOGFILE} + fi + done # end forloop + fi # end ifneteq6 } @@ -761,149 +916,148 @@ while true; do -h |--help) shift; help; - ;; + ;; -p |--project) shift; - if [ -n "$1" ]; - then - project="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + project="$1"; + shift; + fi + ;; -n |--net) shift; - if [ -n "$1" ]; - then - net="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + net="$1"; + shift; + fi + ;; -c |--count) shift; - if [ -n "$1" ]; - then - count="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + count="$1"; + shift; + fi + ;; -r |--release) shift; - if [ -n "$1" ]; - then - release="$1"; - SCVERSION="$1" - shift; - fi - ;; + if [ -n "$1" ]; + then + release="$1"; + SCVERSION="$1" + shift; + fi + ;; -w |--wipe) shift; - wipe="1"; - ;; + wipe="1"; + ;; -s |--sentinel) shift; - sentinel="1"; - ;; + sentinel="1"; + ;; -u |--update) shift; - update="1"; - ;; + update="1"; + ;; -d |--debug) shift; - debug="1"; - ;; + debug="1"; + ;; -x|--startnodes) shift; - startnodes="1"; - ;; - + startnodes="1"; + ;; -g | --generate) shift; - generate="1"; - ;; + generate="1"; + ;; -k |--key) shift; - if [ -n "$1" ]; - then - PRIVKEY[1]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[1]="$1"; + shift; + fi + ;; -k2 |--key2) shift; - if [ -n "$1" ]; - then - PRIVKEY[2]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[2]="$1"; + shift; + fi + ;; -k3 |--key3) shift; - if [ -n "$1" ]; - then - PRIVKEY[3]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[3]="$1"; + shift; + fi + ;; -k4 |--key4) shift; - if [ -n "$1" ]; - then - PRIVKEY[4]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[4]="$1"; + shift; + fi + ;; -k5 |--key5) shift; - if [ -n "$1" ]; - then - PRIVKEY[5]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[5]="$1"; + shift; + fi + ;; -k6 |--key6) shift; - if [ -n "$1" ]; - then - PRIVKEY[6]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[6]="$1"; + shift; + fi + ;; -k7 |--key7) shift; - if [ -n "$1" ]; - then - PRIVKEY[7]="$1"; - shift; - fi - ;; - -k8 |--key8) + if [ -n "$1" ]; + then + PRIVKEY[7]="$1"; + shift; + fi + ;; + -k8 |--key8) shift; - if [ -n "$1" ]; - then - PRIVKEY[8]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[8]="$1"; + shift; + fi + ;; -k9 |--key9) shift; - if [ -n "$1" ]; - then - PRIVKEY[9]="$1"; - shift; - fi - ;; - -k10 |--key10) + if [ -n "$1" ]; + then + PRIVKEY[9]="$1"; + shift; + fi + ;; + -k10 |--key10) shift; - if [ -n "$1" ]; - then - PRIVKEY[10]="$1"; - shift; - fi - ;; + if [ -n "$1" ]; + then + PRIVKEY[10]="$1"; + shift; + fi + ;; --) shift; break; - ;; + ;; esac done @@ -915,8 +1069,8 @@ fi # Check required arguments if [ "$wipe" -eq 1 ]; then - get_confirmation "Would you really like to WIPE ALL DATA!? YES/NO y/n" && wipe_all - exit 0 + get_confirmation "Would you really like to WIPE ALL DATA!? YES/NO y/n" && wipe_all + exit 0 fi ################################################# @@ -929,54 +1083,56 @@ main() { echo "starting" &> ${SCRIPT_LOGFILE} showbanner - # debug - if [ "$debug" -eq 1 ]; then - echo "********************** VALUES AFTER CONFIG SOURCING: ************************" - echo "START DEFAULTS => " - echo "SCRIPT_VERSION: $SCRIPT_VERSION" - echo "SSH_INBOUND_PORT: ${SSH_INBOUND_PORT}" - echo "SYSTEMD_CONF: ${SYSTEMD_CONF}" - echo "NETWORK_CONFIG: ${NETWORK_CONFIG}" - echo "NETWORK_TYPE: ${NETWORK_TYPE}" - echo "ETH_INTERFACE: ${ETH_INTERFACE}" - echo "MNODE_CONF_BASE: ${MNODE_CONF_BASE}" - echo "MNODE_DATA_BASE: ${MNODE_DATA_BASE}" - echo "MNODE_USER: ${MNODE_USER}" - echo "MNODE_HELPER: ${MNODE_HELPER}" - echo "MNODE_SWAPSIZE: ${MNODE_SWAPSIZE}" - echo "CODE_DIR: ${CODE_DIR}" - echo "SCVERSION: ${SCVERSION}" - echo "RELEASE: ${release}" - echo "SETUP_MNODES_COUNT: ${SETUP_MNODES_COUNT}" - echo "END DEFAULTS => " - fi - - # source project configuration + # debug + if [ "$debug" -eq 1 ]; then + echo "********************** VALUES AFTER CONFIG SOURCING: ************************" + echo "START DEFAULTS => " + echo "SCRIPT_VERSION: $SCRIPT_VERSION" + echo "SSH_INBOUND_PORT: ${SSH_INBOUND_PORT}" + echo "SYSTEMD_CONF: ${SYSTEMD_CONF}" + echo "NETWORK_CONFIG: ${NETWORK_CONFIG}" + echo "NETWORK_TYPE: ${NETWORK_TYPE}" + echo "ETH_INTERFACE: ${ETH_INTERFACE}" + echo "MNODE_CONF_BASE: ${MNODE_CONF_BASE}" + echo "MNODE_DATA_BASE: ${MNODE_DATA_BASE}" + echo "MNODE_USER: ${MNODE_USER}" + echo "MNODE_HELPER: ${MNODE_HELPER}" + echo "MNODE_SWAPSIZE: ${MNODE_SWAPSIZE}" + echo "NETWORK_BASE_TAG: ${NETWORK_BASE_TAG}" + echo "CODE_DIR: ${CODE_DIR}" + echo "SCVERSION: ${SCVERSION}" + echo "RELEASE: ${release}" + echo "SETUP_MNODES_COUNT: ${SETUP_MNODES_COUNT}" + echo "END DEFAULTS => " + fi + + # source project configuration source_config ${project} - # debug - if [ "$debug" -eq 1 ]; then - echo "START PROJECT => " - echo "CODENAME: $CODENAME" - echo "SETUP_MNODES_COUNT: ${SETUP_MNODES_COUNT}" - echo "MNODE_DAEMON: ${MNODE_DAEMON}" - echo "MNODE_INBOUND_PORT: ${MNODE_INBOUND_PORT}" - echo "GIT_URL: ${GIT_URL}" - echo "SCVERSION: ${SCVERSION}" - echo "RELEASE: ${release}" - echo "NETWORK_BASE_TAG: ${NETWORK_BASE_TAG}" - echo "END PROJECT => " - - echo "START OPTIONS => " - echo "RELEASE: ${release}" - echo "PROJECT: ${project}" - echo "SETUP_MNODES_COUNT: ${count}" - echo "NETWORK_TYPE: ${NETWORK_TYPE}" - echo "NETWORK_TYPE: ${net}" - - echo "END OPTIONS => " - echo "********************** VALUES AFTER CONFIG SOURCING: ************************" - fi + # debug + if [ "$debug" -eq 1 ]; then + echo "START PROJECT => " + echo "CODENAME: $CODENAME" + echo "SETUP_MNODES_COUNT: ${SETUP_MNODES_COUNT}" + echo "MNODE_DAEMON: ${MNODE_DAEMON}" + echo "MNODE_INBOUND_PORT: ${MNODE_INBOUND_PORT}" + echo "GIT_URL: ${GIT_URL}" + echo "SCVERSION: ${SCVERSION}" + echo "RELEASE: ${release}" + echo "NETWORK_BASE_TAG: ${NETWORK_BASE_TAG}" + echo "END PROJECT => " + + echo "START OPTIONS => " + echo "RELEASE: ${release}" + echo "PROJECT: ${project}" + echo "SETUP_MNODES_COUNT: ${count}" + echo "NETWORK_TYPE: ${NETWORK_TYPE}" + echo "NETWORK_TYPE: ${net}" + + echo "END OPTIONS => " + echo "********************** VALUES AFTER CONFIG SOURCING: ************************" + fi + } main "$@"