Guides / configuration.md

Configuration

All runtime configuration is one typed object, Settings (pydantic-settings). Values resolve in this order of precedence:

CLI flag   >   shell env (CIFRA_*)   >   .env file   >   built-in default

The .env file

cifra auto-loads a .env file from the working directory. Copy the template and edit:

cp .env.example .env
$EDITOR .env

.env is gitignored — it is the correct home for the miner's HuggingFace write token (CIFRA_HF_TOKEN), which deliberately has no CLI flag so it never appears in ps output or shell history. .env.example is safe to commit and documents every key.

You do not need a file — exporting CIFRA_* in the shell works identically. The file is a convenience.

Every setting

Setting Env var CLI flag Default Used by
netuid CIFRA_NETUID --netuid 1 all
subtensor_network CIFRA_SUBTENSOR_NETWORK --network test all
wallet_name CIFRA_WALLET_NAME --wallet.name default miner, validator
wallet_hotkey CIFRA_WALLET_HOTKEY --wallet.hotkey default miner, validator
task_repo CIFRA_TASK_REPO --task "" miner, validator
cache_dir CIFRA_CACHE_DIR ~/.cifra/cache miner, validator
venv_fhe_python CIFRA_VENV_FHE_PYTHON --venv-fhe-python .venv-fhe/bin/python miner, validator
hf_repo CIFRA_HF_REPO "" miner
hf_token CIFRA_HF_TOKEN "" miner (secret)
eval_timeout_s CIFRA_EVAL_TIMEOUT_S 300 validator
n_accuracy_samples CIFRA_N_ACCURACY_SAMPLES 100 validator (TaskSpec usually wins)
accuracy_floor CIFRA_ACCURACY_FLOOR (from TaskSpec) validator
p_error_floor CIFRA_P_ERROR_FLOOR (from TaskSpec) validator
max_complexity CIFRA_MAX_COMPLEXITY (from TaskSpec) validator
log_io CIFRA_LOG_IO false validator

Notes:

  • Env-only settings (no CLI flag) are the majority — including the miner's hf_repo / hf_token and every validator scoring guardrail. Put them in .env.
  • accuracy_floor / p_error_floor / max_complexity default to the values baked into the published TaskSpec. Set them only to override locally; leave unset in normal operation so every validator uses the owner's published rules.
  • venv_fhe_python must point at the concrete-ml venv's python; the miner and validator shell into it for all FHE work. Adjust if your checkout is not at /workspace/fhe-subnet.

The task repo

--task / CIFRA_TASK_REPO is a HuggingFace repo id (e.g. cifranet/cifra-task), not a path. The subnet downloads the three fixed task files from it (taskspec.json, reference.json, calibration.npy) and verifies the sha-256s in the taskspec before use.