diff --git a/config.json b/config.json index 01fcf138..aa43fd64 100644 --- a/config.json +++ b/config.json @@ -45,15 +45,11 @@ "enabled": true, "list": [ { - "ip": "51.15.221.205", - "port": 36666 - }, - { - "ip": "51.15.88.53", + "ip": "5.161.68.61", "port": 36666 }, { - "ip": "5.161.68.61", + "ip": "149.102.157.15", "port": 36666 }, { @@ -67,6 +63,14 @@ { "ip": "138.201.152.191", "port": 36666 + }, + { + "ip": "184.94.215.92", + "port": 45555 + }, + { + "ip": "207.244.243.23", + "port": 45555 } ], "access": { diff --git a/package.json b/package.json index 3204a981..c3762326 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "adamant", - "version": "0.8.1", + "version": "0.8.2", "private": true, "scripts": { "start": "node app.js", @@ -38,18 +38,18 @@ "dependencies": { "async": "=3.2.4", "axios": "^0.27.2", - "bignumber.js": "=9.1.0", + "bignumber.js": "=9.1.2", "bitcore-mnemonic": "=8.25.36", - "body-parser": "=1.20.0", + "body-parser": "=1.20.2", "bytebuffer": "=5.0.1", "change-case": "=4.1.2", "colors": "=1.4.0", "commander": "=9.4.0", "compression": "=1.7.4", "cors": "=2.8.5", - "ejs": "=3.1.8", + "ejs": "=3.1.9", "execa": "^5.1.1", - "express": "=4.18.1", + "express": "=4.18.2", "express-domain-middleware": "=0.1.0", "express-query-int": "=3.0.0", "express-rate-limit": "=6.5.1", @@ -63,40 +63,40 @@ "method-override": "=3.0.0", "npm": "=8.17.0", "pg-monitor": "=1.4.1", - "pg-native": "=3.0.0", + "pg-native": "=3.0.1", "pg-promise": "=10.11.1", - "randomstring": "=1.2.2", - "redis": "=4.2.0", + "randomstring": "=1.3.0", + "redis": "=4.6.10", "rimraf": "=3.0.2", - "semver": "=7.3.7", - "socket.io": "^4.5.1", + "semver": "=7.5.4", + "socket.io": "^4.7.2", "sodium": "^3.0.2", "sodium-browserify-tweetnacl": "*", - "strftime": "=0.10.1", - "unzipper": "^0.10.11", + "strftime": "=0.10.2", + "unzipper": "^0.10.14", "valid-url": "=1.0.9", "validator.js": "=2.0.4", "z-schema": "=5.0.3" }, "devDependencies": { - "chai": "^4.3.6", - "chai-bignumber": "^3.0.0", + "chai": "^4.3.10", + "chai-bignumber": "^3.1.0", "eslint-config-google": "^0.14.0", "eslint-formatter-codeframe": "^7.32.1", - "eslint-plugin-jsdoc": "^39.3.4", - "grunt": "^1.5.3", + "eslint-plugin-jsdoc": "^46.8.2", + "grunt": "^1.6.1", "grunt-cli": "^1.4.3", "grunt-contrib-compress": "^2.0.0", "grunt-contrib-obfuscator": "^8.0.0", - "grunt-eslint": "^24.0.0", + "grunt-eslint": "^24.3.0", "grunt-exec": "^3.0.0", "jsdoc": "^3.6.11", - "mocha": "^10.0.0", + "mocha": "^10.2.0", "moment": "^2.29.4", "nyc": "^15.1.0", "nyc-middleware": "^1.0.4", "sinon": "^14.0.0", - "supertest": "^6.2.4" + "supertest": "^6.3.3" }, "overrides": { "grunt-contrib-obfuscator": { diff --git a/sql/chats.js b/sql/chats.js index befa949d..cffdc7ef 100644 --- a/sql/chats.js +++ b/sql/chats.js @@ -106,6 +106,7 @@ var ChatsSql = { 'first("c_type" ORDER BY b_height DESC, t_timestamp DESC) as "c_type",', 'first("t_type" ORDER BY b_height DESC, t_timestamp DESC) as "t_type",', 'first("b_height" ORDER BY b_height DESC, t_timestamp DESC) as "b_height",', + 'first("confirmations" ORDER BY b_height DESC, t_timestamp DESC) as "confirmations",', 'first("b_id" ORDER BY b_height DESC, t_timestamp DESC) as "b_id"', 'FROM ( SELECT *, t_timestamp as timestamp, ENCODE("publicKey", \'hex\') as "m_recipientPublicKey"', 'FROM full_blocks_list', diff --git a/tools/install_node.sh b/tools/install_node.sh index deef907c..a48a17e2 100644 --- a/tools/install_node.sh +++ b/tools/install_node.sh @@ -7,37 +7,48 @@ databasename="adamant_main" configfile="config.json" processname="adamant" port="36666" - -while getopts 'b:n:' OPTION; do - OPTARG=$(echo "$OPTARG" | xargs) - case "$OPTION" in - b) - branch="$OPTARG" - ;; - n) - if [ "$OPTARG" == "testnet" ] - then - network="$OPTARG" - username="adamanttest" - databasename="adamant_test" - configfile="test/config.json" - processname="adamanttest" - port="36667" - elif [ "$OPTARG" != "mainnet" ] - then - printf "\nNetwork should be 'mainnet' or 'testnet'.\n\n" - exit 1 - fi - ;; - *) - printf "\nWrong parameters. Use '-b' for branch, '-t' for network.\n\n" - exit 1 - ;; - esac +nodejs="hydrogen" + +while getopts 'b:n:j:' OPTION; do + OPTARG=$(echo "$OPTARG" | xargs) + case "$OPTION" in + b) + branch="$OPTARG" + ;; + n) + if [ "$OPTARG" == "testnet" ] + then + network="$OPTARG" + username="adamanttest" + databasename="adamant_test" + configfile="test/config.json" + processname="adamanttest" + port="36667" + elif [ "$OPTARG" != "mainnet" ] + then + printf "\nNetwork should be 'mainnet' or 'testnet'.\n\n" + exit 1 + fi + ;; + j) + if [ "$OPTARG" == "16" ] || [ "$OPTARG" == "gallium" ] + then + nodejs="gallium" + elif [ "$OPTARG" != "18" ] && [ "$OPTARG" != "hydrogen" ] + then + printf "\nNodejs should be 'gallium' = '16', or 'hydrogen' = '18'.\n\n" + exit 1 + fi + ;; + *) + printf "\nWrong parameters. Use '-b' for branch, '-t' for network, '-j' for Nodejs version.\n\n" + exit 1 + ;; + esac done printf "\n" -printf "Welcome to the ADAMANT node installer v2.0.2 for Ubuntu 18, 20, 22. Make sure you got this file from adamant.im website or GitHub.\n" +printf "Welcome to the ADAMANT node installer v2.1.1 for Ubuntu 18, 20, 22. Make sure you got this file from adamant.im website or GitHub.\n" printf "This installer is the easiest way to run ADAMANT node. We still recommend to consult IT specialist if you are not familiar with Linux systems.\n" printf "You can see full installation instructions on https://medium.com/adamant-im/how-to-run-your-adamant-node-on-ubuntu-990e391e8fcc\n" printf "The installer will ask you to set database and user passwords during the installation.\n" @@ -45,51 +56,52 @@ printf "Also, the system may ask to choose some parameters, like encoding, keybo printf "Note: You've choosed '%s' network.\n" "$network" printf "Note: You've choosed '%s' branch.\n" "$branch" +printf "Note: You've choosed '%s' Nodejs version.\n" "$nodejs" printf "\n" read -r -p "WARNING! Running this script is recommended for new droplets. Existing data MAY BE DAMAGED. If you agree to continue, type \"yes\": " agreement if [[ $agreement != "yes" ]] then - printf "\nInstallation cancelled.\n\n" - exit 1 + printf "\nInstallation cancelled.\n\n" + exit 1 fi IMAGE=false if [[ $network == "mainnet" ]] then - printf "\nBlockchain image saves time on node sync but you must completely trust the image.\n" - printf "If you skip this step, your node will check every single transaction, which takes time (up for several days).\n" - read -r -p "Do you want to use the ADAMANT blockchain image to bootstrap a node? [Y/n]: " useimage - case $useimage in - [yY][eE][sS]|[yY]|[jJ]|'') - IMAGE=true - printf "\nI'll download blockchain image and your node will be on the actual height in a few minutes.\n\n" - ;; - *) - printf "\nI'll sync your node from the beginning. It may take several days to raise up to the actual blockchain height.\n\n" - ;; - esac + printf "\nBlockchain image saves time on node sync but you must completely trust the image.\n" + printf "If you skip this step, your node will check every single transaction, which takes time (up for several days).\n" + read -r -p "Do you want to use the ADAMANT blockchain image to bootstrap a node? [Y/n]: " useimage + case $useimage in + [yY][eE][sS]|[yY]|[jJ]|'') + IMAGE=true + printf "\nI'll download blockchain image and your node will be on the actual height in a few minutes.\n\n" + ;; + *) + printf "\nI'll sync your node from the beginning. It may take several days to raise up to the actual blockchain height.\n\n" + ;; + esac fi hostname=$(cat "/etc/hostname") if grep -q "$hostname" "/etc/hosts" then - printf "Hostname /etc/hosts seems to be good.\n\n" + printf "Hostname /etc/hosts seems to be good.\n\n" else - printf "File /etc/hosts has no hostname record. I'll fix it.\n\n" - sh -c -e "echo '\n127.0.1.1 $hostname' >> /etc/hosts"; + printf "File /etc/hosts has no hostname record. I'll fix it.\n\n" + sh -c -e "echo '\n127.0.1.1 $hostname' >> /etc/hosts"; fi get_database_password () { - read -r -sp "Set the database password: $(echo $'\n> ')" postgrespwd - read -r -sp "$(echo $'\n')Confirm password: $(echo $'\n> ')" postgrespwdconfirmation - if [[ $postgrespwd = "$postgrespwdconfirmation" ]] - then - echo "$postgrespwd" - else - printf "\nPassword mismatch. Try again.\n\n" - get_database_password - fi + read -r -sp "Set the database password: $(echo $'\n> ')" postgrespwd + read -r -sp "$(echo $'\n')Confirm password: $(echo $'\n> ')" postgrespwdconfirmation + if [[ $postgrespwd = "$postgrespwdconfirmation" ]] + then + echo "$postgrespwd" + else + printf "\nPassword mismatch. Try again.\n\n" + get_database_password + fi } DB_PASSWORD="$(get_database_password)" @@ -98,9 +110,9 @@ DB_PASSWORD="$(get_database_password)" printf "\n\nChecking if user '%s' exists…\n\n" "$username" if [[ $(id -u "$username" > /dev/null 2>&1; echo $?) = 1 ]] then - printf "Creating system user named '%s'…\n" "$username" - adduser --gecos "" "$username" - printf "User '%s' has been created.\n\n" "$username" + printf "Creating system user named '%s'…\n" "$username" + adduser --gecos "" "$username" + printf "User '%s' has been created.\n\n" "$username" fi #Packages @@ -126,11 +138,11 @@ su - "$username" <> /etc/hosts"; + printf "File /etc/hosts has no hostname record. I'll fix it.\n\n" + sh -c -e "echo '\n127.0.1.1 $hostname' >> /etc/hosts"; fi get_database_password () { - read -r -sp "Set the database password: $(echo $'\n> ')" postgrespwd - read -r -sp "$(echo $'\n')Confirm password: $(echo $'\n> ')" postgrespwdconfirmation - if [[ $postgrespwd = "$postgrespwdconfirmation" ]] - then - echo "$postgrespwd" - else - printf "\nPassword mismatch. Try again.\n\n" - get_database_password - fi + read -r -sp "Set the database password: $(echo $'\n> ')" postgrespwd + read -r -sp "$(echo $'\n')Confirm password: $(echo $'\n> ')" postgrespwdconfirmation + if [[ $postgrespwd = "$postgrespwdconfirmation" ]] + then + echo "$postgrespwd" + else + printf "\nPassword mismatch. Try again.\n\n" + get_database_password + fi } DB_PASSWORD="$(get_database_password)" @@ -98,10 +110,10 @@ DB_PASSWORD="$(get_database_password)" printf "\n\nChecking if user '%s' exists…\n\n" "$username" if [[ $(id -u "$username" > /dev/null 2>&1; echo $?) = 1 ]] then - printf "Creating system user named '%s'…\n" "$username" - sudo adduser "$username" - sudo passwd "$username" - printf "User '%s' has been created.\n\n" "$username" + printf "Creating system user named '%s'…\n" "$username" + sudo adduser "$username" + sudo passwd "$username" + printf "User '%s' has been created.\n\n" "$username" fi #Packages @@ -134,11 +146,11 @@ su - "$username" <