# Install the validator

The validator is two programs: `sn46-signer`, which closes, audits, submits and settles every epoch, and `sn46-audit`, the independent auditor the signer runs once per epoch. The current release is **v0.1.7**.

## What you need

- **A hotkey with a validator permit on SN46.** The hotkey must be registered on netuid 46 and hold a validator permit (enough stake to be among the subnet's permitted validators). The signer checks this when it starts and refuses to run otherwise, before it writes anything to the chain.
- **A host.** Linux on x86_64 or aarch64 with systemd and glibc 2.35 or newer (Ubuntu 22.04 and 24.04 are tested), with outbound access to a subtensor node and to the ledger. It serves nothing: no port needs to be open.
- **A second host for the watchdog** (recommended): see [run](https://docs.instantnetwork.ai/validators/run).
- **Access to the SN46 ledger, from the SN46 team.** The settlements a validator pays for live in the SN46 ledger, a Postgres database run by the SN46 team. You get two connection URLs from the team, one for `sn46-signer` and one for `sn46-audit`, each with its own Postgres role. Use them only over the private link set up with you, never across the open internet: this release connects to Postgres without TLS.

## Install

```sh
curl -fsSL https://raw.githubusercontent.com/Subnet46/v2-sn46-validator/dev/install.sh | sh -s -- --system
```

The installer downloads the latest release and checks it against the release's `SHA256SUMS`. With `--system` (using sudo) it:

- installs `sn46-signer` and `sn46-audit` in `/usr/local/bin`;
- creates the `sn46` system user the services run as (no login, no home);
- creates `/etc/sn46` as `root:sn46`, mode `0750`, with `signer.example.toml` and `audit.example.toml` in it;
- installs the units `sn46-signer.service` and `sn46-watchdog.service` in `/etc/systemd/system`.

It never enables or starts a unit, and never writes a real config or key. Running it again is safe: it changes only what differs and says so.

To install a given release, set `SN46_VERSION`:

```sh
curl -fsSL https://raw.githubusercontent.com/Subnet46/v2-sn46-validator/dev/install.sh | SN46_VERSION=v0.1.7 sh -s -- --system
```

Check what is installed:

```sh
sn46-signer --version
```

## Build from source

You need Rust 1.98 or later:

```sh
git clone https://github.com/Subnet46/v2-sn46-validator && cd v2-sn46-validator
# 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-signer -p sn46-audit   # target/release/
```

Next: [keys and config](https://docs.instantnetwork.ai/validators/configure).
