Skip to content

Keygen Command

The keygen command generates RSA keys for SSV operator identification

anchor keygen [OPTIONS]

Options

RSA key generation tool. Outputs key to data directory.

Usage: anchor keygen [OPTIONS]

Options:
    -d, --data-dir <DIR>
               Used to specify a custom root data directory for the Anchor key
               and database. Defaults to $HOME/.anchor/{network} where network
               is the value of the `network` flag Note: Users should specify
               separate custom datadirs for different networks.

         --force
               Force file overwrite

         --network <NETWORK>
               Name of the chain Anchor will validate.
               
               [default: mainnet]
               [possible values: mainnet, holesky, hoodi]

    -t, --testnet-dir <DIR>
               Path to directory containing eth2_testnet specs.

         --encrypt
               Enable password encryption. Password is read from terminal or
               via --password-file

         --password-file <PATH>
               Path to a file containing the password to use for the new key
               file

         --debug-level <DEBUG_LEVEL>
               Specifies the verbosity level used when emitting logs to the
               terminal
               
               [default: INFO]

         --use-existing <PATH>
               Path to an existing key file to use instead of generating a new
               one. If encrypted, the password is read from terminal or via
               --password-file-for-existing. The existing file is NOT
               automatically removed.

         --password-file-for-existing <PATH>
               Path to a file containing the password to use for the EXISTING
               key file

    -h, --help
               Print help

Examples

This will create an unencrypted private_key.txt file containing the newly generated private key and a public_key.txt file with the BASE64 encoded public key used for registering the operator.

anchor keygen

This will create a encrypted_private_key.json file encrypted with the provided password and a public_key.txt file with the BASE64 encoded public key used for registering the operator. The password must be provided via --password-file or interactively when running Anchor.

anchor keygen --encrypt --data-dir /path/to/keys

Anchor will look for the key file in the default directory ~/.anchor/{network}, or the directory specified by --data-dir.