From 16d601389e072fa8e24d0da57a5c0c1138575bd6 Mon Sep 17 00:00:00 2001 From: Mark Brooker Date: Tue, 12 Dec 2017 23:48:42 +0000 Subject: [PATCH 1/3] Reduce default swap size, add instance numbering base --- config/default.env | 5 +++-- install.sh | 41 +++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/config/default.env b/config/default.env index 04d4c609..526bd692 100644 --- a/config/default.env +++ b/config/default.env @@ -7,6 +7,7 @@ MNODE_CONF_BASE=${MNODE_CONF_BASE:-/etc/masternodes} MNODE_DATA_BASE=${MNODE_DATA_BASE:-/var/lib/masternodes} MNODE_USER=${MNODE_USER:-masternode} MNODE_HELPER="/usr/local/bin/activate_masternodes" -MNODE_SWAPSIZE=${MNODE_SWAPSIZE:-5000} +MNODE_SWAPSIZE=${MNODE_SWAPSIZE:-4000} CODE_DIR="code" -SETUP_MNODES_COUNT=${SETUP_MNODES_COUNT:-1} \ No newline at end of file +SETUP_MNODES_COUNT=${SETUP_MNODES_COUNT:-1} +SETUP_MNODES_BASE=${SETUP_MNODES_BASE:-1} diff --git a/install.sh b/install.sh index db59fd53..7ad727a8 100755 --- a/install.sh +++ b/install.sh @@ -72,16 +72,18 @@ function show_help(){ showbanner echo "install.sh, version $SCRIPT_VERSION"; echo "Usage example:"; - echo "install.sh (-p|--project) string [(-h|--help)] [(-n|--net) int] [(-c|--count) int] [(-r|--release) string] [(-w|--wipe)] [(-u|--update)]"; + echo "install.sh (-p|--project) string [(-h|--help)] [(-n|--net) int] [(-c|--count) int] [(-b|--base) int] [(-r|--release) string] [(-s|--sentinel)] [(-w|--wipe)] [(-u|--update)] [(-d|--debug)]"; echo "Options:"; echo "-h or --help: Displays this information."; echo "-p or --project string: Project to be installed. REQUIRED."; echo "-n or --net: IP address type t be used (4 vs. 6)."; echo "-c or --count: Number of masternodes to be installed."; + echo "-b or --base: Starting number for masternode instances."; echo "-r or --release: Release version to be installed."; echo "-s or --sentinel: Add sentinel monitoring for a node type. Combine with the -p option"; 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 "-d or --debug: display some debug output"; exit 1; } @@ -163,7 +165,7 @@ 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 + for NUM in $(seq ${base} ${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} @@ -195,7 +197,7 @@ function create_sentinel_setup() { /usr/share/sentinelvenv/bin/pip install -r requirements.txt &>> ${SCRIPT_LOGFILE} # create one sentinel config file per masternode - for NUM in $(seq 1 ${count}); do + for NUM in $(seq ${base} ${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 @@ -264,7 +266,7 @@ function create_mn_configuration() { cd ${SCRIPTPATH} # create one config file per masternode - for NUM in $(seq 1 ${count}); do + for NUM in $(seq ${base} ${count}); do PASS=$(date | md5sum | cut -c1-24) # we dont want to overwrite an existing config file @@ -295,7 +297,7 @@ 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 + for NUM in $(seq ${base} ${count}); do cat >> /tmp/${CODENAME}_masternode.conf <<-EOF ${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} EOF @@ -310,7 +312,7 @@ function create_systemd_configuration() { echo "* (over)writing systemd config files for masternodes" # create one config file per masternode - for NUM in $(seq 1 ${count}); do + for NUM in $(seq ${base} ${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 <<-EOF @@ -446,7 +448,7 @@ function source_config() { echo "" echo "I am going to install and configure " echo "=> ${count} ${project} masternode(s) in version ${SCVERSION} " - echo "for you now." + echo "starting at instance ${base} for you now." echo "" echo "You have to add your masternode private key to the individual config files afterwards" echo "" @@ -551,7 +553,7 @@ function final_call() { cp ${SCRIPTPATH}/scripts/activate_masternodes.sh ${MNODE_HELPER}_${CODENAME} echo "">> ${MNODE_HELPER}_${CODENAME} - for NUM in $(seq 1 ${count}); do + for NUM in $(seq ${base} ${count}); do echo "systemctl enable ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} echo "systemctl restart ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} done @@ -589,7 +591,7 @@ function prepare_mn_interfaces() { 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 + for NUM in $(seq ${base} ${count}); do # check if the interfaces exist ip -6 addr | grep -qi "${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}" @@ -614,9 +616,10 @@ wipe=0; debug=0; update=0; sentinel=0; +base=1; # Execute getopt -ARGS=$(getopt -o "hp:n:c:r:wsud" -l "help,project:,net:,count:,release:,wipe,sentinel,update,debug" -n "install.sh" -- "$@"); +ARGS=$(getopt -o "hp:n:c:b:r:wsud" -l "help,project:,net:,count:,base:,release:,wipe,sentinel,update,debug" -n "install.sh" -- "$@"); #Bad arguments if [ $? -ne 0 ]; @@ -656,6 +659,14 @@ while true; do shift; fi ;; + -b|--base) + shift; + if [ -n "$1" ]; + then + base="$1"; + shift; + fi + ;; -r|--release) shift; if [ -n "$1" ]; @@ -712,7 +723,7 @@ main() { # debug if [ "$debug" -eq 1 ]; then - echo "********************** VALUES AFTER CONFIG SOURCING: ************************" + echo "******************* VALUES AFTER GENERIC CONFIG SOURCING: *********************" echo "START DEFAULTS => " echo "SCRIPT_VERSION: $SCRIPT_VERSION" echo "SSH_INBOUND_PORT: ${SSH_INBOUND_PORT}" @@ -726,7 +737,6 @@ main() { echo "MNODE_HELPER: ${MNODE_HELPER}" echo "MNODE_SWAPSIZE: ${MNODE_SWAPSIZE}" echo "CODE_DIR: ${CODE_DIR}" - echo "ETH_INTERFACE: ${ETH_INTERFACE}" echo "SETUP_MNODES_COUNT: ${SETUP_MNODES_COUNT}" echo "END DEFAULTS => " fi @@ -736,9 +746,9 @@ main() { # debug if [ "$debug" -eq 1 ]; then + echo "****************** VALUES AFTER PROJECT CONFIG SOURCING: **********************" 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}" @@ -750,12 +760,11 @@ main() { echo "RELEASE: ${release}" echo "PROJECT: ${project}" echo "SETUP_MNODES_COUNT: ${count}" - echo "NETWORK_TYPE: ${NETWORK_TYPE}" + echo "SETUP_MNODES_BASE: ${base}" echo "NETWORK_TYPE: ${net}" echo "END OPTIONS => " - echo "********************** VALUES AFTER CONFIG SOURCING: ************************" fi } -main "$@" \ No newline at end of file +main "$@" From 2b0619db2ade60bf647cef8850b1508ac9777eb3 Mon Sep 17 00:00:00 2001 From: Mark Brooker Date: Thu, 14 Dec 2017 16:09:40 +0000 Subject: [PATCH 2/3] Merge blocknet and crown-sn --- README.md | 1 + assets/block.jpg | Bin 0 -> 4598 bytes config/block/block.compile | 6 ++++++ config/block/block.env | 6 ++++++ 4 files changed, 13 insertions(+) create mode 100644 assets/block.jpg create mode 100755 config/block/block.compile create mode 100644 config/block/block.env diff --git a/README.md b/README.md index 9ca0d2a0..a189a7bc 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,7 @@ The management script release will follow within the next couple of days. | YUP | ![YUP](/assets/yup.jpg) | http://yupcrypto.com/ | | MTNC | ![MTNC](/assets/mtnc.jpg) | http://www.masternodecoin.org/ | | CROWN | ![CROWN](/assets/crown.jpg) | https://crown.tech/ | +| BLOCKNET | ![BLOCK](/assets/block.jpg) | https://blocknet.co/ | # Todo * provide my Dockerfile & Vagrantfile diff --git a/assets/block.jpg b/assets/block.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1816a57b6ad56f59253f05c7d0357bb649779ac0 GIT binary patch literal 4598 zcmbW4cT`i$x5rOD-RS*IJ={0l(L0S}nfV3c0#Re)UND&YOq)BgA5k)#SkSbM> zCLJkKrAfEYn+WgV)qCH2f4$$Evu4(uHFIXoXZGIT*=MhRZw$bl(57eu5C{a&1s`B< z91)@Ae#rpT}hR8*f`H#!qTL6y+$iOiegb#q?Auv2-uMXe=_lW?x z_tAeB2owfKAW>)x9TuEWgae=u7z_%BArNp79pVj+18_Woi72g(WTx7o_?!tce$lCD zevSMZ7Nf33lB~UpKZcH#jh%y2K=81Tun1XBUO`bw`M9Q*wvI04gz;$;Q!{f5+SzmG z9WGqFbos_jSGQa49-emt0)y@ahlIw&#>FQjCjIr`X$7i?(2fWqT-U$H)XZ& z>gpRBo8C8n=MvE-=E?so2B=Wex(mvWR zvi}>H|No2ZAFzM91_62)1T-ED52yiKyJeARcgoI*kNV&2{YgZdzT=(VDi3C!e-*4M z5A7RKXc0x2tO-``0U95OovZF*#F-Wjw+4m$`HQf3{C>}0P3M;fW2nth?^0QAybs&; zIQ(;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jlrcY?Q}Akw8gh^IuMVZMzr3)q-Z0L>8nXHVzVYGF1|fEcrQ)RM(l7 zXkN>5$S}R@)|f&EFWhy_n$2!h!?Fm5RfZjM_l$~ib=uIi6_&rCRFZ+z6oW(>kk60t zcy*v&C)yyhlxNg#WlPZiIMb3e4iX9cO@#b6)%fL|I6rmJJ@Txa%%X9uQpK{Z%&&w?yIj3Omg7r3674C;>w6-9h=UcS=X5_~zqo?}j zj#k^9BG^I+wH~$Hsrj~Vy9%KK@D01ga5Fb=`Y<9`Gq)eZ+5uWKa>qt%jC_{mHQ@_@j{E7&{$8(eT^}5DVEFfp}B9G=3f2 z&Ir)-d!A2O_rBfgHZhTZHZr=?&Nt2VlMxj+t++Cay`Bwa;9Z2kvx8XZ1~msCM)Vso z1n1|;9}U=|G(NpFct_N1q-!aDQIAaPko5Uj#TZEFJZRQnc3MBmb$NN~j9XRsCq+m? zKkyLe^7hnP;HqXkj1v{L!Tm{zwlnj+nq&9J(&L3{_HfmNx50-(zb;@tvX*r34g41c CIFIE3 literal 0 HcmV?d00001 diff --git a/config/block/block.compile b/config/block/block.compile new file mode 100755 index 00000000..e5ee5b59 --- /dev/null +++ b/config/block/block.compile @@ -0,0 +1,6 @@ +#!/bin/bash + +./autogen.sh +./configure --with-incompatible-bdb --disable-tests --without-miniupnpc +make +make install diff --git a/config/block/block.env b/config/block/block.env new file mode 100644 index 00000000..498ad956 --- /dev/null +++ b/config/block/block.env @@ -0,0 +1,6 @@ +CODENAME=block +MNODE_DAEMON=${MNODE_DAEMON:-/usr/local/bin/blocknetdxd} +MNODE_INBOUND_PORT=${MNODE_INBOUND_PORT:-41412} +GIT_URL=https://github.com/BlocknetDX/BlockDX +SCVERSION="tags/v3.7.36" +NETWORK_BASE_TAG="2036" From dc8a416c955894182e3d70c179c0ce2e783b6fd7 Mon Sep 17 00:00:00 2001 From: walkjivefly Date: Sat, 20 Apr 2019 09:20:07 +0000 Subject: [PATCH 3/3] Base and count usage for numbering node instances, fix a couple of typos --- install.sh | 58 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/install.sh b/install.sh index 4a8341a5..6a424df3 100755 --- a/install.sh +++ b/install.sh @@ -78,14 +78,13 @@ function show_help(){ echo "Options:"; echo "-h or --help: Displays this information."; echo "-p or --project string: Project to be installed. REQUIRED."; - echo "-n or --net: IP address type t be used (4 vs. 6)."; + echo "-n or --net: IP address type to be used (4 vs. 6)."; echo "-c or --count: Number of masternodes to be installed."; echo "-b or --base: Starting number for masternode instances."; echo "-r or --release: Release version to be installed."; echo "-s or --sentinel: Add sentinel monitoring for a node type. Combine with the -p option"; 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"; exit 1; } @@ -174,7 +173,7 @@ 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 + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); 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} @@ -196,12 +195,12 @@ function create_sentinel_setup() { 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} + rm -f 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} + rm -f sentinel.conf &>> ${SCRIPT_LOGFILE} fi # create a globally accessible venv and install sentinel requirements @@ -209,7 +208,8 @@ function create_sentinel_setup() { ${SENTINEL_ENV}/bin/pip install -r requirements.txt &>> ${SCRIPT_LOGFILE} # create one sentinel config file per masternode - for NUM in $(seq 1 ${count}); do + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); 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 @@ -255,7 +255,7 @@ function validate_netchoice() { echo "* Validating network rules" - # break here of net isn't 4 or 6 + # break here if 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; @@ -279,7 +279,8 @@ function create_mn_configuration() { cd ${SCRIPTPATH} # create one config file per masternode - for NUM in $(seq ${base} ${count}); do + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); do + PASS=$(date | md5sum | cut -c1-24) # we dont want to overwrite an existing config file @@ -314,7 +315,8 @@ 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 + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); do + cat >> /tmp/${CODENAME}_masternode.conf <<-EOF ${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} EOF @@ -329,7 +331,8 @@ function create_systemd_configuration() { echo "* (over)writing systemd config files for masternodes" # create one config file per masternode - for NUM in $(seq 1 ${count}); do + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); 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 <<-EOF @@ -357,7 +360,6 @@ function create_systemd_configuration() { WantedBy=multi-user.target EOF done - } # @@ -438,7 +440,15 @@ function source_config() { if [ -z "${count}" ] then count=${SETUP_MNODES_COUNT} - echo "No number given, installing default number of nodes: ${SETUP_MNODES_COUNT}" &>> ${SCRIPT_LOGFILE} + echo "No count given, installing default number of nodes: ${SETUP_MNODES_COUNT}" &>> ${SCRIPT_LOGFILE} + fi + + # base is from the default config but can ultimately be + # overwritten at runtime + if [ -z "${base}" ] + then + base=${SETUP_MNODES_BASE} + echo "No base given, installing from default node number: ${SETUP_MNODES_BASE}" &>> ${SCRIPT_LOGFILE} fi # release is from the default project config but can ultimately be @@ -480,7 +490,7 @@ function source_config() { 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)" + echo "$(tput bold)$(tput setaf 2) => ${count} ${project} masternode(s) at version ${release} starting with instance number ${base} $(tput sgr0)" fi echo "for you now." echo "" @@ -521,9 +531,9 @@ function source_config() { prepare_mn_interfaces swaphack fi - install_packages - print_logo - build_mn_from_source +# install_packages +# print_logo +# build_mn_from_source if [ "$update" -eq 0 ]; then create_mn_user create_mn_dirs @@ -532,7 +542,7 @@ function source_config() { echo "* Sentinel setup chosen" &>> ${SCRIPT_LOGFILE} create_sentinel_setup fi - configure_firewall +# configure_firewall create_mn_configuration create_control_configuration create_systemd_configuration @@ -630,10 +640,13 @@ function final_call() { # place future helper script accordingly on fresh install if [ "$update" -eq 0 ]; then - cp ${SCRIPTPATH}/scripts/activate_masternodes.sh ${MNODE_HELPER}_${CODENAME} + if [ ! -s ${MNODE_HELPER}_${CODENAME} ]; then + cp ${SCRIPTPATH}/scripts/activate_masternodes.sh ${MNODE_HELPER}_${CODENAME} + fi echo "">> ${MNODE_HELPER}_${CODENAME} - for NUM in $(seq 1 ${count}); do + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); do + echo "systemctl daemon-reload" >> ${MNODE_HELPER}_${CODENAME} echo "systemctl enable ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} echo "systemctl restart ${CODENAME}_n${NUM}" >> ${MNODE_HELPER}_${CODENAME} @@ -715,7 +728,8 @@ function prepare_mn_interfaces() { 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 + for ((NUM = ${base}; NUM < $[${base} + ${count}]; NUM++)); do + # check if the interfaces exist ip -6 addr | grep -qi "${IPV6_INT_BASE}:${NETWORK_BASE_TAG}::${NUM}" @@ -749,7 +763,7 @@ sentinel=0; startnodes=0; # Execute getopt -ARGS=$(getopt -o "hp:n:c:r:wsudx" -l "help,project:,net:,count:,release:,wipe,sentinel,update,debug,startnodes" -n "install.sh" -- "$@"); +ARGS=$(getopt -o "hp:n:c:b:r:wsudx" -l "help,project:,net:,count:,release:,wipe,sentinel,update,debug,startnodes" -n "install.sh" -- "$@"); #Bad arguments if [ $? -ne 0 ]; @@ -876,6 +890,7 @@ main() { echo "SCVERSION: ${SCVERSION}" echo "RELEASE: ${release}" echo "SETUP_MNODES_COUNT: ${SETUP_MNODES_COUNT}" + echo "SETUP_MNODES_BASE: ${SETUP_MNODES_BASE}" echo "END DEFAULTS => " fi @@ -899,6 +914,7 @@ main() { echo "RELEASE: ${release}" echo "PROJECT: ${project}" echo "SETUP_MNODES_COUNT: ${count}" + echo "SETUP_MNODES_BASE: ${base}" echo "NETWORK_TYPE: ${NETWORK_TYPE}" echo "NETWORK_TYPE: ${net}"