# Keys and config

Everything lives in `/etc/sn46`. Each key is in its own file, owned by `sn46`, mode `0600`. No key is ever read from a config file or printed.

## Keys

```sh
sudo sn46-signer --new-key /etc/sn46/signer.key    # prints the public key: signer_public_key
sudo sn46-signer --new-key /etc/sn46/auditor.key   # prints the public key: auditor_public_key
sudo install -o sn46 -g sn46 -m 600 /dev/null /etc/sn46/hotkey.uri
sudoedit /etc/sn46/hotkey.uri                      # the validator hotkey's secret, see below
sudo chown sn46:sn46 /etc/sn46/signer.key /etc/sn46/auditor.key
```

- `signer.key` signs the epoch summaries, and `auditor.key` signs the audit verdicts. Each is a fresh ed25519 seed (64 hex). `sn46-signer --public-key <file>` prints a seed's public key again.
- `hotkey.uri` is your validator hotkey as a secret URI, on one line: either its mnemonic phrase or its seed as `0x` followed by 64 hex. In a btcli wallet these are the `secretPhrase` and `secretSeed` fields of `~/.bittensor/wallets/<wallet>/hotkeys/<hotkey>`. The coldkey is never needed.

## Config files

Write the two deployment files from the examples, readable by `sn46` and not by other users:

```sh
sudo cp /etc/sn46/signer.example.toml /etc/sn46/signer.toml
sudo cp /etc/sn46/audit.example.toml /etc/sn46/audit.toml
sudo chown root:sn46 /etc/sn46/signer.toml /etc/sn46/audit.toml
sudo chmod 640 /etc/sn46/signer.toml /etc/sn46/audit.toml
sudoedit /etc/sn46/signer.toml /etc/sn46/audit.toml
```

`signer.toml` looks like this:

```toml
ledger_url = "<the sn46_validator ledger URL from the SN46 team>"
chain_url = "wss://entrypoint-finney.opentensor.ai:443"
network = "finney"
netuid = 46
burn_uid = 0
units_per_alpha = 1000000000
validator_hotkey = "<ss58 of your validator hotkey>"
signer_public_key = "<what --new-key signer.key printed>"
auditor_public_key = "<what --new-key auditor.key printed>"
key_file = "/etc/sn46/signer.key"
hotkey_uri_file = "/etc/sn46/hotkey.uri"
audit_bin = "/usr/local/bin/sn46-audit"
audit_config = "/etc/sn46/audit.toml"
chain_checks = "strict"
```

Both files have the same fields; `audit.toml` leaves out the last four (`hotkey_uri_file`, `audit_bin`, `audit_config`, `chain_checks`). An unknown field is an error.

| Field                | Value                                                                                                              |
| -------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `ledger_url`         | the ledger URL from the SN46 team: the `sn46_validator` one in `signer.toml`, the `sn46_audit` one in `audit.toml` |
| `chain_url`          | a subtensor node: `wss://entrypoint-finney.opentensor.ai:443`, or your own finney node                             |
| `network`            | `finney` (mainnet)                                                                                                 |
| `netuid`             | `46`                                                                                                               |
| `burn_uid`           | `0`: the UID that receives the weight the burn row gives                                                           |
| `units_per_alpha`    | `1000000000` (ledger units per alpha); keep the example's value unless the SN46 team tells you otherwise           |
| `validator_hotkey`   | your validator hotkey's ss58 address; it must be the hotkey in `hotkey.uri`                                        |
| `signer_public_key`  | what `--new-key signer.key` printed                                                                                |
| `auditor_public_key` | what `--new-key auditor.key` printed                                                                               |
| `key_file`           | `/etc/sn46/signer.key` in `signer.toml`, `/etc/sn46/auditor.key` in `audit.toml`                                   |
| `hotkey_uri_file`    | `/etc/sn46/hotkey.uri`                                                                                             |
| `audit_bin`          | `/usr/local/bin/sn46-audit`: the auditor the signer runs once per epoch                                            |
| `audit_config`       | `/etc/sn46/audit.toml`                                                                                             |
| `chain_checks`       | `strict`: the node's metadata must match what this release was built for. Leave it as it is                        |

Use absolute paths, as above. The ledger URLs, with their host, port and passwords, come from the SN46 team.

Next: [run the validator](https://docs.instantnetwork.ai/validators/run).
