From aadbab47cc7d04fa61bb0750cda3e21d4c86d527 Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Thu, 15 Oct 2020 00:37:00 +0000 Subject: [PATCH] Doc fixes (#1762) ## Issue Addressed N/A ## Proposed Changes Minor doc fixes. Adds a section on custom data directories. Co-authored-by: Michael Sproul --- book/src/intro.md | 3 +-- book/src/key-management.md | 4 ++-- book/src/key-recovery.md | 6 ++++-- book/src/testnet-validator.md | 20 ++++++++++++++++++++ book/src/validator-create.md | 2 +- book/src/validator-import-launchpad.md | 8 +++++--- book/src/wallet-create.md | 4 ++-- lighthouse/src/main.rs | 6 +++--- 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/book/src/intro.md b/book/src/intro.md index 89c2c049c..f5f8b1b66 100644 --- a/book/src/intro.md +++ b/book/src/intro.md @@ -20,8 +20,7 @@ You may read this book from start to finish, or jump to some of these topics: - Follow the [Installation Guide](./installation.md) to install Lighthouse. - Get hacking with the [Development Environment Guide](./setup.md). - Utilize the whole stack by starting a [local testnet](./local-testnets.md). -- Query the [RESTful HTTP API](./http.md) using `curl`. -- Listen to events with the [JSON WebSocket API](./websockets.md). +- Query the [RESTful HTTP API](./api.md) using `curl`. Prospective contributors can read the [Contributing](./contributing.md) section diff --git a/book/src/key-management.md b/book/src/key-management.md index 1275057d8..05bb0bbfd 100644 --- a/book/src/key-management.md +++ b/book/src/key-management.md @@ -37,9 +37,9 @@ items, starting at one easy-to-backup mnemonic and ending with multiple keypairs. Creating a single validator looks like this: 1. Create a **wallet** and record the **mnemonic**: - - `lighthouse account wallet create --name wally --password-file wally.pass` + - `lighthouse --testnet medalla account wallet create --name wally --password-file wally.pass` 1. Create the voting and withdrawal **keystores** for one validator: - - `lighthouse account validator create --wallet-name wally --wallet-password wally.pass --count 1` + - `lighthouse --testnet medalla account validator create --wallet-name wally --wallet-password wally.pass --count 1` In step (1), we created a wallet in `~/.lighthouse/{testnet}/wallets` with the name diff --git a/book/src/key-recovery.md b/book/src/key-recovery.md index ae7dc677f..ffe915259 100644 --- a/book/src/key-recovery.md +++ b/book/src/key-recovery.md @@ -43,10 +43,12 @@ keystores that correspond to one or more indices in the mnemonic: For each of the indices recovered in the above commands, a directory will be -created in the `--validator-dir` location (default `~/.lighthouse/validator`) +created in the `--validator-dir` location (default `~/.lighthouse/{testnet}/validators`) which contains all the information necessary to run a validator using the `lighthouse vc` command. The password to this new keystore will be placed in -the `--secrets-dir` (default `~/.lighthouse/secrets`). +the `--secrets-dir` (default `~/.lighthouse/{testnet}/secrets`). + +where `testnet` is the name of the testnet passed in the `--testnet` parameter (default is `medalla`). ## Recover a EIP-2386 wallet diff --git a/book/src/testnet-validator.md b/book/src/testnet-validator.md index 59b05f881..3422a0a11 100644 --- a/book/src/testnet-validator.md +++ b/book/src/testnet-validator.md @@ -115,6 +115,9 @@ lighthouse --testnet MY_TESTNET bn --staking lighthouse --testnet MY_TESTNET vc ``` +> Note: `~/.lighthouse/{testnet}` is the default directory which contains the keys and databases. +> To specify a custom dir, see [this](#custom-directories) section + #### Docker users Those using Docker images can start the processes with: @@ -160,3 +163,20 @@ If you see any `ERRO` (error) logs, please reach out on issue](https://github.com/sigp/lighthouse/issues/new). Happy staking! + + +## Custom directories + +Users can override the default Lighthouse data directories (`~/.lighthouse/{testnet}`) using the `--datadir` flag. The custom data directory mirrors the structure of any testnet specific default directory (e.g. `~/.lighthouse/medalla`). + +> Note: Users should specify different custom directories for different testnets. + +Below is an example flow for importing validator keys, running a beacon node and validator client using a custom data directory `/var/lib/my-custom-dir` for the medalla testnet. + +```bash +lighthouse --testnet medalla --datadir /var/lib/my-custom-dir account validator import --directory +lighthouse --testnet medalla --datadir /var/lib/my-custom-dir bn --staking +lighthouse --testnet medalla --datadir /var/lib/my-custom-dir vc +``` +The first step creates a `validators` directory under `/var/lib/my-custom-dir` which contains the imported keys and [`validator_definitions.yml`](./validator-management.md). +After that, we simply run the beacon chain and validator client with the custom dir path. \ No newline at end of file diff --git a/book/src/validator-create.md b/book/src/validator-create.md index 9d73cdf80..b19c42793 100644 --- a/book/src/validator-create.md +++ b/book/src/validator-create.md @@ -71,7 +71,7 @@ lighthouse --testnet medalla account validator create --name wally --wallet-pass This command will: -- Derive a single new BLS keypair from `wally`, updating it so that it generates a +- Derive a single new BLS keypair from wallet `wally` in `~/.lighthouse/{testnet}/wallets`, updating it so that it generates a new key next time. - Create a new directory in `~/.lighthouse/{testnet}/validators` containing: - An encrypted keystore containing the validators voting keypair. diff --git a/book/src/validator-import-launchpad.md b/book/src/validator-import-launchpad.md index b9d444b86..53fed4d75 100644 --- a/book/src/validator-import-launchpad.md +++ b/book/src/validator-import-launchpad.md @@ -25,8 +25,8 @@ website). If this is not the case, simply change the `--directory` to point to the `validator_keys` directory. Now, assuming that the user is in the `eth2-deposit-cli` directory and they're -using the standard `validators` directory (specify a different one using -`--validator-dir` flag), they can follow these steps: +using the default (`~/.lighthouse/{testnet}/validators`) `validators` directory (specify a different one using +`--validators-dir` flag), they can follow these steps: ### 1. Run the `lighthouse account validator import` command. @@ -35,9 +35,11 @@ section, all other users can use: ```bash -lighthouse account validator import --directory validator_keys +lighthouse --testnet medalla account validator import --directory validator_keys ``` +Note: The user must specify the testnet that they are importing the keys for using the `--testnet` flag. + After which they will be prompted for a password for each keystore discovered: diff --git a/book/src/wallet-create.md b/book/src/wallet-create.md index 668b10db8..7e4731914 100644 --- a/book/src/wallet-create.md +++ b/book/src/wallet-create.md @@ -57,11 +57,11 @@ OPTIONS: ## Example -Creates a new wallet named `wally` with a randomly generated password saved +Creates a new wallet named `wally` and saves it in `~/.lighthouse/medalla/wallets` with a randomly generated password saved to `./wallet.pass`: ```bash -lighthouse account wallet create --name wally --password-file wally.pass +lighthouse --testnet medalla account wallet create --name wally --password-file wally.pass ``` > Notes: diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 714209b9c..65ed602fe 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -91,9 +91,9 @@ fn main() { .value_name("DIR") .global(true) .help( - "Root data directory for lighthouse keys and databases. \ - Defaults to $HOME/.lighthouse/{default-testnet}, \ - currently, $HOME/.lighthouse/medalla") + "Used to specify a custom root data directory for lighthouse keys and databases. \ + Defaults to $HOME/.lighthouse/{testnet} where testnet is the value of the `testnet` flag \ + Note: Users should specify separate custom datadirs for different testnets.") .takes_value(true), ) .arg(