Import key
Running sedge import-key
will import validator keys from a directory following
the EIP-2335: BLS12-381 Keystore standard. This command needs to be run on an already
initialized sedge setup containing a validator client.
Help
To know more about the command options, run sedge import-key --help
:
$ sedge import-key --help
Import validator client keys, use the 'from' flag to specify the keys location,
and make sure that follows the EIP-2335: BLS12-381 Keystore standard. This command
assumes that the validator client container exists, stopped or not.
This command stops the validator client during the importing process due to the
validator database being locked while it's running but leaves the validator client
in the same state in which it was found. That means if the validator is running/stopped
before the import, then the validator will be running/stopped after the command
is executed, regardless of whether the export fails or not. To force a different
behavior use --start-validator and --stop-validator flags.
The [validator] is a required argument used to specify which validator client, from
all supported by Sedge (lighthouse, lodestar, prysm or teku), is used to import the
validator keys. This is necessary because each client has its own way to achieve
the importation.
Usage:
sedge import-key [flags] [validator]
Flags:
--container-tag string Container tag to use. If defined, sedge will add to each container and the network, a suffix with the tag. e.g. sedge-validator-client -> sedge-validator-client-<tag>.
--custom-config string file path or url to use as custom network config.
--custom-deploy-block string custom network deploy block.
--custom-genesis string file path or url to use as custom network genesis.
--from string path to the validator keys, must follow the EIP-2335: BLS12-381 Keystore standard (default "[WORK_DIR]/sedge-data/keystore")
-h, --help help for import-key
-n, --network string network (default "mainnet")
-p, --path string path to the generation directory (default "[WORK_DIR]/sedge-data")
--start-validator starts the validator client after import, regardless of the state the validator was in before
--stop-validator stops the validator client after import, regardless of the state the validator was in before
Global Flags:
--log-level string Set Log Level, e.g panic, fatal, error, warn, warning, info, debug, trace (default "info")
Execution examples
In this example we will import validator keys from a non default directory into a sedge setup with a stopped validator client (Prysm in this case). This is the folder structure:
.
├── keystore
│ ├── deposit_data.json
│ ├── keystore_password.txt
│ └── validator_keys
│ └── keystore-m_12381_3600_0_0_0.json
└── sedge-data
├── docker-compose.yml
├── .env
└── jwtsecret
The keystore
folder contains the validator keys, the sedge-data
folder contains
the sedge setup. The keystore_password.txt
file contains the password to unlock
the validator keys.
To import the validator keys, and start the validator client after the import, run:
$ sedge import-key --from keystore -n sepolia --start-validator prysm
2023-01-26 11:59:34 -- [INFO] [Logger Init] Log level: info
2023-01-26 11:59:34 -- [INFO] You are running the latest version of sedge. Version: v1.7.2
2023-01-26 11:59:34 -- [WARN] The keys path is not the default one, copying the keys to the default path /root/sedge/example/sedge-data/keystore
2023-01-26 11:59:34 -- [INFO] Importing validator keys
2023-01-26 11:59:34 -- [INFO] The keys import container is starting
2023-01-26 11:59:35 -- [INFO] The validator container is being restarted
2023-01-26 11:59:36 -- [INFO] Validator keys imported successfully
Notice the warning message, this is because the --from
flag is not the default
path for the validator keys. Sedge will copy the keys to the default path, and
then import them.
Notice also that the validator client is restarted after the import, this is
because the --start-validator
flag was used.
The resulted folder structure is:
.
├── keystore
│ ├── deposit_data.json
│ ├── keystore_password.txt
│ └── validator_keys
│ └── keystore-m_12381_3600_0_0_0.json
└── sedge-data
├── docker-compose.yml
├── .env
├── jwtsecret
├── keystore/
└── validator-data/
If you have to import your keys to nimbus, you will need to manually type the password when loading the keys, since the nimbus client does not support non interactive password loading.
Importing keys on Nimbus is done using the consensus client container instead of the validator client container.
Notice the new folder keystore
inside the sedge-data
folder, this is where
the validator keys are copied to. Also notice the new folder validator-data
,
this is where the validator client stores its data.