Compare commits
No commits in common. "main" and "v2.0" have entirely different histories.
@ -6,8 +6,9 @@ This script is an all-in-one quil usage software for newcomers.
|
|||||||
|
|
||||||
For installation and first run, please run
|
For installation and first run, please run
|
||||||
|
|
||||||
rm -f quilibrium_for_dummies.sh && wget https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/quilibrium_for_dummies.sh && chmod +x quilibrium_for_dummies.sh && ./quilibrium_for_dummies.sh
|
wget https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/quilibrium_for_dummies.sh
|
||||||
|
chmod u+x quilibrium_for_dummies.sh
|
||||||
|
./quilibrium_for_dummies.sh
|
||||||
|
|
||||||
After first run, when you need to reach your node, you need to run only;
|
After first run, when you need to reach your node, you need to run only;
|
||||||
|
|
||||||
|
|||||||
@ -1,196 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Terminal clearing function
|
|
||||||
clear_screen() {
|
|
||||||
clear
|
|
||||||
echo "Log Monitoring Active - Press Ctrl+C to exit"
|
|
||||||
echo "___________________________________________________________"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Global variables
|
|
||||||
last_increment=""
|
|
||||||
last_change_time=$(date +%s)
|
|
||||||
last_decrease_time=$(date +%s)
|
|
||||||
CHECK_INTERVAL=5 # Check interval (seconds)
|
|
||||||
RESTART_THRESHOLD=$((5 * 60)) # 5 minutes (in seconds)
|
|
||||||
RESTART_WAIT_TIME=$((1* 60)) # Wait 1 minute after restart
|
|
||||||
last_restart_time=0
|
|
||||||
increment_updated=""
|
|
||||||
|
|
||||||
# ANSI color codes
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
CYAN='\033[0;36m'
|
|
||||||
RED='\033[0;31m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
# Service restart function
|
|
||||||
restart_service() {
|
|
||||||
local reason=$1
|
|
||||||
echo -e "${RED}REASON FOR RESTART: $reason${NC}"
|
|
||||||
echo "Restarting service..."
|
|
||||||
sudo systemctl restart ceremonyclient.service
|
|
||||||
last_restart_time=$(date +%s)
|
|
||||||
last_change_time=$last_restart_time
|
|
||||||
last_decrease_time=$last_restart_time
|
|
||||||
|
|
||||||
echo -e "${YELLOW}Service restarted. Waiting 5 minutes for logs to stabilize...${NC}"
|
|
||||||
for i in {300..1}; do
|
|
||||||
echo -ne "Remaining time: $i seconds\r"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo -e "\nWait time complete. Starting log analysis..."
|
|
||||||
sleep 2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continuously running while loop
|
|
||||||
while true; do
|
|
||||||
clear_screen
|
|
||||||
current_time=$(date +%s)
|
|
||||||
increment_updated=""
|
|
||||||
|
|
||||||
time_since_restart=$((current_time - last_restart_time))
|
|
||||||
if [ $last_restart_time -ne 0 ] && [ $time_since_restart -lt $RESTART_WAIT_TIME ]; then
|
|
||||||
remaining_wait=$((RESTART_WAIT_TIME - time_since_restart))
|
|
||||||
echo -e "${YELLOW}It's been $time_since_restart seconds since the last restart."
|
|
||||||
echo -e "Waiting $remaining_wait seconds before a new restart can be triggered...${NC}"
|
|
||||||
else
|
|
||||||
last_decrease=$(sudo journalctl -u ceremonyclient.service -o short-iso -n 2000 | grep 'publishing' | tail -n 20 | \
|
|
||||||
awk -v current_time="$current_time" '
|
|
||||||
BEGIN {
|
|
||||||
total_time=0;
|
|
||||||
total_decrement=0;
|
|
||||||
count=0;
|
|
||||||
last_decrease_gap=0;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timestamp=$1;
|
|
||||||
increment=gensub(/.*"increment":([0-9]+).*/, "\\1", "g", $0);
|
|
||||||
cmd="date -d \"" timestamp "\" +%s";
|
|
||||||
cmd | getline entry_time;
|
|
||||||
close(cmd);
|
|
||||||
|
|
||||||
if (previous_time && previous_increment) {
|
|
||||||
time_gap=entry_time-previous_time;
|
|
||||||
decrement=previous_increment-increment;
|
|
||||||
if (decrement > 0) {
|
|
||||||
total_time+=time_gap;
|
|
||||||
total_decrement+=decrement;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
previous_time=entry_time;
|
|
||||||
previous_increment=increment;
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
last_decrease_gap=(current_time - previous_time);
|
|
||||||
printf "%d", last_decrease_gap;
|
|
||||||
}')
|
|
||||||
|
|
||||||
current_increment=$(sudo journalctl -u ceremonyclient.service -o short-iso -n 1 | grep 'publishing' | awk -F'"increment":' '{print $2}' | awk -F',' '{print $1}')
|
|
||||||
|
|
||||||
if [ $time_since_restart -ge $RESTART_WAIT_TIME ] || [ $last_restart_time -eq 0 ]; then
|
|
||||||
if [ ! -z "$last_decrease" ] && [ "$last_decrease" -gt "$RESTART_THRESHOLD" ]; then
|
|
||||||
restart_service "Last decrease was $last_decrease seconds ago (more than 5 minutes)"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$current_increment" ]; then
|
|
||||||
if [ "$current_increment" != "$last_increment" ]; then
|
|
||||||
last_increment=$current_increment
|
|
||||||
last_change_time=$current_time
|
|
||||||
increment_updated="${YELLOW}Increment value updated: $current_increment${NC}"
|
|
||||||
else
|
|
||||||
time_since_last_change=$((current_time - last_change_time))
|
|
||||||
|
|
||||||
if [ $time_since_last_change -ge $RESTART_THRESHOLD ]; then
|
|
||||||
restart_service "Increment value has not changed for $time_since_last_change seconds"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Log analysis output
|
|
||||||
sudo journalctl -u ceremonyclient.service -o short-iso -n 2000 | grep 'publishing' | tail -n 20 | \
|
|
||||||
awk -v current_time="$current_time" '
|
|
||||||
BEGIN {
|
|
||||||
total_time=0;
|
|
||||||
total_decrement=0;
|
|
||||||
count=0
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timestamp=$1;
|
|
||||||
increment=gensub(/.*"increment":([0-9]+).*/, "\\1", "g", $0);
|
|
||||||
cmd="date -d \"" timestamp "\" +%s";
|
|
||||||
cmd | getline entry_time;
|
|
||||||
close(cmd);
|
|
||||||
|
|
||||||
if (previous_time && previous_increment) {
|
|
||||||
time_gap=entry_time-previous_time;
|
|
||||||
decrement=previous_increment-increment;
|
|
||||||
if (decrement > 0) {
|
|
||||||
total_time+=time_gap;
|
|
||||||
total_decrement+=decrement;
|
|
||||||
count++;
|
|
||||||
printf "Increment %s, Time Gap: %ss, Decrement: %s\n", increment, time_gap, decrement
|
|
||||||
}
|
|
||||||
};
|
|
||||||
previous_time=entry_time;
|
|
||||||
previous_increment=increment
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
last_decrement_gap=(current_time - previous_time);
|
|
||||||
avg_time_per_decrement=(count > 0 && total_decrement > 0) ? total_time / total_decrement : 0;
|
|
||||||
|
|
||||||
printf "___________________________________________________________\n";
|
|
||||||
printf "Last Decrease: %s Seconds ago\n", last_decrement_gap;
|
|
||||||
}'
|
|
||||||
|
|
||||||
|
|
||||||
# Ongoing statistics
|
|
||||||
sudo journalctl -u ceremonyclient.service -o short-iso -n 2000 | grep 'publishing' | tail -n 20 | \
|
|
||||||
awk -v current_time="$current_time" '
|
|
||||||
BEGIN {
|
|
||||||
total_time=0;
|
|
||||||
total_decrement=0;
|
|
||||||
count=0
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timestamp=$1;
|
|
||||||
increment=gensub(/.*"increment":([0-9]+).*/, "\\1", "g", $0);
|
|
||||||
cmd="date -d \"" timestamp "\" +%s";
|
|
||||||
cmd | getline entry_time;
|
|
||||||
close(cmd);
|
|
||||||
|
|
||||||
if (previous_time && previous_increment) {
|
|
||||||
time_gap=entry_time-previous_time;
|
|
||||||
decrement=previous_increment-increment;
|
|
||||||
if (decrement > 0) {
|
|
||||||
total_time+=time_gap;
|
|
||||||
total_decrement+=decrement;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
previous_time=entry_time;
|
|
||||||
previous_increment=increment
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
avg_time_per_decrement=(count > 0 && total_decrement > 0) ? total_time / total_decrement : 0;
|
|
||||||
|
|
||||||
printf "Avg Publish Time per Unit Decrement: %.6f seconds\n", avg_time_per_decrement;
|
|
||||||
printf "Time to reach 0 for your %s remaining Increments: %.2f days\n", previous_increment, (previous_increment * avg_time_per_decrement) / 86400;
|
|
||||||
printf "___________________________________________________________\n";
|
|
||||||
printf "Estimated time to reach 0 from different starting points:\n";
|
|
||||||
printf "From 3,000,000: %.2f days\n", (3000000 * avg_time_per_decrement) / 86400;
|
|
||||||
printf "From 2,500,000: %.2f days\n", (2500000 * avg_time_per_decrement) / 86400;
|
|
||||||
printf "From 2,000,000: %.2f days\n", (2000000 * avg_time_per_decrement) / 86400;
|
|
||||||
printf "From 1,500,000: %.2f days\n", (1500000 * avg_time_per_decrement) / 86400;
|
|
||||||
printf "From 1,000,000: %.2f days\n", (1000000 * avg_time_per_decrement) / 86400;
|
|
||||||
printf "From 500,000: %.2f days\n", (500000 * avg_time_per_decrement) / 86400;
|
|
||||||
printf "From 250,000: %.2f days\n", (250000 * avg_time_per_decrement) / 86400;
|
|
||||||
}'
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep $CHECK_INTERVAL
|
|
||||||
done
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Set the version number
|
# Set the version number
|
||||||
VERSION="2.0.4.1"
|
VERSION="2.0.0.1"
|
||||||
|
|
||||||
# Determine the ExecStart line based on the architecture
|
# Determine the ExecStart line based on the architecture
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
|||||||
@ -121,7 +121,7 @@ git checkout release-cdn
|
|||||||
# Build Ceremonyclient qClient
|
# Build Ceremonyclient qClient
|
||||||
echo "⏳Building qCiient"
|
echo "⏳Building qCiient"
|
||||||
sleep 1 # Add a 1-second delay
|
sleep 1 # Add a 1-second delay
|
||||||
cd ~/ceremonyclient/node
|
cd ~/ceremonyclient/client
|
||||||
GOEXPERIMENT=arenas go build -o qclient main.go
|
GOEXPERIMENT=arenas go build -o qclient main.go
|
||||||
|
|
||||||
# Step 5:Determine the ExecStart line based on the architecture
|
# Step 5:Determine the ExecStart line based on the architecture
|
||||||
@ -129,7 +129,7 @@ GOEXPERIMENT=arenas go build -o qclient main.go
|
|||||||
HOME=$(eval echo ~$HOME_DIR)
|
HOME=$(eval echo ~$HOME_DIR)
|
||||||
# Use the home directory in the path
|
# Use the home directory in the path
|
||||||
NODE_PATH="$HOME/ceremonyclient/node"
|
NODE_PATH="$HOME/ceremonyclient/node"
|
||||||
EXEC_START="$NODE_PATH/$NODE_BINARY"
|
EXEC_START="$NODE_PATH/release_autorun.sh"
|
||||||
|
|
||||||
# Create Ceremonyclient Service
|
# Create Ceremonyclient Service
|
||||||
echo "⏳Creating Ceremonyclient Service"
|
echo "⏳Creating Ceremonyclient Service"
|
||||||
@ -156,7 +156,7 @@ RestartSec=5s
|
|||||||
WorkingDirectory=$NODE_PATH
|
WorkingDirectory=$NODE_PATH
|
||||||
ExecStart=$EXEC_START
|
ExecStart=$EXEC_START
|
||||||
KillSignal=SIGINT
|
KillSignal=SIGINT
|
||||||
TimeoutStopSec=75s
|
TimeoutStopSec=30s
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Set the version number
|
# Set the version number
|
||||||
|
|
||||||
VERSION="2.0.4.1"
|
VERSION="2.0.0.1"
|
||||||
qClientVERSION="2.0.4.1"
|
|
||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
# Step 0: Welcome
|
# Step 0: Welcome
|
||||||
@ -88,59 +87,40 @@ cd ~/ceremonyclient/
|
|||||||
# git remote set-url origin https://github.com/QuilibriumNetwork/ceremonyclient.git || git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git
|
# git remote set-url origin https://github.com/QuilibriumNetwork/ceremonyclient.git || git remote set-url origin https://source.quilibrium.com/quilibrium/ceremonyclient.git
|
||||||
git checkout release
|
git checkout release
|
||||||
|
|
||||||
#==========================
|
|
||||||
# NODE BINARY DOWNLOAD
|
|
||||||
#==========================
|
|
||||||
|
|
||||||
get_os_arch() {
|
get_os_arch() {
|
||||||
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
local arch=$(uname -m)
|
local arch=$(uname -m)
|
||||||
|
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
case "$os" in
|
|
||||||
linux|darwin) ;;
|
case $arch in
|
||||||
*) echo "Unsupported operating system: $os" >&2; return 1 ;;
|
x86_64)
|
||||||
|
arch="amd64"
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
arch="arm64"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$arch" in
|
|
||||||
x86_64|amd64) arch="amd64" ;;
|
|
||||||
arm64|aarch64) arch="arm64" ;;
|
|
||||||
*) echo "Unsupported architecture: $arch" >&2; return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "${os}-${arch}"
|
echo "${os}-${arch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the current OS and architecture
|
# Get the current OS and architecture
|
||||||
OS_ARCH=$(get_os_arch)
|
OS_ARCH=$(get_os_arch)
|
||||||
|
|
||||||
# Base URL for the Quilibrium releases
|
|
||||||
RELEASE_FILES_URL="https://releases.quilibrium.com/release"
|
|
||||||
|
|
||||||
# Fetch the list of files from the release page
|
# Fetch the list of files from the release page
|
||||||
# Updated regex to allow for an optional fourth version number
|
FILES=$(curl -s $BASE_URL | grep -oE "node-[0-9]+\.[0-9]+\.[0-9]+-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
||||||
RELEASE_FILES=$(curl -s $RELEASE_FILES_URL | grep -oE "node-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
|
||||||
|
|
||||||
# Change to the download directory
|
# Change to the download directory
|
||||||
cd ~/ceremonyclient/node
|
cd ~/ceremonyclient/node
|
||||||
|
|
||||||
# Download each file
|
# Download each file
|
||||||
for file in $RELEASE_FILES; do
|
for file in $FILES; do
|
||||||
echo "Downloading $file..."
|
echo "Downloading $file..."
|
||||||
curl -L -o "$file" "https://releases.quilibrium.com/$file"
|
wget "https://releases.quilibrium.com/$file"
|
||||||
|
|
||||||
# Check if the download was successful
|
# Check if the download was successful
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "Successfully downloaded $file"
|
echo "Successfully downloaded $file"
|
||||||
# Check if the file is the base binary (without .dgst or .sig suffix)
|
|
||||||
if [[ $file =~ ^node-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-${OS_ARCH}$ ]]; then
|
|
||||||
echo "Making $file executable..."
|
|
||||||
chmod +x "$file"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Successfully made $file executable"
|
|
||||||
else
|
|
||||||
echo "Failed to make $file executable"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "Failed to download $file"
|
echo "Failed to download $file"
|
||||||
fi
|
fi
|
||||||
@ -148,8 +128,6 @@ for file in $RELEASE_FILES; do
|
|||||||
echo "------------------------"
|
echo "------------------------"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "✅ Node binary download completed."
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the ExecStart line based on the architecture
|
# Determine the ExecStart line based on the architecture
|
||||||
@ -161,11 +139,11 @@ if [ "$ARCH" = "x86_64" ]; then
|
|||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
NODE_BINARY="node-$VERSION-linux-amd64"
|
NODE_BINARY="node-$VERSION-linux-amd64"
|
||||||
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-amd64"
|
QCLIENT_BINARY="qclient-2.0.0-linux-amd64"
|
||||||
elif [ "$OS" = "Darwin" ]; then
|
elif [ "$OS" = "Darwin" ]; then
|
||||||
NODE_BINARY="node-$VERSION-darwin-amd64"
|
NODE_BINARY="node-$VERSION-darwin-amd64"
|
||||||
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-darwin-arm64"
|
QCLIENT_BINARY="qclient-2.0.0-darwin-arm64"
|
||||||
fi
|
fi
|
||||||
elif [ "$ARCH" = "aarch64" ]; then
|
elif [ "$ARCH" = "aarch64" ]; then
|
||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
@ -174,44 +152,21 @@ elif [ "$ARCH" = "aarch64" ]; then
|
|||||||
elif [ "$OS" = "Darwin" ]; then
|
elif [ "$OS" = "Darwin" ]; then
|
||||||
NODE_BINARY="node-$VERSION-darwin-arm64"
|
NODE_BINARY="node-$VERSION-darwin-arm64"
|
||||||
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-arm64"
|
QCLIENT_BINARY="qclient-2.0.0-linux-arm64"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
get_os_arch() {
|
|
||||||
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
local arch=$(uname -m)
|
|
||||||
|
|
||||||
case "$os" in
|
|
||||||
linux|darwin) ;;
|
|
||||||
*) echo "Unsupported operating system: $os" >&2; return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$arch" in
|
|
||||||
x86_64|amd64) arch="amd64" ;;
|
|
||||||
arm64|aarch64) arch="arm64" ;;
|
|
||||||
*) echo "Unsupported architecture: $arch" >&2; return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "${os}-${arch}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Step 4:Download qClient
|
# Step 4:Download qClient
|
||||||
echo "⏳Downloading qClient"
|
echo "⏳Downloading qClient"
|
||||||
sleep 1 # Add a 1-second delay
|
sleep 1 # Add a 1-second delay
|
||||||
# Get the current OS and architecture
|
# Get the current OS and architecture
|
||||||
OS_ARCH=$(get_os_arch)
|
OS_ARCH=$(get_os_arch)
|
||||||
|
|
||||||
# Base URL for the Quilibrium releases
|
|
||||||
BASE_URL="https://releases.quilibrium.com/qclient-release"
|
|
||||||
|
|
||||||
# Fetch the list of files from the release page
|
# Fetch the list of files from the release page
|
||||||
FILES=$(curl -s $BASE_URL | grep -oE "qclient-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
FILES=$(curl -s $BASE_URL | grep -oE "qclient-[0-9]+\.[0-9]+\.[0-9]+-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
||||||
|
|
||||||
# Change to the download directory
|
# Change to the download directory
|
||||||
cd ~/ceremonyclient/node
|
cd ~/ceremonyclient/client
|
||||||
|
|
||||||
# Download each file
|
# Download each file
|
||||||
for file in $FILES; do
|
for file in $FILES; do
|
||||||
@ -229,8 +184,8 @@ for file in $FILES; do
|
|||||||
echo "------------------------"
|
echo "------------------------"
|
||||||
done
|
done
|
||||||
|
|
||||||
//
|
mv $QCLIENT_BINARY qclient
|
||||||
chmod +x qclient*
|
chmod +x qclient
|
||||||
echo "✅ qClient binary downloaded and configured successfully."
|
echo "✅ qClient binary downloaded and configured successfully."
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -268,7 +223,7 @@ RestartSec=5s
|
|||||||
WorkingDirectory=$NODE_PATH
|
WorkingDirectory=$NODE_PATH
|
||||||
ExecStart=$EXEC_START
|
ExecStart=$EXEC_START
|
||||||
KillSignal=SIGINT
|
KillSignal=SIGINT
|
||||||
TimeoutStopSec=75s
|
TimeoutStopSec=30s
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@ -1,173 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Set the version number
|
|
||||||
|
|
||||||
VERSION="2.0.4.1-b7-testnet"
|
|
||||||
qClientVERSION="2.0.4.1"
|
|
||||||
|
|
||||||
cd ~
|
|
||||||
# Step 0: Welcome
|
|
||||||
echo "This script is made with ❤️ by 0xOzgur @ https://quilibrium.space "
|
|
||||||
echo "The script is prepared for Ubuntu machines. If you are using another operating system, please check the compatibility of the script."
|
|
||||||
echo "This script will be building new fresh Node for Quilibrium Testnet. Your use is at your own risk. 0xOzgur does not accept any liability."
|
|
||||||
echo "⏳Enjoy and sit back while you are building your Quilibrium Testnet Node!"
|
|
||||||
echo "⏳Processing..."
|
|
||||||
sleep 5 # Add a 10-second delay
|
|
||||||
|
|
||||||
# Step 1: Update and Upgrade the Machine
|
|
||||||
echo "Updating the machine"
|
|
||||||
echo "⏳Processing..."
|
|
||||||
sleep 2 # Add a 2-second delay
|
|
||||||
|
|
||||||
# Fof DEBIAN OS - Check if sudo and git is installed
|
|
||||||
if ! command -v sudo &> /dev/null
|
|
||||||
then
|
|
||||||
echo "sudo could not be found"
|
|
||||||
echo "Installing sudo..."
|
|
||||||
su -c "apt update && apt install sudo -y"
|
|
||||||
else
|
|
||||||
echo "sudo is installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v git &> /dev/null
|
|
||||||
then
|
|
||||||
echo "git could not be found"
|
|
||||||
echo "Installing git..."
|
|
||||||
su -c "apt update && apt install git -y"
|
|
||||||
else
|
|
||||||
echo "git is installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo apt upgrade -y
|
|
||||||
|
|
||||||
# Step 2: Adjust network buffer sizes
|
|
||||||
echo "Adjusting network buffer sizes..."
|
|
||||||
if grep -q "^net.core.rmem_max=600000000$" /etc/sysctl.conf; then
|
|
||||||
echo "net.core.rmem_max=600000000 found inside /etc/sysctl.conf, skipping..."
|
|
||||||
else
|
|
||||||
echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.rmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null
|
|
||||||
fi
|
|
||||||
if grep -q "^net.core.wmem_max=600000000$" /etc/sysctl.conf; then
|
|
||||||
echo "net.core.wmem_max=600000000 found inside /etc/sysctl.conf, skipping..."
|
|
||||||
else
|
|
||||||
echo -e "\n# Change made to increase buffer sizes for better network performance for ceremonyclient\nnet.core.wmem_max=600000000" | sudo tee -a /etc/sysctl.conf > /dev/null
|
|
||||||
fi
|
|
||||||
sudo sysctl -p
|
|
||||||
|
|
||||||
# Step 4:Download Ceremonyclient
|
|
||||||
echo "⏳Creating Testnet Directories"
|
|
||||||
sleep 1 # Add a 1-second delay
|
|
||||||
mkdir testnet
|
|
||||||
cd ~/testnet
|
|
||||||
mkdir ceremonyclient
|
|
||||||
cd ~/testnet/ceremonyclient/
|
|
||||||
|
|
||||||
# Determine the ExecStart line based on the architecture
|
|
||||||
ARCH=$(uname -m)
|
|
||||||
OS=$(uname -s)
|
|
||||||
|
|
||||||
# Determine the node binary name based on the architecture and OS
|
|
||||||
if [ "$ARCH" = "x86_64" ]; then
|
|
||||||
if [ "$OS" = "Linux" ]; then
|
|
||||||
NODE_BINARY="node-$VERSION-linux-amd64"
|
|
||||||
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-amd64"
|
|
||||||
elif [ "$OS" = "Darwin" ]; then
|
|
||||||
NODE_BINARY="node-$VERSION-darwin-amd64"
|
|
||||||
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-darwin-arm64"
|
|
||||||
fi
|
|
||||||
elif [ "$ARCH" = "aarch64" ]; then
|
|
||||||
if [ "$OS" = "Linux" ]; then
|
|
||||||
NODE_BINARY="node-$VERSION-linux-arm64"
|
|
||||||
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
|
||||||
elif [ "$OS" = "Darwin" ]; then
|
|
||||||
NODE_BINARY="node-$VERSION-darwin-arm64"
|
|
||||||
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-arm64"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#==========================
|
|
||||||
# NODE BINARY DOWNLOAD
|
|
||||||
#==========================
|
|
||||||
|
|
||||||
# Step 4:Download qClient
|
|
||||||
echo "⏳Downloading qClient"
|
|
||||||
sleep 1 # Add a 1-second delay
|
|
||||||
cd ~/testnet/ceremonyclient/node
|
|
||||||
wget https://releases.quilibrium.com/$NODE_BINARY
|
|
||||||
chmod +x $NODE_BINARY
|
|
||||||
echo "✅ Node binary for testnet downloaded and permissions configured completed."
|
|
||||||
|
|
||||||
#==========================
|
|
||||||
# qCLIENT BINARY DOWNLOAD
|
|
||||||
#==========================
|
|
||||||
cd ~/testnet/ceremonyclient/client
|
|
||||||
wget https://releases.quilibrium.com/$QCLIENT_BINARY
|
|
||||||
chmod +x $QCLIENT_BINARY
|
|
||||||
echo "✅ qClient binary for testnet downloaded and permissions configured completed."
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Step 5:Determine the ExecStart line based on the architecture
|
|
||||||
# Get the current user's home directory
|
|
||||||
HOME=$(eval echo ~$HOME_DIR)
|
|
||||||
|
|
||||||
# Use the home directory in the path
|
|
||||||
NODE_PATH="$HOME/testnet/ceremonyclient/node"
|
|
||||||
EXEC_START="$NODE_PATH/$NODE_BINARY"
|
|
||||||
|
|
||||||
# Step 6:Create Ceremonyclient Service
|
|
||||||
echo "⏳ Stopping Ceremonyclient Service"
|
|
||||||
service ceremonyclient stop
|
|
||||||
sleep 2 # Add a 2-second delay
|
|
||||||
|
|
||||||
echo "⏳ Creating Ceremonyclient Testnet Service"
|
|
||||||
sleep 2 # Add a 2-second delay
|
|
||||||
|
|
||||||
sudo tee /lib/systemd/system/qtestnet.service > /dev/null <<EOF
|
|
||||||
[Unit]
|
|
||||||
Description=Ceremony Client Testnet Service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
Restart=always
|
|
||||||
RestartSec=5s
|
|
||||||
WorkingDirectory=$NODE_PATH
|
|
||||||
ExecStart=$EXEC_START --signature-check=false --network=1
|
|
||||||
KillSignal=SIGINT
|
|
||||||
TimeoutStopSec=75s
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
# sudo systemctl enable ceremonyclient
|
|
||||||
|
|
||||||
# Step 7: Start the ceremonyclient service
|
|
||||||
echo "✅Starting Ceremonyclient Testnet Service"
|
|
||||||
sleep 1 # Add a 1-second delay
|
|
||||||
sudo service qtestnet start
|
|
||||||
|
|
||||||
# Step 8: See the logs of the ceremonyclient service
|
|
||||||
echo "🎉Welcome to Quilibrium Ceremonyclient VERSION"
|
|
||||||
echo "⏳Please let it flow node logs at least 5 minutes then you can press CTRL + C to exit the logs."
|
|
||||||
sleep 30 # Add a 5-second delay
|
|
||||||
|
|
||||||
CONFIG_FILE="$HOME/testnet/ceremonyclient/node/.config/config.yml"
|
|
||||||
|
|
||||||
# Backup the original file
|
|
||||||
cp "$CONFIG_FILE" "${CONFIG_FILE}.bak"
|
|
||||||
|
|
||||||
# Comment out existing bootstrap peers
|
|
||||||
sed -i '/bootstrapPeers:/,/^[^ ]/s/^ -/# -/' "$CONFIG_FILE"
|
|
||||||
|
|
||||||
# Add the new bootstrap peer
|
|
||||||
sed -i '/bootstrapPeers:/a\ - /ip4/91.242.214.79/udp/8336/quic-v1/p2p/QmNSGavG2DfJwGpHmzKjVmTD6CVSyJsUFTXsW4JXt2eySR' "$CONFIG_FILE"
|
|
||||||
|
|
||||||
echo "Bootstrap peers updated in $CONFIG_FILE"
|
|
||||||
echo "Original file backed up as ${CONFIG_FILE}.bak"
|
|
||||||
|
|
||||||
sudo service qtestnet restart
|
|
||||||
sudo journalctl -u qtestnet.service -f --no-hostname -o cat
|
|
||||||
@ -1,98 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Define file paths for storing previous values
|
|
||||||
seniority_file="/tmp/previous_seniority.txt"
|
|
||||||
balance_file="/tmp/previous_balance.txt"
|
|
||||||
|
|
||||||
# Arrays to store the last 30 frame ages
|
|
||||||
submitting_ages=()
|
|
||||||
creating_ages=()
|
|
||||||
|
|
||||||
# Flags to track the detection of both messages
|
|
||||||
submitting_proof_detected=false
|
|
||||||
shard_ring_proof_detected=false
|
|
||||||
|
|
||||||
# Function to calculate the average of an array
|
|
||||||
calculate_average() {
|
|
||||||
local arr=("$@")
|
|
||||||
local sum=0
|
|
||||||
for age in "${arr[@]}"; do
|
|
||||||
sum=$(echo "$sum + $age" | bc)
|
|
||||||
done
|
|
||||||
echo "scale=2; $sum / ${#arr[@]}" | bc
|
|
||||||
}
|
|
||||||
|
|
||||||
# Monitor journalctl for the specific keywords
|
|
||||||
sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat | grep --line-buffered -E 'submitting data proof|creating data shard ring proof' | while read -r line
|
|
||||||
do
|
|
||||||
# Print a human-readable timestamp
|
|
||||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - $line"
|
|
||||||
|
|
||||||
# Check for each specific message, extract frame age, and update arrays
|
|
||||||
if [[ "$line" == *"submitting data proof"* ]]; then
|
|
||||||
submitting_proof_detected=true
|
|
||||||
frame_age=$(echo "$line" | grep -oP '"frame_age":[0-9.]+(?=})' | cut -d: -f2)
|
|
||||||
submitting_ages+=("$frame_age")
|
|
||||||
# Keep only the last 30 frame ages
|
|
||||||
if [ ${#submitting_ages[@]} -gt 30 ]; then
|
|
||||||
submitting_ages=("${submitting_ages[@]:1}")
|
|
||||||
fi
|
|
||||||
elif [[ "$line" == *"creating data shard ring proof"* ]]; then
|
|
||||||
shard_ring_proof_detected=true
|
|
||||||
frame_age=$(echo "$line" | grep -oP '"frame_age":[0-9.]+(?=})' | cut -d: -f2)
|
|
||||||
creating_ages+=("$frame_age")
|
|
||||||
# Keep only the last 30 frame ages
|
|
||||||
if [ ${#creating_ages[@]} -gt 30 ]; then
|
|
||||||
creating_ages=("${creating_ages[@]:1}")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Only proceed if both messages have been detected
|
|
||||||
if $submitting_proof_detected && $shard_ring_proof_detected; then
|
|
||||||
# Reset flags for the next cycle
|
|
||||||
submitting_proof_detected=false
|
|
||||||
shard_ring_proof_detected=false
|
|
||||||
|
|
||||||
# Print the averages for the last 30 frame ages
|
|
||||||
echo "Average frame age for 'creating data shard ring proof': $(calculate_average "${creating_ages[@]}")"
|
|
||||||
echo "Average frame age for 'submitting data proof': $(calculate_average "${submitting_ages[@]}")"
|
|
||||||
|
|
||||||
# Navigate to the ceremonyclient/node directory
|
|
||||||
cd ~/ceremonyclient/node
|
|
||||||
|
|
||||||
# Run the token balance command and filter for the Total balance line
|
|
||||||
total_balance=$(./qclient-2.0.4.1-linux-amd64 token balance | grep -oP 'Total balance: \K[0-9.]+')
|
|
||||||
echo "Total balance: $total_balance"
|
|
||||||
|
|
||||||
# Run the node-info command and filter for specific lines
|
|
||||||
node_info=$(./node-2.0.4.1-linux-amd64 -node-info)
|
|
||||||
seniority=$(echo "$node_info" | grep -oP 'Seniority: \K[0-9]+')
|
|
||||||
prover_ring=$(echo "$node_info" | grep 'Prover Ring')
|
|
||||||
owned_balance=$(echo "$node_info" | grep 'Owned balance')
|
|
||||||
|
|
||||||
echo "$prover_ring"
|
|
||||||
echo "Seniority: $seniority"
|
|
||||||
echo "$owned_balance"
|
|
||||||
|
|
||||||
# Load previous values if they exist, otherwise set defaults
|
|
||||||
previous_seniority=$(cat "$seniority_file" 2>/dev/null || echo "0")
|
|
||||||
previous_balance=$(cat "$balance_file" 2>/dev/null || echo "0")
|
|
||||||
|
|
||||||
# Compare and check if Seniority and Total balance have increased
|
|
||||||
if (( seniority > previous_seniority )); then
|
|
||||||
echo "Seniority has increased from $previous_seniority to $seniority"
|
|
||||||
else
|
|
||||||
echo "Seniority has not increased."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( $(echo "$total_balance > $previous_balance" | bc -l) )); then
|
|
||||||
echo "Total balance has increased from $previous_balance to $total_balance"
|
|
||||||
else
|
|
||||||
echo "Total balance has not increased."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Store current Seniority and Total balance for the next iteration
|
|
||||||
echo "$seniority" > "$seniority_file"
|
|
||||||
echo "$total_balance" > "$balance_file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@ -17,22 +17,23 @@ alias wttr='curl wttr.in'
|
|||||||
|
|
||||||
neofetch
|
neofetch
|
||||||
|
|
||||||
|
# Shortcuts for Docker
|
||||||
|
alias dpeer-count='cd ~/ceremonyclient/ && docker compose exec node grpcurl -plaintext -max-msg-sz 150000000 localhost:8337 quilibrium.node.node.pb.NodeService.GetPeerManifests | grep peerId | wc -l'
|
||||||
|
alias dnode-info='cd ~/ceremonyclient/ && docker compose exec node node -node-info && cd ~'
|
||||||
|
alias ddb-console='cd ~/ceremonyclient/ && - docker compose exec node node --db-console && cd ~'
|
||||||
|
alias dbalance='cd ~/ceremonyclient/ && docker compose exec node node -balance && cd ~'
|
||||||
|
alias dlog='cd ~/ceremonyclient/ && docker compose logs -f -n, --tail 100 && cd ~'
|
||||||
|
alias dstart='cd ~/ceremonyclient/ && docker compose up -d && cd ~'
|
||||||
|
alias drestart='cd ~/ceremonyclient/ && docker compose down && docker compose up -d && cd ~'
|
||||||
|
alias dstop='cd ~/ceremonyclient/ && docker compose down && cd ~'
|
||||||
# Shortcuts for Service
|
# Shortcuts for Service
|
||||||
alias peer-count="cd ~/ceremonyclient/node && grpcurl -plaintext -max-msg-sz 150000000 localhost:8337 quilibrium.node.node.pb.NodeService.GetPeerManifests | grep peerId | wc -l && cd ~"
|
alias peer-count="cd ~/ceremonyclient/node && grpcurl -plaintext -max-msg-sz 150000000 localhost:8337 quilibrium.node.node.pb.NodeService.GetPeerManifests | grep peerId | wc -l && cd ~"
|
||||||
alias node-info="cd ~/ceremonyclient/node && ./node-2.0.4.1-linux-amd64 -node-info && cd ~"
|
alias node-info="cd ~/ceremonyclient/node && ./node-2.0-linux-amd64 -node-info && cd ~"
|
||||||
alias db-console="cd ~/ceremonyclient/node && ./node-2.0.4.1-linux-amd64 --db-console && cd ~"
|
alias db-console="cd ~/ceremonyclient/node && ./node-2.0-linux-amd64 --db-console && cd ~"
|
||||||
alias balance="cd ~/ceremonyclient/node && ./node-2.0.4.1-linux-amd64 -balance && cd ~"
|
alias balance="cd ~/ceremonyclient/node && ./node-2.0-linux-amd64 -balance && cd ~"
|
||||||
alias nlog="sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat"
|
alias nlog="sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat"
|
||||||
alias increment="sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat | grep time_taken"
|
alias increment="sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat | grep time_taken"
|
||||||
alias frame="sudo journalctl -u ceremonyclient.service -f --no-hostname -o cat | grep frame_number"
|
|
||||||
alias nstart="service ceremonyclient start"
|
alias nstart="service ceremonyclient start"
|
||||||
alias nrestart="service ceremonyclient restart"
|
alias nrestart="service ceremonyclient restart"
|
||||||
alias nstop="service ceremonyclient stop"
|
alias nstop="service ceremonyclient stop"
|
||||||
alias benchmark='increment=$(journalctl -u ceremonyclient -ocat -n 100 | grep increment | awk -F'\[:,\}\]' '\''{for(i=1;i<=NF;i++){if($i~"increment"){gsub(/[ "]/,"",$i); print $(i+1)}}}'\'' | tail -n 1) && difficulty=$(expr 200000 - $increment / 4) && cpus=$(nproc) && score=$(echo "scale=2; ($cpus*$cpus*1000)/$difficulty" | bc) && echo "" && echo "CPU(s): $cpus" && echo "Increment: $increment" && echo "Difficulty: $difficulty" && echo "Score: $score"'
|
alias benchmark='increment=$(journalctl -u ceremonyclient -ocat -n 100 | grep increment | awk -F'\[:,\}\]' '\''{for(i=1;i<=NF;i++){if($i~"increment"){gsub(/[ "]/,"",$i); print $(i+1)}}}'\'' | tail -n 1) && difficulty=$(expr 200000 - $increment / 4) && cpus=$(nproc) && score=$(echo "scale=2; ($cpus*$cpus*1000)/$difficulty" | bc) && echo "" && echo "CPU(s): $cpus" && echo "Increment: $increment" && echo "Difficulty: $difficulty" && echo "Score: $score"'
|
||||||
alias qbalance="cd ~/ceremonyclient/node && ./qclient-2.0.4.1-linux-amd64 token balance --public-rpc"
|
|
||||||
alias qtoken="cd ~/ceremonyclient/node && ./qclient-2.0.4.1-linux-amd64 token coins --public-rpc"
|
|
||||||
alias qmint="cd ~/ceremonyclient/node && ./qclient-2.0.4.1-linux-amd64 token mint all --public-rpc"
|
|
||||||
alias qmerge="cd ~/ceremonyclient/node && ./qclient-2.0.4.1-linux-amd64 token merge all --public-rpc"
|
|
||||||
alias mincrement="journalctl -u ceremonyclient.service -f --no-hostname -o cat -g 'publishing proof batch'-n 1000"
|
|
||||||
alias qnode="cd ~/ceremonyclient/node"
|
|
||||||
alias client="cd ~/ceremonyclient/node"
|
|
||||||
@ -7,8 +7,7 @@ clear
|
|||||||
|
|
||||||
# Set the version number
|
# Set the version number
|
||||||
|
|
||||||
VERSION="2.0.4.1"
|
VERSION="2.0.0.1"
|
||||||
qClientVERSION="2.0.4.1"
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the ExecStart line based on the architecture
|
# Determine the ExecStart line based on the architecture
|
||||||
@ -20,11 +19,11 @@ if [ "$ARCH" = "x86_64" ]; then
|
|||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
NODE_BINARY="node-$VERSION-linux-amd64"
|
NODE_BINARY="node-$VERSION-linux-amd64"
|
||||||
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-amd64"
|
QCLIENT_BINARY="qclient-$VERSION-linux-amd64"
|
||||||
elif [ "$OS" = "Darwin" ]; then
|
elif [ "$OS" = "Darwin" ]; then
|
||||||
NODE_BINARY="node-$VERSION-darwin-amd64"
|
NODE_BINARY="node-$VERSION-darwin-amd64"
|
||||||
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-darwin-arm64"
|
QCLIENT_BINARY="qclient-$VERSION-darwin-arm64"
|
||||||
fi
|
fi
|
||||||
elif [ "$ARCH" = "aarch64" ]; then
|
elif [ "$ARCH" = "aarch64" ]; then
|
||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
@ -33,17 +32,17 @@ elif [ "$ARCH" = "aarch64" ]; then
|
|||||||
elif [ "$OS" = "Darwin" ]; then
|
elif [ "$OS" = "Darwin" ]; then
|
||||||
NODE_BINARY="node-$VERSION-darwin-arm64"
|
NODE_BINARY="node-$VERSION-darwin-arm64"
|
||||||
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-arm64"
|
QCLIENT_BINARY="qclient-$VERSION-linux-arm64"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# URLs for scripts
|
# URLs for scripts
|
||||||
UPDATE_URL="https://git.088.im/coosld/QuilibriumTools/raw/branch/main/update.sh"
|
UPDATE_URL="https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/update.sh"
|
||||||
PREREQUISITES_URL="https://git.088.im/coosld/QuilibriumTools/raw/branch/main/install/Install_prerequisites.sh"
|
PREREQUISITES_URL="https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/install/Install_prerequisites.sh"
|
||||||
NODE_INSTALL_URL="https://git.088.im/coosld/QuilibriumTools/raw/branch/main/install/install_quilibrium_service.sh"
|
NODE_INSTALL_URL="https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/install/install_quilibrium_service.sh"
|
||||||
GRPCURL_CONFIG_URL="https://git.088.im/coosld/QuilibriumTools/raw/branch/main/configuration/config.sh"
|
GRPCURL_CONFIG_URL="https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/configuration/config.sh"
|
||||||
NODE_UPDATE_URL="https://git.088.im/coosld/QuilibriumTools/raw/branch/main/update/update.sh"
|
NODE_UPDATE_URL="https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/update/update.sh"
|
||||||
CHECK_VISIBILITY_URL="https://git.088.im/coosld/QuilibriumTools/raw/branch/main/visibility_check.sh"
|
CHECK_VISIBILITY_URL="https://raw.githubusercontent.com/0xOzgur/QuilibriumTools/main/visibility_check.sh"
|
||||||
|
|
||||||
# Function for each menu option
|
# Function for each menu option
|
||||||
install_prerequisites() {
|
install_prerequisites() {
|
||||||
@ -103,8 +102,9 @@ stop_node() {
|
|||||||
# Menu
|
# Menu
|
||||||
while true; do
|
while true; do
|
||||||
clear
|
clear
|
||||||
echo "This script is made with ❤️ by 0xOzgur @ https://quilibrium.space"
|
echo "This script is made with ❤️ by 0xOzgur.eth @ https://quilibrium.space"
|
||||||
echo "Welcome to Quilibrium for Dummies!"
|
echo "Welcome to Quilibrium for Dummies!"
|
||||||
|
0xOzgur
|
||||||
echo "
|
echo "
|
||||||
_____ _ _ _ _ _
|
_____ _ _ _ _ _
|
||||||
/ ___ \ (_) (_) | (_)
|
/ ___ \ (_) (_) | (_)
|
||||||
@ -160,4 +160,4 @@ echo "
|
|||||||
esac
|
esac
|
||||||
echo ""
|
echo ""
|
||||||
read -n 1 -s -r -p "Press any key to continue"
|
read -n 1 -s -r -p "Press any key to continue"
|
||||||
done
|
done
|
||||||
126
update/update.sh
126
update/update.sh
@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
VERSION="2.0.4.1"
|
VERSION="2.0.0.1"
|
||||||
qClientVERSION="2.0.4.1"
|
|
||||||
|
|
||||||
|
|
||||||
# Step 0: Welcome
|
# Step 0: Welcome
|
||||||
@ -41,62 +40,43 @@ git checkout main
|
|||||||
git branch -D release
|
git branch -D release
|
||||||
git pull
|
git pull
|
||||||
git checkout release
|
git checkout release
|
||||||
echo "✅ Github repo updated to the latest changes successfully."
|
echo "✅ Downloaded the latest changes successfully."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
#==========================
|
|
||||||
# NODE BINARY DOWNLOAD
|
|
||||||
#==========================
|
|
||||||
|
|
||||||
get_os_arch() {
|
get_os_arch() {
|
||||||
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
local arch=$(uname -m)
|
local arch=$(uname -m)
|
||||||
|
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
case "$os" in
|
|
||||||
linux|darwin) ;;
|
case $arch in
|
||||||
*) echo "Unsupported operating system: $os" >&2; return 1 ;;
|
x86_64)
|
||||||
|
arch="amd64"
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
arch="arm64"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$arch" in
|
|
||||||
x86_64|amd64) arch="amd64" ;;
|
|
||||||
arm64|aarch64) arch="arm64" ;;
|
|
||||||
*) echo "Unsupported architecture: $arch" >&2; return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "${os}-${arch}"
|
echo "${os}-${arch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the current OS and architecture
|
# Get the current OS and architecture
|
||||||
OS_ARCH=$(get_os_arch)
|
OS_ARCH=$(get_os_arch)
|
||||||
|
|
||||||
# Base URL for the Quilibrium releases
|
|
||||||
RELEASE_FILES_URL="https://releases.quilibrium.com/release"
|
|
||||||
|
|
||||||
# Fetch the list of files from the release page
|
# Fetch the list of files from the release page
|
||||||
# Updated regex to allow for an optional fourth version number
|
FILES=$(curl -s $BASE_URL | grep -oE "node-[0-9]+\.[0-9]+\.[0-9]+-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
||||||
RELEASE_FILES=$(curl -s $RELEASE_FILES_URL | grep -oE "node-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
|
||||||
|
|
||||||
# Change to the download directory
|
# Change to the download directory
|
||||||
cd ~/ceremonyclient/node
|
cd ~/ceremonyclient/node
|
||||||
|
|
||||||
# Download each file
|
# Download each file
|
||||||
for file in $RELEASE_FILES; do
|
for file in $FILES; do
|
||||||
echo "Downloading $file..."
|
echo "Downloading $file..."
|
||||||
curl -L -o "$file" "https://releases.quilibrium.com/$file"
|
wget "https://releases.quilibrium.com/$file"
|
||||||
|
|
||||||
# Check if the download was successful
|
# Check if the download was successful
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "Successfully downloaded $file"
|
echo "Successfully downloaded $file"
|
||||||
# Check if the file is the base binary (without .dgst or .sig suffix)
|
|
||||||
if [[ $file =~ ^node-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-${OS_ARCH}$ ]]; then
|
|
||||||
echo "Making $file executable..."
|
|
||||||
chmod +x "$file"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Successfully made $file executable"
|
|
||||||
else
|
|
||||||
echo "Failed to make $file executable"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "Failed to download $file"
|
echo "Failed to download $file"
|
||||||
fi
|
fi
|
||||||
@ -104,8 +84,6 @@ for file in $RELEASE_FILES; do
|
|||||||
echo "------------------------"
|
echo "------------------------"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "✅ Node binary download completed."
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the ExecStart line based on the architecture
|
# Determine the ExecStart line based on the architecture
|
||||||
@ -117,11 +95,11 @@ if [ "$ARCH" = "x86_64" ]; then
|
|||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
NODE_BINARY="node-$VERSION-linux-amd64"
|
NODE_BINARY="node-$VERSION-linux-amd64"
|
||||||
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
GO_BINARY="go1.22.4.linux-amd64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-amd64"
|
QCLIENT_BINARY="qclient-2.0.0-linux-amd64"
|
||||||
elif [ "$OS" = "Darwin" ]; then
|
elif [ "$OS" = "Darwin" ]; then
|
||||||
NODE_BINARY="node-$VERSION-darwin-amd64"
|
NODE_BINARY="node-$VERSION-darwin-amd64"
|
||||||
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
GO_BINARY="go1.22.44.linux-amd64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-darwin-arm64"
|
QCLIENT_BINARY="qclient-2.0.0-darwin-arm64"
|
||||||
fi
|
fi
|
||||||
elif [ "$ARCH" = "aarch64" ]; then
|
elif [ "$ARCH" = "aarch64" ]; then
|
||||||
if [ "$OS" = "Linux" ]; then
|
if [ "$OS" = "Linux" ]; then
|
||||||
@ -130,41 +108,20 @@ elif [ "$ARCH" = "aarch64" ]; then
|
|||||||
elif [ "$OS" = "Darwin" ]; then
|
elif [ "$OS" = "Darwin" ]; then
|
||||||
NODE_BINARY="node-$VERSION-darwin-arm64"
|
NODE_BINARY="node-$VERSION-darwin-arm64"
|
||||||
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
GO_BINARY="go1.22.4.linux-arm64.tar.gz"
|
||||||
QCLIENT_BINARY="qclient-$qClientVERSION-linux-arm64"
|
QCLIENT_BINARY="qclient-2.0.0-linux-arm64"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_os_arch() {
|
|
||||||
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
local arch=$(uname -m)
|
|
||||||
|
|
||||||
case "$os" in
|
|
||||||
linux|darwin) ;;
|
|
||||||
*) echo "Unsupported operating system: $os" >&2; return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$arch" in
|
|
||||||
x86_64|amd64) arch="amd64" ;;
|
|
||||||
arm64|aarch64) arch="arm64" ;;
|
|
||||||
*) echo "Unsupported architecture: $arch" >&2; return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "${os}-${arch}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 4:Update qClient
|
# Step 4:Update qClient
|
||||||
|
|
||||||
# Get the current OS and architecture
|
# Get the current OS and architecture
|
||||||
OS_ARCH=$(get_os_arch)
|
OS_ARCH=$(get_os_arch)
|
||||||
|
|
||||||
# Base URL for the Quilibrium releases
|
|
||||||
BASE_URL="https://releases.quilibrium.com/qclient-release"
|
|
||||||
|
|
||||||
# Fetch the list of files from the release page
|
# Fetch the list of files from the release page
|
||||||
FILES=$(curl -s $BASE_URL | grep -oE "qclient-[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
FILES=$(curl -s $BASE_URL | grep -oE "qclient-[0-9]+\.[0-9]+\.[0-9]+-${OS_ARCH}(\.dgst)?(\.sig\.[0-9]+)?")
|
||||||
|
|
||||||
# Change to the download directory
|
# Change to the download directory
|
||||||
cd ~/ceremonyclient/node
|
cd ~/ceremonyclient/client
|
||||||
|
|
||||||
# Download each file
|
# Download each file
|
||||||
for file in $FILES; do
|
for file in $FILES; do
|
||||||
@ -182,7 +139,8 @@ for file in $FILES; do
|
|||||||
echo "------------------------"
|
echo "------------------------"
|
||||||
done
|
done
|
||||||
|
|
||||||
chmod +x qclient*
|
mv $QCLIENT_BINARY qclient
|
||||||
|
chmod +x qclient
|
||||||
echo "✅ qClient binary downloaded and configured successfully."
|
echo "✅ qClient binary downloaded and configured successfully."
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -194,21 +152,13 @@ HOME=$(eval echo ~$HOME_DIR)
|
|||||||
NODE_PATH="$HOME/ceremonyclient/node"
|
NODE_PATH="$HOME/ceremonyclient/node"
|
||||||
EXEC_START="$NODE_PATH/$NODE_BINARY"
|
EXEC_START="$NODE_PATH/$NODE_BINARY"
|
||||||
|
|
||||||
# Step 6:Create Ceremonyclient Service
|
# Re-Create Ceremonyclient Service
|
||||||
echo "⏳ Creating Ceremonyclient Service"
|
echo "⏳ Re-Creating Ceremonyclient Service"
|
||||||
sleep 2 # Add a 2-second delay
|
sleep 2 # Add a 2-second delay
|
||||||
|
SERVICE_FILE="/lib/systemd/system/ceremonyclient.service"
|
||||||
# Check if the file exists before attempting to remove it
|
if [ ! -f "$SERVICE_FILE" ]; then
|
||||||
if [ -f "/lib/systemd/system/ceremonyclient.service" ]; then
|
echo "📝 Creating new ceremonyclient service file..."
|
||||||
# If the file exists, remove it
|
if ! sudo tee "$SERVICE_FILE" > /dev/null <<EOF
|
||||||
rm /lib/systemd/system/ceremonyclient.service
|
|
||||||
echo "ceremonyclient.service file removed."
|
|
||||||
else
|
|
||||||
# If the file does not exist, inform the user
|
|
||||||
echo "ceremonyclient.service file does not exist. No action taken."
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null <<EOF
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceremony Client Go App Service
|
Description=Ceremony Client Go App Service
|
||||||
|
|
||||||
@ -219,11 +169,27 @@ RestartSec=5s
|
|||||||
WorkingDirectory=$NODE_PATH
|
WorkingDirectory=$NODE_PATH
|
||||||
ExecStart=$EXEC_START
|
ExecStart=$EXEC_START
|
||||||
KillSignal=SIGINT
|
KillSignal=SIGINT
|
||||||
TimeoutStopSec=75s
|
TimeoutStopSec=30s
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
then
|
||||||
|
echo "❌ Error: Failed to create ceremonyclient service file." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "🔍 Checking existing ceremonyclient service file..."
|
||||||
|
# Check if the required lines exist and if they are different
|
||||||
|
if ! grep -q "WorkingDirectory=$NODE_PATH" "$SERVICE_FILE" || ! grep -q "ExecStart=$EXEC_START" "$SERVICE_FILE"; then
|
||||||
|
echo "🔄 Updating existing ceremonyclient service file..."
|
||||||
|
# Replace the existing lines with new values
|
||||||
|
sudo sed -i "s|WorkingDirectory=.*|WorkingDirectory=$NODE_PATH|" "$SERVICE_FILE"
|
||||||
|
sudo sed -i "s|ExecStart=.*|ExecStart=$EXEC_START|" "$SERVICE_FILE"
|
||||||
|
else
|
||||||
|
echo "✅ No changes needed."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Start the ceremonyclient service
|
# Start the ceremonyclient service
|
||||||
echo "✅ Starting Ceremonyclient Service"
|
echo "✅ Starting Ceremonyclient Service"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user