RHASH-CPU LINUX 1.09 - INSTALL NOTES  (draft for the final INSTALL.txt)
==========================================================================================

QUICK INSTALL (Ubuntu / Debian, fresh server or update)
------------------------------------------------------------------------------------------
Put rhash-cpu-linux-<version>.tar.gz in /home/molly, then:

    cd /home/molly
    tar xzf rhash-cpu-linux-<version>.tar.gz
    cd rhash-cpu
    ./scripts/setup-ubuntu.sh

setup-ubuntu.sh installs the build tools (asks for sudo), builds an optimized binary for this CPU,
reserves huge pages and loads the msr module. It is safe to run again.

Already have the build tools and just want to rebuild (for example after an update)?

    cd /home/molly && tar xzf rhash-cpu-linux-<version>.tar.gz
    cd rhash-cpu && cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc)

Check it:   /home/molly/rhash-cpu/build/rhash-cpu --version

NOTE: extracting the tarball overwrites rhash-cpu/scripts/. Extract first, then put any newer
scripts in place. It does NOT touch pools.json or build/.

Build dependencies (users hit this on a fresh server, 2026-11-25):
  - OpenSSL dev package is REQUIRED (TLS pool support). Without it cmake fails with
    "Could NOT find OpenSSL ... missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR".
      Debian/Ubuntu:  sudo apt install -y build-essential cmake libssl-dev
      Fedora/RHEL:    sudo dnf install -y gcc-c++ cmake openssl-devel
      Arch:           sudo pacman -S base-devel cmake openssl
  - If a build fails halfway, delete build/ and re-run cmake (rm -rf build).
  - If the rhash-cpu folder was once created by root, tar fails with "Cannot utime". Fix:
      sudo chown -R molly:molly /home/molly/rhash-cpu

RUNNING
------------------------------------------------------------------------------------------
  cd /home/molly/rhash-cpu/build
  sudo ./rhash-cpu --menu -a rx/0 -o POOL:PORT -u WALLET -p PASSWORD

  (A path that starts with / needs no "./" in front.  Optional shortcut so you can run it from
   the main folder:  ln -sf /home/molly/rhash-cpu/build/rhash-cpu /home/molly/rhash-cpu/rhash-cpu )

  - Run as root (sudo) for huge pages and the MSR mod; speeds are lower without them.
  - RandomX wants 1GB huge pages if available; don't also reserve 2MB pages (can swap).
  - Screens: default on a terminal = --menu (simple fixed screen); plain ./rhash-cpu mines the last pool used.
    --dashboard = full screen, --nomenu = plain logs (also used when piped or with -v).
  - Long runs: use screen (screen -S mine ... Ctrl+A then D, screen -r mine), or the systemd
    unit in scripts/rhash-cpu.service. Remember "sudo screen" sessions belong to root.

ALGORITHMS (-a)
------------------------------------------------------------------------------------------
  rx/0, rx/2            RandomX
  verus                 VerusHash 2.2
  ghostrider            GhostRider (miner auto-tunes CN lanes per thread; override --gr-ways N
                        or --gr-ways D,DL,F,L,T,TL = dark, darklite, fast, lite, turtle, turtlelite,
                        each 1, 2, 4 or 8)
  yespower family       yespower, yespowerr16, yespower-sugar, yespowerurx, yespowerltncg,
                        yespowertide, cpupower, yescrypt, yescryptr8, yescryptr16, yescryptr32
                        (see --help for the full list; custom: --yespower-n/-r/--yespower-pers)

SPEED AND CPU CONTROLS
------------------------------------------------------------------------------------------
  -t N                  worker threads (default auto by L3 cache)
  --cpu-limit N         each thread hashes only N% of the time, 10..100 (-t 1 --cpu-limit 75)
  --cpu-priority N      nice 0..19 to stay out of the way
  The same two settings are in the menu: O = Options -> "CPU limit per thread", "Worker threads"
  (type a number, or arrows; thread changes restart the miner).
  NEITHER is saved. Every start runs all threads at 100% unless -t / --cpu-limit is given on the command
  line. Changes made in the menu last until the miner is stopped (kept across pool switches and
  thread-count restarts). An old pools.json that still holds these values is ignored.

MENU (--menu) AND DASHBOARD (--dashboard) KEYS
------------------------------------------------------------------------------------------
  S save the current pool (asks for a name)     P pool list: E edit, N new, D delete (also Recent; shows newest 4), Enter switch
  O options; inside it F = Dev Fee screen: enter/remove a license key (K / R), raise the fee level (<- ->)
  O options                                     H hold / continue mining      Q quit
  Options: rotate pools every N MINUTES, saved pools as backups, failed tries before switching,
  return-to-main delay, CPU temperature limit, CPU limit per thread, worker threads.
  Plain-log mode keys: h hashrate per thread, p pause, r resume, s shares.

POOL LIST FILE
------------------------------------------------------------------------------------------
  <rhash-cpu folder>/pools.json (next to build/); override with RHASH_POOLS=/path/file.
  Holds pool logins and all Options (mode 0600). The old ~/.config/rhash-cpu/pools.json is still read.
  Several miners using the same wallet: give each its own name with --rig-id NAME so the pool can
  tell them apart (some pools mix up difficulty or drop connections when names match).

DEV FEE
------------------------------------------------------------------------------------------
  There is a built-in 0.5% dev fee.

UPDATING MANY SERVERS (serv-01 only)
------------------------------------------------------------------------------------------
  /home/molly/scripts/update_RussNet_Rhash-cpu_miners.sh   install the newest tarball in /home/molly
                                                           everywhere and copy serv-01's pools.json
  /home/molly/scripts/sync_RussNet_pools.sh                copy only pools.json to everyone
  Running miners are not restarted; restart them to use the new version.

TEST SCRIPTS (node4 only, in /home/molly/rhash-cpu/)
------------------------------------------------------------------------------------------
  sudo ./randomxtest [hashvault|etica|xdag|all]   xmrig vs rhash-cpu, 2 min each
  sudo ./ghostridertest                           xmrig vs rhash-cpu
  sudo ./yespowertest, ./verushashtest            SRBMiner vs rhash-cpu
  sudo ./zpooltest [name|all]                     every supported zpool yespower coin
  sudo ./alltest                                  all of the above except zpooltest
  Older tools in scripts/: rxrotate.sh, rxsuite.sh, pooltest.sh. Logs: /home/molly/rhash-cpu/testlogs/

LICENSE KEYS (Linux 1.09)
------------------------------------------------------------------------------------------
A license key turns the dev fee off. Enter it in the menu (O, then F, then Enter) or on the command line:
    /home/molly/rhash-cpu/build/rhash-cpu --key RHX1-xxxxxx-...        (checks, saves, exits)
    /home/molly/rhash-cpu/build/rhash-cpu --key-status                 (0 valid, 1 invalid, 2 none)
    /home/molly/rhash-cpu/build/rhash-cpu --remove-key
The key is saved as license.key next to pools.json (extracting a tarball does not touch it). One key works on any
number of PCs. Keys are checked offline; only the author's private key can make them (rhash-keygen, author only).
