# Install the miner CLI

`sn46-miner` is the CLI you run on your own machine. It registers your proxy, checks its status and keeps it up to date. The current release is **v0.1.1**.

## Install

```sh
curl -fsSL https://raw.githubusercontent.com/Subnet46/v2-sn46-miner-proxy/dev/install.sh | sh
```

This puts `sn46-miner` in `~/.local/bin`, and the proxy's `compose.yml` in `~/.local/share/sn46/`. It runs on Linux, x86_64 or aarch64, and checks the download against the release's `SHA256SUMS`.

- **Install for all users:** add `| sh -s -- --system` to install into `/usr/local/bin`, with sudo.
- **Pick a release:** set `SN46_VERSION`, for example `curl -fsSL ... | SN46_VERSION=v0.1.1 sh`. The default is the latest release.
- **Upgrade:** run the same command again. It replaces what changed and says what it did.

Check that it works:

```sh
sn46-miner
```

With no arguments, `sn46-miner` prints every command, its flags and the defaults.

## What it talks to

`sn46-miner` talks to the SN46 control plane at `https://control.instantnetwork.ai` (SN46 on mainnet, netuid 46). It checks proxy releases against the SN46 fleet root, whose public key is built in:

```text
2b9ddb2b5b3627edb3eda35d18c7296c1170be1d88af001c576f30c88e412e32
```

`--control <url>` and `--root <hex>` override these, for testing only.

## Other tools you need

- **The Phala CLI**, through Node.js 18+: `npx phala@1.2.8`. For [auto-update](https://docs.instantnetwork.ai/miners/auto-update), install it globally instead: `npm install -g phala@1.2.8`.
- **`btcli`**, to create a wallet and register a hotkey on SN46.

## Build from source

You need Rust 1.98 or later:

```sh
git clone https://github.com/Subnet46/v2-sn46-miner-proxy && cd v2-sn46-miner-proxy
# the libraries are pinned by ssh URL; without GitHub ssh keys, read them over https:
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=url.https://github.com/.insteadOf \
  GIT_CONFIG_VALUE_0=ssh://git@github.com/
cargo build --release --locked -p sn46-miner    # target/release/sn46-miner
```

Next: [deploy your proxy on Phala](https://docs.instantnetwork.ai/miners/deploy).
