diff --git a/bin/bench b/bin/bench index c5079bf..0305d4d 100644 Binary files a/bin/bench and b/bin/bench differ diff --git a/bin/client b/bin/client index 0fe3e45..2d2ae8d 100644 Binary files a/bin/client and b/bin/client differ diff --git a/bin/slave b/bin/slave new file mode 100644 index 0000000..3a13bb7 Binary files /dev/null and b/bin/slave differ diff --git a/install.sh b/install.sh index 8d01b33..c052e97 100755 --- a/install.sh +++ b/install.sh @@ -1,40 +1,66 @@ #!/bin/bash -if [ "$#" -ne 7 ] && [ "$#" -ne 8 ]; then +# Vérification du nombre d'arguments +if [ "$#" -ne 6 ] && [ "$#" -ne 7 ]; then echo "wrong parameters" exit 1 fi +# Affectation des paramètres slave_id=$1 slave_name=$2 server_url=$3 -port=$4 -login=$5 -private_key=$6 -client_version=$7 +login=$4 +private_key=$5 +client_version=$6 +# Définir la branche par défaut sur "main" branch="main" -if [ "$#" -eq 8 ] && [ "$mode" = "testnet" ]; then + +# Vérifier si un 8ème argument est passé et correspond à "testnet" +if [ "$#" -eq 7 ] && [ "$7" = "testnet" ]; then branch="test" fi -# Remove existing directory and recreate +if [ -z "$branch" ]; then + echo "Error: Branch not defined." + exit 1 +fi + +# Affichage des paramètres pour debug +echo "Slave ID: $slave_id" +echo "Slave Name: $slave_name" +echo "Server URL: $server_url" +echo "Login: $login" +echo "Private Key: $private_key" +echo "Client Version: $client_version" +echo "Branch: $branch" + +# Suppression et recréation du répertoire rm -rf "tig_pool_$branch" mkdir "tig_pool_$branch" cd "tig_pool_$branch" || exit 1 -# Kill any existing screens named pool_tig +# Arrêter les écrans nommés pool_tig existants screen -ls | grep pool_tig | awk '{print $1}' | xargs -I {} screen -S {} -X kill -# Download and run the updated script -wget --no-cache "https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/scripts/tig_pool_master.sh" +# Télécharger et exécuter le script mis à jour +script_url="https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/scripts/tig_pool_master.sh" +echo "Downloading script from: $script_url" + +wget --no-cache "$script_url" +if [ $? -ne 0 ]; then + echo "Error downloading script. Please check the branch and URL." + exit 1 +fi + sudo chmod +x tig_pool_master.sh +# Exécuter le script téléchargé avec les paramètres appropriés ./tig_pool_master.sh \ -id_slave "$slave_id" \ -nom_slave "$slave_name" \ -ip "$server_url" \ - -port "$port" \ -login "$login" \ -tok "$private_key" \ -url "$server_url" \ diff --git a/scripts/tig_pool_master.sh b/scripts/tig_pool_master.sh index 45ca6d3..9d09bff 100755 --- a/scripts/tig_pool_master.sh +++ b/scripts/tig_pool_master.sh @@ -2,20 +2,28 @@ # Function to display usage usage() { - echo "Usage: $0 -id_slave -nom_slave -ip -port -login -tok -url -b " + echo "Usage: $0 -id_slave -nom_slave -ip -login -tok -url -b " exit 1 } # Check if the total number of arguments ok -if [ "$#" -ne 18 ]; then +if [ "$#" -ne 16 ]; then usage fi + +# Check the number of processor threads +# cpu_threads=$(grep -c ^processor /proc/cpuinfo) +# if [ "$cpu_threads" -lt 24 ]; then +# echo "Error: Your system has less than 24 threads ($cpu_threads detected). Installation aborted your not able to Mine on TIGPool." +# exit 1 +# fi + + # Initialize variables for parameters id_slave="" nom_slave="" ip="" -port="" v="" login_discord="" private_key="" @@ -37,10 +45,6 @@ while [[ "$#" -gt 0 ]]; do ip="$2" shift 2 ;; - -port) - port="$2" - shift 2 - ;; -v) v="$2" shift 2 @@ -69,7 +73,7 @@ while [[ "$#" -gt 0 ]]; do done # Ensure variables are not empty -if [ -z "$id_slave" ] || [ -z "$nom_slave" ] || [ -z "$ip" ] || [ -z "$port" ] || [ -z "$login_discord" ] || [ -z "$private_key" ] || [ -z "$URL_SERVER" ]|| [ -z "$branch" ]; then +if [ -z "$id_slave" ] || [ -z "$nom_slave" ] || [ -z "$ip" ] || [ -z "$login_discord" ] || [ -z "$private_key" ] || [ -z "$URL_SERVER" ]|| [ -z "$branch" ]; then usage fi @@ -85,7 +89,6 @@ current_path=$(pwd) echo "ID Slave: $id_slave" echo "Slave Name: $nom_slave" echo "IP: $ip" -echo "Port: $port" echo "Login: $login_discord" echo "Private Key: $private_key" echo "URL Server: $URL_SERVER" @@ -121,20 +124,6 @@ cd $current_path python3 -m venv venv -mkdir -p tig-benchmarker -cd tig-benchmarker -wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/slave.py -O slave.py -wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/requirements.txt -O requirements.txt -mkdir -p common -cd common -wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/__init__.py -O __init__.py -wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/merkle_tree.py -O merkle_tree.py -wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/structs.py -O structs.py -wget --no-cache https://raw.githubusercontent.com/tig-pool-nk/client/refs/heads/$branch/tig-benchmarker/common/utils.py -O utils.py - - - - cd $current_path ./venv/bin/pip3 install -r tig-benchmarker/requirements.txt @@ -149,7 +138,13 @@ if [ $? -ne 0 ]; then exit 1 fi -wget --no-cache https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/bench -O bench +wget https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/slave -O slave +if [ $? -ne 0 ]; then + echo "Error downloading slave" + exit 1 +fi + +wget https://github.com/tig-pool-nk/client/raw/refs/heads/$branch/bin/bench -O bench if [ $? -ne 0 ]; then echo "Error downloading bench" exit 1 @@ -166,6 +161,7 @@ fi chmod +x client_tig_pool chmod +x bench chmod +x tig_idle +chmod +x slave cd $current_path @@ -178,8 +174,7 @@ sed -i "s|@login@|$login_discord|g" pool_tig_launch_${id_slave}_${nom_slave}.sh sed -i "s|@tok@|$private_key|g" pool_tig_launch_${id_slave}_${nom_slave}.sh sed -i "s|@worker@|$nom_slave|g" pool_tig_launch_${id_slave}_${nom_slave}.sh sed -i "s|@ip@|$ip|g" pool_tig_launch_${id_slave}_${nom_slave}.sh -sed -i "s|@port@|$port|g" pool_tig_launch_${id_slave}_${nom_slave}.sh -sed -i "s|@url@|http://$URL_SERVER|g" pool_tig_launch_${id_slave}_${nom_slave}.sh +sed -i "s|@url@|https://$URL_SERVER|g" pool_tig_launch_${id_slave}_${nom_slave}.sh sed -i "s|@version@|$v|g" pool_tig_launch_${id_slave}_${nom_slave}.sh # Grant execution permissions to the launch file diff --git a/tig-benchmarker/slave b/tig-benchmarker/slave new file mode 100644 index 0000000..b92ae64 Binary files /dev/null and b/tig-benchmarker/slave differ diff --git a/tig-benchmarker/slave.py b/tig-benchmarker/slave.py index d2387b6..9c77e46 100644 --- a/tig-benchmarker/slave.py +++ b/tig-benchmarker/slave.py @@ -123,8 +123,8 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm with open(f"{output_folder}/result.json") as f: result = json.load(f) - submit_url = f"http://{master_ip}:{master_port}/submit-batch-root/{batch_id}" - logger.info(f"posting root to {submit_url}") + submit_url = f"https://{master_ip}/submit-batch-root/{batch_id}" + logger.info(f"posting root to master") resp = session.post(submit_url, json=result) if resp.status_code == 200: FINISHED_BATCH_IDS[batch_id] = now() @@ -155,8 +155,8 @@ def send_results(session, master_ip, master_port, tig_worker_path, download_wasm for n in batch["sampled_nonces"] ] - submit_url = f"http://{master_ip}:{master_port}/submit-batch-proofs/{batch_id}" - logger.info(f"posting proofs to {submit_url}") + submit_url = f"https://{master_ip}/submit-batch-proofs/{batch_id}" + logger.info(f"posting proofs ") resp = session.post(submit_url, json={"merkle_proofs": proofs_to_submit}) if resp.status_code == 200: FINISHED_BATCH_IDS[batch_id] = now() @@ -197,8 +197,8 @@ def process_batch(session, tig_worker_path, download_wasms_folder, num_workers, def poll_batches(session, master_ip, master_port, output_path): - get_batches_url = f"http://{master_ip}:{master_port}/get-batches" - logger.info(f"fetching batches from {get_batches_url}") + get_batches_url = f"https://{master_ip}/get-batches" + logger.info(f"fetching batches ") resp = session.get(get_batches_url) if resp.status_code == 200: