# Options and commands

Source: https://sl0ptiminer.com/wiki/options/

`sloptiminer --help` prints this list.

## Commands

| Command | What it does |
|---|---|
| `sloptiminer mine -a ALGO -o POOL -u WALLET.WORKER [options]` | Mines the algorithm on the pool for your address. |
| `sloptiminer check-config -a ALGO -o POOL -u WALLET.WORKER [options]` | Checks the same arguments as `mine` and prints the same messages, then stops. It connects to nothing and mines nothing. |
| `sloptiminer tune` | Measures this CPU and remembers the best thread count. `mine` does this by itself on the first start. |
| `sloptiminer ui --demo` | Shows the screen with simulated numbers. Nothing is mined or sent. |
| `sloptiminer ui --feed FILE` | Shows the screen of a miner that runs elsewhere on the machine with `--state-file FILE`, for example as a [service](https://sl0ptiminer.com/guides/linux/#watch). `q` closes the view and leaves the miner running. |
| `sloptiminer ha` | Sets up [Home Assistant](https://sl0ptiminer.com/wiki/home-assistant/): asks for the broker and login, tests them and saves them. `ha test` tests the saved setup, `ha off` turns it off. |
| `sloptiminer control status` | Shows whether a local hold is on, and the state of the running miner. |
| `sloptiminer control hold on` / `hold off` | Pauses mining, or lets it mine again, like `p` on the screen. The hold stays after a restart. |
| `sloptiminer control off` | Turns [Home Assistant](https://sl0ptiminer.com/wiki/home-assistant/) off and pauses mining; a running miner also removes the rig from it. |
| `sloptiminer share --show` | Prints the exact data a benchmark share would send, from the last measurement. It sends nothing. |
| `sloptiminer report` | Shows the report of the last [fault](https://sl0ptiminer.com/wiki/fault-report/) and sends it only when you answer yes. `--send` sends without asking. `--link` sends nothing and prints a link for sending it from another device. Exit code 1: asked to send, and nothing was sent. |
| `sloptiminer verify-package --sums SHA256SUMS --sig SHA256SUMS.minisig --file FILE` | Checks a downloaded package against the signed checksum list with the release key inside the miner. Exit code 0: ours and whole. 1: not ours. 2: could not be checked, try again. The updater uses it. |
| `sloptiminer --version` | Prints the version. |
| `sloptiminer --licenses` | Prints the third-party licences. |
| `sloptiminer --help` | Prints the usage text. |

Options given without a command are taken as `mine` options.

## The pool address

`POOL` is `HOST:PORT` or `stratum+tcp://HOST:PORT`. A TLS pool is `stratum+ssl://HOST:PORT`, and `stratum+tls://`, `stratum+tcps://`, `ssl://` and `tls://` work the same way. [Pools and connections](https://sl0ptiminer.com/wiki/pools/#tls) explains TLS.

## Options for mine and check-config

| Option | Meaning | Default |
|---|---|---|
| `-a ALGO` | The algorithm to mine, by its id: [algorithms](https://sl0ptiminer.com/algorithms/) lists them. Also `--algo ALGO`. Saved settings never supply it: every start command names it. | required |
| `-o POOL` | The pool's stratum address, as above. Repeat `-o` for [backup pools](https://sl0ptiminer.com/wiki/pools/#backup): the first is the primary, then up to 9 backups in priority order. | required |
| `-u WALLET.WORKER` | Your address for the coin you mine, then a dot and a worker name. The worker name is optional. One `-u` serves every pool; a backup pool takes its own from a `-u` right after its `-o`. | required |
| `-p PASS` | The pool password. | `x` |
| `-t N` | Hashing threads. A count above what this machine allows is lowered to it, with a note. Not with `--cpu-percent`. | the tuned count |
| `--cpu-percent P` | Use `P` % (1 to 100) of the tuned thread count. Not with `-t`. | off |
| `--cpus LIST` | Linux only. Mines only on these CPUs, numbered as `lscpu` lists them: `64-127` for one socket of a two-socket machine, or `64-127,192-255`. Tuning and the thread count then use that set alone. | every CPU the system lets the miner use |
| `--devices LIST` | `cpu` mines on the processor only, `gpu` on the graphics cards only. | the CPU and every usable graphics card together |
| `--line` | One status row instead of the full screen. For logs and rig managers. | off |
| `--no-banner` | No banner above the screen. The banner stands there only when the start-up intro is off. | off |
| `--no-intro` | No [start-up intro](https://sl0ptiminer.com/wiki/screen/#intro). Any key skips the intro anyway. | off |
| `--state-file PATH` | Rewrites `PATH` every 2 s with the miner's state as one JSON line. Not with `--json-stats`. | off |
| `--json-stats` | Plain JSON counter lines instead of the screen. Not with `--state-file`. | off |
| `--duration S` | Stops after `S` seconds. | runs until stopped |
| `--retune` | Measures this CPU again before mining. | off |
| `--on-overheat ACT` | `pause` or `warn` when the CPU stays above its heat limit. A pause stops CPU mining only and ends by itself 5 °C below the limit. | `warn` on HiveOS and mmpOS, which have their own overheat settings; `pause` elsewhere |
| `--temp-limit C` | Lowers the processor's temperature limit to `C` °C (40 to 110). It can only lower the limit, never raise it. | the processor's own limit |
| `--share-benchmarks` | Sends each 5-minute benchmark result to sl0ptiminer.com once per miner version: the processor's, and one for each graphics card model. Every start says that sharing is on. [What is sent and published](https://sl0ptiminer.com/benchmarks/#user-reports). | off |
| `--no-share-benchmarks` | Never sends a benchmark result, never asks, and keeps the share link out of the log. Wins over `--share-benchmarks`. | off |
| `--update-notices W` | `important` or `all`: which new versions the miner tells you about. [Update notices](https://sl0ptiminer.com/wiki/updates/). | `important`: security, network and fault fixes |
| `--no-update-check` | No news of new versions. The signed file is still fetched once a day, for the [minimum supported version](https://sl0ptiminer.com/wiki/updates/#minimum) and the [30-day contact rule](https://sl0ptiminer.com/wiki/updates/#contact). | off |
| `--verbose` | Accepted, and changes nothing in a released version: its extra lines are for test builds. | off |
| `--tls-insecure` | For a TLS pool with a self-signed certificate: skips the certificate check and prints a warning. Anyone between you and the pool can then pose as the pool. Only with a TLS pool address. | off |

Without `-a` the miner does not start. It stops at once with exit code 2 and says:

```
No algorithm (-a).
Why: The miner does not guess what to mine.
To fix: Add -a hoohash (on HiveOS: Hash algorithm in the flight sheet, or -a hoohash in Extra config arguments).
```

[Troubleshooting](https://sl0ptiminer.com/wiki/troubleshooting/#algorithm) has the other messages about `-a`.

## Home Assistant options

`sloptiminer ha` sets all of this up and saves it: [Home Assistant](https://sl0ptiminer.com/wiki/home-assistant/). These options are for scripts and special setups. On the command line they win over the saved settings and are not saved.

| Option | What it does | Default |
|---|---|---|
| `--mqtt` / `--no-mqtt` | Turns Home Assistant on or off. | off |
| `--mqtt-broker HOST:PORT` | Your MQTT broker. No `mqtts://` and no login here. An IPv6 address goes in brackets. | none |
| `--mqtt-credentials FILE` | Full path of the login file, readable only by you: `{"username": "…", "password": "…"}`. | none |
| `--mqtt-ca FILE` | CA certificate for a self-signed or local broker certificate. With TLS the certificate is always checked. | built-in web roots |
| `--mqtt-name NAME` | The rig's name in Home Assistant, 1 to 64 bytes. Needed when the pool login has no worker name. | the worker name of `-u` |
| `--mqtt-control MODE` | `off`, `pause-only` or `pause-resume`: what Home Assistant may do. | `off` |
| `--mqtt-profiles IDS` | The device choices Home Assistant may switch between, separated by commas, at most 32. | the start-up choice |
| `--mqtt-cpu-max N` | The highest CPU thread count Home Assistant may set. | the start-up thread count |
| `--mqtt-loss-policy MODE` | `pause` or `keep`: what the rig does when the broker is lost. Reconnecting never resumes mining by itself. | `keep` when set up by `sloptiminer ha`, otherwise `pause` (`keep` with `pause-only`) |
| `--mqtt-loss-grace S` | Seconds to wait after losing the broker before the loss policy applies, 0 to 300. | 30 |
| `--mqtt-ha-lease S` | 0, or 90 to 300: the rig pauses when Home Assistant itself has not been heard from for `S` seconds. | 0 (off) |
| `--mqtt-interval S` | Seconds between reports, 5 to 60. | 10 |
| `--mqtt-prefix PREFIX` | Topic prefix of the rig's state. | `sloptiminer` |
| `--mqtt-discovery-prefix PREFIX` | Home Assistant's discovery prefix. | `homeassistant` |
| `--mqtt-ha-status TOPIC` | Home Assistant's status topic. | `homeassistant/status` |

## Examples

Mine with the tuned thread count:

```
./sloptiminer mine -a ALGORITHM -o HOST:PORT -u YOUR_ADDRESS.rig1
```

`ALGORITHM` is the algorithm you mine, for example `hoohash`; [algorithms](https://sl0ptiminer.com/algorithms/) lists them with their address forms.

Mine on a pool's TLS port:

```
./sloptiminer mine -a ALGORITHM -o stratum+ssl://HOST:PORT -u YOUR_ADDRESS.rig1
```

Use three quarters of the tuned threads and print one status row, for a log:

```
./sloptiminer mine -a ALGORITHM -o HOST:PORT -u YOUR_ADDRESS.rig1 --cpu-percent 75 --line
```

Mine with a backup pool:

```
./sloptiminer mine -a ALGORITHM -o HOST:PORT -u YOUR_ADDRESS.rig1 -o BACKUP_HOST:PORT
```

Mine on the graphics cards only, not on the CPU (without `--devices` the miner mines on both):

```
./sloptiminer mine -a ALGORITHM -o HOST:PORT -u YOUR_ADDRESS.rig1 --devices gpu
```

Check a command without mining:

```
./sloptiminer check-config -a ALGORITHM -o HOST:PORT -u YOUR_ADDRESS.rig1 -t 8
```

Write the state to a file that another program reads:

```
./sloptiminer mine -a ALGORITHM -o HOST:PORT -u YOUR_ADDRESS.rig1 --state-file /run/sloptiminer/state.json
```

## Exit codes

| Code | Meaning | A restart helps |
|---|---|---|
| `0` | Stopped normally: `q`, Ctrl-C on the screen, or `--duration` ended. `check-config` found nothing wrong. | not needed |
| `1` | Runtime error (pool, input and output). | maybe |
| `2` | Install or configuration problem: the package, the CPU, an option or the address. For example a wrong CPU for this build, a changed package, an unknown option, a missing algorithm, pool or address, or a pool that refused your address three times in a row. | no |
| `128+N` | Ended by signal `N`: 130 is SIGINT, 143 is SIGTERM. A shell shows these numbers. systemd records the signal instead and counts `systemctl stop` as a clean stop. | not needed |

A pool that cannot be reached does not end the miner: it keeps retrying by itself. A service manager should not restart on exit code 2, because the same files and options will fail the same way. The [Linux guide](https://sl0ptiminer.com/guides/linux/#systemd) shows this for systemd.

## Option mistakes

A wrong option or value stops the miner at once with exit code 2 and three lines: what happened, why, and what to do. An unknown option names the closest valid one:

```
Option --thread is not known.
Why: Sl0ptiminer only accepts the options in sloptiminer --help.
To fix: Did you mean -t? Fix the option (on HiveOS: Extra config arguments).
```

With `--line` the three parts come on one line.

With the default device choice, a GPU failure switches mining to the CPU. Explicit `--devices gpu` stops if no usable GPU remains. Restart to retry a disabled GPU. CPU limits apply to CPU mining, including fallback: `-t N` or `--cpu-percent P` (choose one). GPU feeders may temporarily reduce the active CPU count below that ceiling. There is no GPU limit option.
