lighthouse/account_manager
Paul Hauner 1373dcf076 Add validator-manager (#3502)
## Issue Addressed

Addresses #2557

## Proposed Changes

Adds the `lighthouse validator-manager` command, which provides:

- `lighthouse validator-manager create`
    - Creates a `validators.json` file and a `deposits.json` (same format as https://github.com/ethereum/staking-deposit-cli)
- `lighthouse validator-manager import`
    - Imports validators from a `validators.json` file to the VC via the HTTP API.
- `lighthouse validator-manager move`
    - Moves validators from one VC to the other, utilizing only the VC API.

## Additional Info

In 98bcb947c I've reduced some VC `ERRO` and `CRIT` warnings to `WARN` or `DEBG` for the case where a pubkey is missing from the validator store. These were being triggered when we removed a validator but still had it in caches. It seems to me that `UnknownPubkey` will only happen in the case where we've removed a validator, so downgrading the logs is prudent. All the logs are `DEBG` apart from attestations and blocks which are `WARN`. I thought having *some* logging about this condition might help us down the track.

In 856cd7e37d I've made the VC delete the corresponding password file when it's deleting a keystore. This seemed like nice hygiene. Notably, it'll only delete that password file after it scans the validator definitions and finds that no other validator is also using that password file.
2023-08-08 00:03:22 +00:00
..
src Add validator-manager (#3502) 2023-08-08 00:03:22 +00:00
Cargo.toml Add validator-manager (#3502) 2023-08-08 00:03:22 +00:00
README.md Added deterministic keypair generation. 2019-04-08 15:02:11 +10:00

Lighthouse Account Manager

The account manager (AM) is a stand-alone binary which allows users to generate and manage the cryptographic keys necessary to interact with Ethereum Serenity.

Roles

The AM is responsible for the following tasks:

  • Generation of cryptographic key pairs
    • Must acquire sufficient entropy to ensure keys are generated securely (TBD)
  • Secure storage of private keys
    • Keys must be encrypted while at rest on the disk (TBD)
    • The format is compatible with the validator client
  • Produces messages and transactions necessary to initiate staking on Ethereum 1.x (TPD)

Implementation

The AM is not a service, and does not run continuously, nor does it interact with any running services. It is intended to be executed separately from other Lighthouse binaries and produce files which can be consumed by them.&

Usage

Simply run ./account_manager generate to generate a new random private key, which will be automatically saved to the correct directory.

If you prefer to use our "deterministic" keys for testing purposes, simply run ./accounts_manager generate_deterministic -i <index>, where index is the validator index for the key. This will reliably produce the same key each time and save it to the directory.