diff --git a/book/src/key-management.md b/book/src/key-management.md index 6f7386874a7..06fdf11f142 100644 --- a/book/src/key-management.md +++ b/book/src/key-management.md @@ -40,12 +40,12 @@ keypairs. Creating a single validator looks like this: - `lighthouse account validator create --wallet-name wally --wallet-passphrase wally.pass --count 1` -In step (1), we created a wallet in `~/.lighthouse/wallets` with the name +In step (1), we created a wallet in `~/.lighthouse/{testnet}/wallets` with the name `wally`. We encrypted this using a pre-defined password in the `wally.pass` file. Then, in step (2), we created one new validator in the -`~/.lighthouse/validators` directory using `wally` (unlocking it with +`~/.lighthouse/{testnet}/validators` directory using `wally` (unlocking it with `mywallet.pass`) and storing the passwords to the validators voting key in -`~/.lighthouse/secrets`. +`~/.lighthouse/{testnet}/secrets`. Thanks to the hierarchical key derivation scheme, we can delete all of the aforementioned directories and then regenerate them as long as we remembered @@ -63,14 +63,16 @@ There are three important directories in Lighthouse validator key management: - `wallets/`: contains encrypted wallets which are used for hierarchical key derivation. - - Defaults to `~/.lighthouse/wallets` + - Defaults to `~/.lighthouse/{testnet}/wallets` - `validators/`: contains a directory for each validator containing encrypted keystores and other validator-specific data. - - Defaults to `~/.lighthouse/validators` + - Defaults to `~/.lighthouse/{testnet}/validators` - `secrets/`: since the validator signing keys are "hot", the validator process needs access to the passwords to decrypt the keystores in the validators dir. These passwords are stored here. - - Defaults to `~/.lighthouse/secrets` + - Defaults to `~/.lighthouse/{testnet}/secrets` + +where `testnet` is the name of the testnet passed in the `--testnet` parameter (default is `medalla`). When the validator client boots, it searches the `validators/` for directories containing voting keystores. When it discovers a keystore, it searches the diff --git a/book/src/validator-create.md b/book/src/validator-create.md index 7f856a139d2..0e72196b98c 100644 --- a/book/src/validator-create.md +++ b/book/src/validator-create.md @@ -41,7 +41,7 @@ OPTIONS: The GWEI value of the deposit amount. Defaults to the minimum amount required for an active validator (MAX_EFFECTIVE_BALANCE) --secrets-dir - The path where the validator keystore passwords will be stored. Defaults to ~/.lighthouse/secrets + The path where the validator keystore passwords will be stored. Defaults to ~/.lighthouse/{testnet}/secrets -s, --spec Specifies the default eth2 spec type. [default: mainnet] [possible values: mainnet, minimal, interop] @@ -53,7 +53,7 @@ OPTIONS: Path to directory containing eth2_testnet specs. Defaults to a hard-coded Lighthouse testnet. Only effective if there is no existing database. --validator-dir <VALIDATOR_DIRECTORY> - The path where the validator directories will be created. Defaults to ~/.lighthouse/validators + The path where the validator directories will be created. Defaults to ~/.lighthouse/{testnet}/validators --wallet-name <WALLET_NAME> Use the wallet identified by this name --wallet-passphrase <WALLET_PASSWORD_PATH> @@ -73,10 +73,12 @@ This command will: - Derive a new BLS keypair from `wally`, updating it so that it generates a new key next time. -- Create a new directory in `~/.lighthouse/validators` containing: +- Create a new directory in `~/.lighthouse/{testnet}/validators` containing: - An encrypted keystore containing the validators voting keypair. - An `eth1_deposit_data.rlp` assuming the default deposit amount (`32 ETH` for most testnets and mainnet) which can be submitted to the deposit contract for the medalla testnet. Other testnets can be set via the `--testnet` CLI param. -- Store a password to the validators voting keypair in `~/.lighthouse/secrets`. +- Store a password to the validators voting keypair in `~/.lighthouse/{testnet}/secrets`. + +where `testnet` is the name of the testnet passed in the `--testnet` parameter (default is `medalla`). \ No newline at end of file diff --git a/book/src/validator-management.md b/book/src/validator-management.md index fbb76c9b4e9..df0e7243d0a 100644 --- a/book/src/validator-management.md +++ b/book/src/validator-management.md @@ -16,7 +16,7 @@ useful. ## Introducing the `validator_definitions.yml` file The `validator_definitions.yml` file is located in the `validator-dir`, which -defaults to `~/.lighthouse/validators`. It is a +defaults to `~/.lighthouse/{testnet}/validators`. It is a [YAML](https://en.wikipedia.org/wiki/YAML) encoded file defining exactly which validators the validator client will (and won't) act for. @@ -92,7 +92,7 @@ name identical to the `voting_public_key` value. Lets assume the following directory structure: ``` -~/.lighthouse/validators +~/.lighthouse/{testnet}/validators ├── john │   └── voting-keystore.json ├── sally @@ -135,7 +135,7 @@ In order for the validator client to decrypt the validators, they will need to ensure their `secrets-dir` is organised as below: ``` -~/.lighthouse/secrets +~/.lighthouse/{testnet}/secrets ├── 0xa5566f9ec3c6e1fdf362634ebec9ef7aceb0e460e5079714808388e5d48f4ae1e12897fed1bea951c17fa389d511e477 ├── 0xaa440c566fcf34dedf233baf56cf5fb05bb420d9663b4208272545608c27c13d5b08174518c758ecd814f158f2b4a337 └── 0x87a580d31d7bc69069b55f5a01995a610dd391a26dc9e36e81057a17211983a79266800ab8531f21f1083d7d84085007 diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index eeba0a5f8c8..6b064c424fd 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -91,7 +91,7 @@ fn main() { .short("d") .value_name("DIR") .global(true) - .help("Data directory for lighthouse keys and databases.") + .help("Root data directory for lighthouse keys and databases. Defaults to ~/.lighthouse") .takes_value(true), ) .arg( diff --git a/validator_client/src/cli.rs b/validator_client/src/cli.rs index ed320c24cde..b10ded3c050 100644 --- a/validator_client/src/cli.rs +++ b/validator_client/src/cli.rs @@ -24,7 +24,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { "The directory which contains the password to unlock the validator \ voting keypairs. Each password should be contained in a file where the \ name is the 0x-prefixed hex representation of the validators voting public \ - key. Defaults to ~/.lighthouse/secrets.", + key. Defaults to ~/.lighthouse/{testnet}/secrets.", ) .takes_value(true), ) diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index 146806fd3d3..f11ac63b3fc 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -1,12 +1,11 @@ use clap::ArgMatches; use clap_utils::{parse_optional, parse_path_with_default_in_home_dir}; -use directory::{get_testnet_dir, DEFAULT_SECRET_DIR, DEFAULT_VALIDATOR_DIR}; +use directory::{get_testnet_dir, DEFAULT_ROOT_DIR, DEFAULT_SECRET_DIR, DEFAULT_VALIDATOR_DIR}; use serde_derive::{Deserialize, Serialize}; use std::path::PathBuf; use types::{Graffiti, GRAFFITI_BYTES_LEN}; pub const DEFAULT_HTTP_SERVER: &str = "http://localhost:5052/"; -pub const DEFAULT_DATADIR: &str = ".lighthouse"; /// Path to the slashing protection database within the datadir. pub const SLASHING_PROTECTION_FILENAME: &str = "slashing_protection.sqlite"; @@ -36,10 +35,10 @@ impl Default for Config { /// Build a new configuration from defaults. fn default() -> Self { let data_dir = dirs::home_dir() - .map(|home| home.join(DEFAULT_DATADIR)) + .map(|home| home.join(DEFAULT_ROOT_DIR)) .unwrap_or_else(|| PathBuf::from(".")); let secrets_dir = dirs::home_dir() - .map(|home| home.join(DEFAULT_DATADIR)) + .map(|home| home.join(DEFAULT_ROOT_DIR)) .unwrap_or_else(|| PathBuf::from(".")); Self { data_dir, @@ -62,7 +61,7 @@ impl Config { config.data_dir = parse_path_with_default_in_home_dir( cli_args, "datadir", - PathBuf::from(DEFAULT_DATADIR) + PathBuf::from(DEFAULT_ROOT_DIR) .join(get_testnet_dir(cli_args)) .join(DEFAULT_VALIDATOR_DIR), )?; @@ -70,7 +69,7 @@ impl Config { config.secrets_dir = parse_path_with_default_in_home_dir( cli_args, "secrets-dir", - PathBuf::from(DEFAULT_DATADIR) + PathBuf::from(DEFAULT_ROOT_DIR) .join(get_testnet_dir(cli_args)) .join(DEFAULT_SECRET_DIR), )?;