lighthouse/account_manager
Michael Sproul 1d278aaa83 Implement slashing protection interchange format (#1544)
## Issue Addressed

Implements support for importing and exporting the slashing protection DB interchange format described here:

https://hackmd.io/@sproul/Bk0Y0qdGD

Also closes #1584 

## Proposed Changes

* [x] Support for serializing and deserializing the format
* [x] Support for importing and exporting Lighthouse's database
* [x] CLI commands to invoke import and export
* [x] Export to minimal format (required when a minimal format has been previously imported)
* [x] Tests for export to minimal (utilising mixed importing and attestation signing?)
* [x] Tests for import/export of complete format, and import of minimal format
* [x] ~~Prevent attestations with sources less than our max source (Danny's suggestion). Required for the fake attestation that we put in for the minimal format to block attestations from source 0.~~
* [x] Add the concept of a "low watermark" for compatibility with the minimal format

Bonus!

* [x] A fix to a potentially nasty bug involving validators getting re-registered each time the validator client ran! Thankfully, the ordering of keys meant that the validator IDs used for attestations and blocks remained stable -- otherwise we could have had some slashings on our hands! 😱
* [x] Tests to confirm that this bug is indeed vanquished
2020-10-02 01:42:27 +00:00
..
src Implement slashing protection interchange format (#1544) 2020-10-02 01:42:27 +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.