lighthouse/account_manager
Paul Hauner 6ea3bc5e52 Implement VC API (#1657)
## Issue Addressed

NA

## Proposed Changes

- Implements a HTTP API for the validator client.
- Creates EIP-2335 keystores with an empty `description` field, instead of a missing `description` field. Adds option to set name.
- Be more graceful with setups without any validators (yet)
    - Remove an error log when there are no validators.
    - Create the `validator` dir if it doesn't exist.
- Allow building a `ValidatorDir` without a withdrawal keystore (required for the API method where we only post a voting keystore).
- Add optional `description` field to `validator_definitions.yml`

## TODO

- [x] Signature header, as per https://github.com/sigp/lighthouse/issues/1269#issuecomment-649879855
- [x] Return validator descriptions
- [x] Return deposit data
- [x] Respect the mnemonic offset
- [x] Check that mnemonic can derive returned keys
- [x] Be strict about non-localhost
- [x] Allow graceful start without any validators (+ create validator dir)
- [x] Docs final pass
- [x] Swap to EIP-2335 description field. 
- [x] Fix Zerioze TODO in VC api types.
- [x] Zeroize secp256k1 key

## Endpoints

- [x] `GET /lighthouse/version`
- [x] `GET /lighthouse/health`
- [x] `GET /lighthouse/validators` 
- [x] `POST /lighthouse/validators/hd`
- [x] `POST /lighthouse/validators/keystore`
- [x] `PATCH /lighthouse/validators/:validator_pubkey`
- [ ] ~~`POST /lighthouse/validators/:validator_pubkey/exit/:epoch`~~ Future works


## Additional Info

TBC
2020-10-02 09:42:19 +00:00
..
src Implement VC API (#1657) 2020-10-02 09:42:19 +00:00
Cargo.toml Implement slashing protection interchange format (#1544) 2020-10-02 01:42:27 +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.