Validator keys (EIP-2335) #
Test keys only. Do not import keys that hold real value (what is supported).
Importing keystores #
specborn validator keys import --datadir DIR --keystores KEYDIR --password-file FILE
specborn validator keys list --datadir DIR
import reads every keystore*.json file in KEYDIR (the files the staking deposit tools write). For each one it decrypts the keystore in memory with the password from FILE, checks that the password is right, that the secret key is in range and that the keystore's public key is the secret key's, and only then copies the keystore to DIR/validators/keystores/0x<pubkey>.json. Version 4 keystores with scrypt or PBKDF2 and AES-128-CTR are accepted. One password file serves every keystore of one import.
By default the password file is copied to DIR/validators/secrets/0x<pubkey> so that the node can start unattended. With --no-store-password it is not, and you give it at every start: specborn run --validator-keys --validator-password-file FILE (it may be a pipe). Files are written with mode 0600 in directories with mode 0700. Keys and passwords are read from files only; no option takes a key or a password on the command line.
list prints the public keys of the imported keystores without decrypting them. The flags are in the CLI reference.
At every specborn run --validator-keys, the node decrypts every imported keystore before anything else starts. If any keystore fails, every failing file is named and the node does not start (exit 1). Every key must also be in the slashing-protection database (Slashing protection), or the node does not start (exit 1).
Try it with test keys #
The repository contains keystores made for tests, with their password in a plain file. They are public: never use them, or any key whose file is in a repository, for anything real. This imports two of them into a temporary data directory, lists them, creates a slashing-protection database that registers one of them (the root given is an arbitrary test value), and exports it:
d="$(mktemp -d)"
.lake/build/bin/specborn validator keys import --datadir "$d" \
--keystores Tests/vectors/vkeys/deposit-cli/pbkdf2 \
--password-file Tests/vectors/vkeys/deposit-cli/pbkdf2/password.txt
.lake/build/bin/specborn validator keys list --datadir "$d"
.lake/build/bin/specborn validator slashing-protection register --datadir "$d" \
--pubkey 0x996323af7e545fb6363ace53f1538c7ddc3eb0d985b2479da3ee4ace10cbc393b518bf02d1a2ddb2f5bdf09b473933ea \
--genesis-validators-root 0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f
.lake/build/bin/specborn validator slashing-protection export --datadir "$d" --file "$d/interchange.json"
cat "$d/interchange.json"
Expect warnings if the test files are readable by group or others (use chmod 600), two imported lines, the two public keys in the listing, the registration note, and an interchange file with one key and empty histories.
Limits #
From docs/pieces/vkeys.md §16, §26.3:
- Secrets are not wiped from memory (TRUSTED limitation). Lean has no way to zero memory: the password, the derived key and the secret keys stay in freed heap memory until it is reused, and can reach swap or a core dump. Disable core dumps and use encrypted swap or none.
- Not constant-time (TRUSTED limitation). The big-number arithmetic on the secret key does not run in constant time, and every signature is made with the variable-time BLS functions (
Specborn.Crypto.BlsSig.sign), so on shared hardware the timing of signing can leak secret-key bits. - Passwords at rest. A stored password is a plain file (mode 0600): whoever can read the data directory as its owner can decrypt the keys. Use
--no-store-passwordif that is not acceptable. - Resources. A standard scrypt keystore took about 3 to 6 seconds to decrypt on the project's shared machine; keystores are decrypted up to four at a time within a 1 GiB scrypt memory budget (measured peaks about 1.2 to 1.4 GB). Keystores whose parameters would cost more than fixed bounds are refused before any work. These are measurements, not guarantees.
- File permissions are checked with
/usr/bin/stat; keystore and password files readable by others get a warning.
Evidence #
- TESTED: suite
vkeys, 2,331,167 checks, 0 failures (STATUS.md), including the two official ERC-2335 test keystores, 9 keystores made by the staking deposit CLI and by eth2-val-tools, and 49 malformed inputs (docs/pieces/vkeys.md§12, §24). - PROVED: the decryption equals the reference translation of ERC-2335 for every input once the resource bounds pass, and at node start every key accepted is one the reference decryption of its file returns (
Proofs/Validator/Keys/Bounds.lean,Proofs/Validator/Keys/Store.lean;docs/pieces/vkeys.md§14, §26.2). - TRUSTED: that the bytes read are the bytes in the files, and that compiled code behaves as its Lean definition (as everywhere in specborn).