Skip to content

Commit

Permalink
Merge pull request #2 from qubic-li/v1.8.9_1
Browse files Browse the repository at this point in the history
Add README information. In version "1.8.9_1" the settings entered by …
  • Loading branch information
Worm committed Mar 18, 2024
2 parents e233b6c + 7323cd8 commit c347acf
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 35 deletions.
61 changes: 56 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Qubic HiveOs Miner (WIP)
This is the integration of the main client from qubic.li to HiveOs.

Detailed Instructions on how to use Qubic Client for HiveOs is work in progress.
Use URL in flight sheet: https://github.com/qubic-li/hiveos/releases/download/v1.8.9/qubminer-1.8.9_1.tar.gz

## :warning: Hive Os Mandatory Installation Instructions
## Qubic Resources

- [Qubic Website](https://web.qubic.li/)
- [Qubic Web Wallet](https://wallet.qubic.li/)
- [Qubic Mining Pool](https://app.qubic.li/public/)
- [Official Qubic Client](https://github.com/qubic-li/client?tab=readme-ov-file#download)

## :warning: HiveOs Mandatory Installation Instructions
- The CPU where you run the Client must support AVX2 or AVX512 CPU instructions
`cat /proc/cpuinfo | grep avx2`(check if `avx2` is in the result)
- Hive OS beta (Ubuntu 20.04)
- To run the Qubic miner, you need the beta version of HiveOS.
`/hive/sbin/hive-replace --list` (choice 2/ yes to apply -- better to start this fresh install if you'r stuck)
- GLIBC >=2.34
```apt update && apt upgrade -y && echo "deb http://archive.ubuntu.com/ubuntu jammy main" >> /etc/apt/sources.list && apt update && apt install tmux -y && apt install libc6 -y``` (answer yes to any question)
Expand All @@ -19,13 +27,56 @@ Detailed Instructions on how to use Qubic Client for HiveOs is work in progress.
*Only NVIDIA GPU compatible*
<br>

## Flight Sheet Configuration
The startup script takes values from the flight sheet to complete the default configuration (`appsettings_global.json`).

Each time the miner starts, the `appsettings.json` file is recreated

### GPU mining:
![Flight Sheet GPU](/img/FlightSheetGPU.png)
Extra config arguments exemple:
```
nvtool --setcoreoffset 200 --setclocks 1600 --setmem 7000 --setmemoffset 2000
"accessToken":"YOUROWNTOKEN"
```

### CPU mining:
![Flight Sheet CPU](/img/FlightSheetCPU.png)
Extra config arguments exemple:
```
"cpuOnly":"yes"
"amountOfThreads":24
"accessToken":"YOUROWNTOKEN"
```

## :wrench: Hive Os Settings

- Recommended GPU overclocks :
### Miner Configuration

- **Miner name:** Automatically filled with the installation URL.
- **Installation URL:** `https://github.com/qubic-li/hiveos/releases/download/v1.8.9/qubminer-1.8.9_1.tar.gz`
- **Hash algorithm:** Not used, leave as `----`.
- **Wallet and worker template:** Worker name. Value of `"alias"` in `appsettings.json`.
- **Pool URL:** Value of `"baseUrl"` in `appsettings.json`. Use `https://mine.qubic.li/` for the pool `app.qubic.li`.
- **Pass:** Not used.
- **Extra config arguments:** Each line is merged into `appsettings.json`.

### Recommended GPU overclocks :
**Medium**
3000 series ```nvtool --setcoreoffset 250 --setclocks 1500 --setmem 5001```
4000 series ```nvtool --setcoreoffset 250 --setclocks 2400 --setmem 5001```
**High**
3000 series ```nvtool --setcoreoffset 200 --setclocks 1600 --setmem 7000 --setmemoffset 2000```
4000 series ```nvtool --setcoreoffset 200 --setclocks 2900 --setmem 7000 --setmemoffset 2000```
<br>


### Extra config arguments Box (options):

| Setting | Description |
| ---- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ```"accessToken":``` | This is you personal JWT Token which you can obtain from the Control Panel at qubic.li |
| ```"payoutId":``` | This is the ID you want to get token payout for your found solutions. |
| ```"hugePages":nnnn``` | Depending on your environment you might want to enable huge pages. This can increase your iterations per second. The trainer will tell you what is the optimal setting when it detects a wrong value. The number depends on the number of threads: nb_threads * 52 (e.g., 16 * 52 = 832). If trainer is unstable please remove. |
| ```"overwrites": {"AVX512": false}``` | Disable AVX512 and enforce AVX2 (AVX Intel CPU not working) |
| ```"overwrites": {"SKYLAKE": true}``` | Enforce SKYLAKE (AVX Intel CPU not working) |
<br>
88 changes: 60 additions & 28 deletions h-config.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,79 @@
# Функция для обработки пользовательской конфигурации
# Function for processing user configuration
process_user_config() {
while IFS= read -r line; do
[[ -z $line ]] && continue
# Check if the line starts with 'nvtool ' and execute it using eval
if [[ ${line:0:7} = "nvtool " ]]; then
eval "$line"
else
Settings=$(jq -s '.[0] * .[1]' <<< "$Settings {$line}")
# Extract parameter and its value from the configuration line
param=$(awk -F':' '{gsub(/\"/, ""); gsub(/[[:space:]]/, ""); print $1}' <<< "$line")
value=$(awk -F':' '{gsub(/\"/, ""); gsub(/[[:space:]]/, ""); print substr($0, length($1) + 2)}' <<< "$line")

# Convert parameter to uppercase
param_high=$(echo "$param" | tr '[:lower:]' '[:upper:]')

# Perform replacements in the parameter
modified_param=$(echo "$param_high" | awk '{
gsub("PAYOUTID", "payoutId");
gsub("AMOUNTOFTHREADS", "amountOfThreads");
gsub("ACCESSTOKEN", "accessToken");
gsub("ALLOWHWINFOCOLLECT", "allowHwInfoCollect");
gsub("HUGEPAGES", "hugePages");
gsub("CPUONLY", "cpuOnly");
gsub("ALIAS", "alias");
gsub("OVERWRITES", "overwrites");
print $0;
}')

# Check if modifications were made, if not, use original parameter
[[ "$param" != "$modified_param" ]] && param=$modified_param

# Check if value exists before updating Settings
if [[ ! -z "$value" ]]; then
if [[ "$param" == "overwrites" ]]; then
Settings=$(jq -s '.[0] * .[1]' <<< "$Settings {$line}")
else
# Update settings with the extracted parameter and its value
if [[ "$value" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
Settings=$(jq --arg param "$param" --argjson value "$value" '.[$param] = ($value | tonumber)' <<< "$Settings")
else
Settings=$(jq --arg param "$param" --arg value "$value" '.[$param] = $value' <<< "$Settings")
fi
fi
fi
fi
done <<< "$CUSTOM_USER_CONFIG"
}

# Основная логика скрипта
# Main script logic

# Обработка глобальных настроек
conf=$(cat "/hive/miners/custom/$CUSTOM_NAME/appsettings_global.json" | envsubst)
Settings=$(jq -r .Settings <<< "$conf")
# Processing global settings
Settings=$(jq -r '.Settings' "/hive/miners/custom/$CUSTOM_NAME/appsettings_global.json" | envsubst)

# Обработка шаблона
# Processing the template
if [[ ! -z $CUSTOM_TEMPLATE ]]; then
if [[ ${#CUSTOM_TEMPLATE} -lt 60 ]]; then
Settings=$(jq --null-input --argjson Settings "$Settings" --arg alias "$CUSTOM_TEMPLATE" '$Settings + {$alias}')
elif [[ ${#CUSTOM_TEMPLATE} -eq 60 ]]; then
Settings=$(jq --null-input --argjson Settings "$Settings" --arg payoutId "$CUSTOM_TEMPLATE" '$Settings + {$payoutId}')
else
wallet=${CUSTOM_TEMPLATE%.*}
len=${#wallet}
alias=${CUSTOM_TEMPLATE:len}
alias=${alias#*.}
Settings=$(jq --null-input --argjson Settings "$Settings" --arg alias "$alias" '$Settings + {$alias}')
if [[ ${#wallet} -eq 60 ]]; then
Settings=$(jq --null-input --argjson Settings "$Settings" --arg payoutId "$wallet" '$Settings + {$payoutId}')
else
Settings=$(jq --null-input --argjson Settings "$Settings" --arg accessToken "$wallet" '$Settings + {$accessToken}')
fi
fi
Settings=$(jq --null-input --argjson Settings "$Settings" --arg alias "$CUSTOM_TEMPLATE" '$Settings + {$alias}')
fi

# Обработка пользовательской конфигурации
# Processing user configuration
[[ ! -z $CUSTOM_USER_CONFIG ]] && process_user_config

# Добавление настроек URL
# Additional check and modification in the Settings for CPU mining
if [[ $(jq '.cpuOnly == "yes" or .amountOfThreads != 0' <<< "$Settings") == true ]]; then
Settings=$(jq '.allowHwInfoCollect = false | del(.overwrites.CUDA)' <<< "$Settings")
fi

# Check and modify Settings for hugePages parameter
if [[ $(jq '.hugePages' <<< "$Settings") != null ]]; then
hugePages=$(jq -r '.hugePages' <<< "$Settings")
if [[ ! -z $hugePages && $hugePages -gt 0 ]]; then
eval "/usr/sbin/sysctl -w vm.nr_hugepages=$hugePages"
fi
fi

# Adding URL settings
[[ ! -z $CUSTOM_URL ]] && Settings=$(jq --null-input --argjson Settings "$Settings" --arg baseUrl "$CUSTOM_URL" '$Settings + {$baseUrl}')

# Формирование конечной конфигурации
conf=$(jq --null-input --argjson Settings "$Settings" '{$Settings}')
echo "$conf" | jq . > "$CUSTOM_CONFIG_FILENAME"
# Forming the final configuration
echo "{\"Settings\":$Settings}" | jq . > "$CUSTOM_CONFIG_FILENAME"
4 changes: 2 additions & 2 deletions h-manifest.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CUSTOM_NAME=qubminer

# Optional version of your custom miner package
MINER_LATEST_VER=1.8.9
CUSTOM_VERSION=1.8.9
MINER_LATEST_VER=1.8.9_1
CUSTOM_VERSION=1.8.9_1

CUSTOM_CONFIG_FILENAME=/hive/miners/custom/$CUSTOM_NAME/appsettings.json

Expand Down
Binary file added img/FlightSheetCPU.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/FlightSheetGPU.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c347acf

Please sign in to comment.