Documentation ¶
Overview ¶
Package accounts defines a new model for accounts management in Prysm, using best practices for user security, UX, and extensibility via different wallet types including HD wallets, imported (non-HD) wallets, and remote-signing capable configurations. This model is compliant with the EIP-2333, EIP-2334, and EIP-2335 standards for key management in Ethereum.
Index ¶
- Constants
- Variables
- func CreateLocalKeymanagerWallet(_ context.Context, wallet *wallet.Wallet) error
- func DeleteAccount(ctx context.Context, cfg *DeleteConfig) error
- func FilterExitAccountsFromUserInput(cliCtx *cli.Context, r io.Reader, ...) (rawPubKeys [][]byte, formattedPubKeys []string, err error)
- func FilterPublicKeysFromUserInput(cliCtx *cli.Context, publicKeysFlag *cli.StringFlag, ...) ([]bls.PublicKey, error)
- func ImportAccounts(ctx context.Context, cfg *ImportAccountsConfig) ([]*ethpbservice.ImportedKeystoreStatus, error)
- func PerformVoluntaryExit(ctx context.Context, cfg PerformExitCfg) (rawExitedKeys [][]byte, formattedExitedKeys []string, err error)
- func ValidateMnemonic(mnemonic string) error
- type AccountsCLIManager
- func (acm *AccountsCLIManager) Backup(ctx context.Context) error
- func (acm *AccountsCLIManager) Delete(ctx context.Context) error
- func (acm *AccountsCLIManager) Exit(ctx context.Context) error
- func (acm *AccountsCLIManager) Import(ctx context.Context) error
- func (acm *AccountsCLIManager) List(ctx context.Context) error
- func (acm *AccountsCLIManager) WalletCreate(ctx context.Context) (*wallet.Wallet, error)
- func (acm *AccountsCLIManager) WalletRecover(ctx context.Context) (*wallet.Wallet, error)
- type DeleteConfig
- type ImportAccountsConfig
- type Option
- func WithBackupsDir(backupsDir string) Option
- func WithBackupsPassword(backupsPassword string) Option
- func WithBeaconRESTApiProvider(beaconApiEndpoint string) Option
- func WithBeaconRPCProvider(provider string) Option
- func WithDeletePublicKeys(deletePublicKeys bool) Option
- func WithExitJSONOutputPath(outputPath string) Option
- func WithFilteredPubKeys(filteredPubKeys []bls.PublicKey) Option
- func WithFormattedPubKeys(formattedPubKeys []string) Option
- func WithGRPCDialOpts(opts []grpc.DialOption) Option
- func WithGRPCHeaders(headers []string) Option
- func WithImportPrivateKeys(importPrivateKeys bool) Option
- func WithKeymanager(km keymanager.IKeymanager) Option
- func WithKeymanagerType(k keymanager.Kind) Option
- func WithKeysDir(keysDir string) Option
- func WithListValidatorIndices() Option
- func WithMnemonic(mnemonic string) Option
- func WithMnemonic25thWord(mnemonic25thWord string) Option
- func WithMnemonicLanguage(mnemonicLanguage string) Option
- func WithNumAccounts(numAccounts int) Option
- func WithPasswordFilePath(passwordFilePath string) Option
- func WithPrivateKeyFile(privateKeyFile string) Option
- func WithRawPubKeys(rawPubKeys [][]byte) Option
- func WithReadPasswordFile(readPasswordFile bool) Option
- func WithShowDepositData() Option
- func WithShowPrivateKeys() Option
- func WithSkipMnemonicConfirm(s bool) Option
- func WithWallet(wallet *wallet.Wallet) Option
- func WithWalletDir(walletDir string) Option
- func WithWalletKeyCount(walletKeyCount int) Option
- func WithWalletPassword(walletPassword string) Option
- type PerformExitCfg
Constants ¶
const (
// ArchiveFilename specifies the name of the backup. Exported for tests.
ArchiveFilename = "backup.zip"
)
const ExitPassphrase = "Exit my validator"
ExitPassphrase exported for use in test.
Variables ¶
var ( ErrIncorrectWordNumber = errors.New("incorrect number of words provided") ErrEmptyMnemonic = errors.New("phrase cannot be empty") )
var (
// ErrCouldNotInitializeKeymanager informs about failed keymanager initialization
ErrCouldNotInitializeKeymanager = "could not initialize keymanager"
)
Functions ¶
func DeleteAccount ¶
func DeleteAccount(ctx context.Context, cfg *DeleteConfig) error
DeleteAccount performs the deletion on the Keymanager.
func FilterExitAccountsFromUserInput ¶
func FilterExitAccountsFromUserInput( cliCtx *cli.Context, r io.Reader, validatingPublicKeys [][fieldparams.BLSPubkeyLength]byte, forceExit bool, ) (rawPubKeys [][]byte, formattedPubKeys []string, err error)
FilterExitAccountsFromUserInput selects which accounts to exit from the CLI.
func FilterPublicKeysFromUserInput ¶
func FilterPublicKeysFromUserInput( cliCtx *cli.Context, publicKeysFlag *cli.StringFlag, validatingPublicKeys [][fieldparams.BLSPubkeyLength]byte, selectionPrompt string, ) ([]bls.PublicKey, error)
FilterPublicKeysFromUserInput collects the set of public keys from the command line or an interactive session.
func ImportAccounts ¶
func ImportAccounts(ctx context.Context, cfg *ImportAccountsConfig) ([]*ethpbservice.ImportedKeystoreStatus, error)
ImportAccounts can import external, EIP-2335 compliant keystore.json files as new accounts into the Prysm validator wallet.
func PerformVoluntaryExit ¶
func PerformVoluntaryExit( ctx context.Context, cfg PerformExitCfg, ) (rawExitedKeys [][]byte, formattedExitedKeys []string, err error)
PerformVoluntaryExit uses gRPC clients to submit a voluntary exit message to a beacon node.
func ValidateMnemonic ¶
ValidateMnemonic ensures that it is not empty and that the count of the words are as specified(currently 24).
Types ¶
type AccountsCLIManager ¶
type AccountsCLIManager struct {
// contains filtered or unexported fields
}
AccountsCLIManager defines a struct capable of performing various validator wallet & account operations via the command line.
func NewCLIManager ¶
func NewCLIManager(opts ...Option) (*AccountsCLIManager, error)
NewCLIManager allows for managing validator accounts via CLI commands.
func (*AccountsCLIManager) Backup ¶
func (acm *AccountsCLIManager) Backup(ctx context.Context) error
Backup allows users to select validator accounts from their wallet and export them as a backup.zip file containing the keys as EIP-2335 compliant keystore.json files, which are compatible with importing in other Ethereum consensus clients.
func (*AccountsCLIManager) Delete ¶
func (acm *AccountsCLIManager) Delete(ctx context.Context) error
Delete the accounts that the user requests to be deleted from the wallet.
func (*AccountsCLIManager) Exit ¶
func (acm *AccountsCLIManager) Exit(ctx context.Context) error
Exit performs a voluntary exit on one or more accounts.
func (*AccountsCLIManager) Import ¶
func (acm *AccountsCLIManager) Import(ctx context.Context) error
Import can import external, EIP-2335 compliant keystore.json files as new accounts into the Prysm validator wallet. This uses the CLI to extract values necessary to run the function.
func (*AccountsCLIManager) List ¶
func (acm *AccountsCLIManager) List(ctx context.Context) error
List pretty-prints accounts in the wallet.
func (*AccountsCLIManager) WalletCreate ¶
WalletCreate creates wallet specified by configuration options.
func (*AccountsCLIManager) WalletRecover ¶
WalletRecover uses a menmonic seed phrase to recover a wallet into the path provided.
type DeleteConfig ¶
type DeleteConfig struct { Keymanager keymanager.IKeymanager DeletePublicKeys [][]byte }
DeleteConfig specifies parameters for the accounts delete command.
type ImportAccountsConfig ¶
type ImportAccountsConfig struct { Keystores []*keymanager.Keystore Importer keymanager.Importer AccountPassword string }
ImportAccountsConfig defines values to run the import accounts function.
type Option ¶
type Option func(acc *AccountsCLIManager) error
Option type for configuring the accounts cli manager.
func WithBackupsDir ¶
WithBackupsDir specifies the directory backups are written to.
func WithBackupsPassword ¶
WithBackupsPassword specifies the password for backups.
func WithBeaconRESTApiProvider ¶
WithBeaconRESTApiProvider provides a beacon node REST API endpoint to the accounts cli manager.
func WithBeaconRPCProvider ¶
WithBeaconRPCProvider provides a beacon node endpoint to the accounts cli manager.
func WithDeletePublicKeys ¶
WithDeletePublicKeys indicates whether to delete the public keys.
func WithExitJSONOutputPath ¶
func WithFilteredPubKeys ¶
WithFilteredPubKeys adds public key strings parsed from CLI.
func WithFormattedPubKeys ¶
WithFormattedPubKeys adds formatted public key strings parsed from CLI.
func WithGRPCDialOpts ¶
func WithGRPCDialOpts(opts []grpc.DialOption) Option
WithGRPCDialOpts adds grpc opts needed to connect to beacon nodes in the accounts cli manager.
func WithGRPCHeaders ¶
WithGRPCHeaders adds grpc headers used when connecting to beacon nodes in the accounts cli manager.
func WithImportPrivateKeys ¶
WithImportPrivateKeys indicates whether to import private keys as accounts.
func WithKeymanager ¶
func WithKeymanager(km keymanager.IKeymanager) Option
WithKeymanager provides a keymanager to the accounts cli manager.
func WithKeymanagerType ¶
func WithKeymanagerType(k keymanager.Kind) Option
WithKeymanagerType provides a keymanager to the accounts cli manager.
func WithKeysDir ¶
WithKeysDir specifies the directory keys are read from.
func WithListValidatorIndices ¶
func WithListValidatorIndices() Option
WithListValidatorIndices enables displaying validator indices in the accounts cli manager.
func WithMnemonic ¶
WithMnemonic specifies the password for backups.
func WithMnemonic25thWord ¶
WithMnemonic25thWord specifies the password for backups.
func WithMnemonicLanguage ¶
WithMnemonicLanguage specifies the language used for the mnemonic passphrase.
func WithNumAccounts ¶
WithNumAccounts specifies the number of accounts.
func WithPasswordFilePath ¶
WithPasswordFilePath specifies where the password is stored.
func WithPrivateKeyFile ¶
WithPrivateKeyFile specifies the private key path.
func WithRawPubKeys ¶
WithRawPubKeys adds raw public key bytes parsed from CLI.
func WithReadPasswordFile ¶
WithReadPasswordFile indicates whether to read the password from a file.
func WithShowDepositData ¶
func WithShowDepositData() Option
WithShowDepositData enables displaying deposit data in the accounts cli manager.
func WithShowPrivateKeys ¶
func WithShowPrivateKeys() Option
WithShowPrivateKeys enables displaying private keys in the accounts cli manager.
func WithSkipMnemonicConfirm ¶
WithSkipMnemonicConfirm indicates whether to skip the mnemonic confirmation.
func WithWallet ¶
WithWallet provides a wallet to the accounts cli manager.
func WithWalletDir ¶
WithWalletDir specifies the password for backups.
func WithWalletKeyCount ¶
WithWalletKeyCount tracks the number of keys in a wallet.
func WithWalletPassword ¶
WithWalletPassword specifies the password for backups.
type PerformExitCfg ¶
type PerformExitCfg struct { ValidatorClient iface.ValidatorClient NodeClient iface.NodeClient Keymanager keymanager.IKeymanager RawPubKeys [][]byte FormattedPubKeys []string OutputDirectory string }
PerformExitCfg for account voluntary exits.