Documentation ¶
Overview ¶
Package v2 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, 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 eth2.
Index ¶
- Variables
- func BackupAccountsCli(cliCtx *cli.Context) error
- func CreateAccount(ctx context.Context, cfg *CreateAccountConfig) error
- func CreateAccountCli(cliCtx *cli.Context) error
- func CreateAndSaveWalletCli(cliCtx *cli.Context) (*wallet.Wallet, error)
- func CreateWalletWithKeymanager(ctx context.Context, cfg *CreateWalletConfig) (*wallet.Wallet, error)
- func DeleteAccount(ctx context.Context, cfg *DeleteAccountConfig) error
- func DeleteAccountCli(cliCtx *cli.Context) error
- func EditWalletConfigurationCli(cliCtx *cli.Context) error
- func ExitAccountsCli(cliCtx *cli.Context, r io.Reader) error
- func ExitAccountsUnimplemented(cliCtx *cli.Context, r io.Reader) error
- func ImportAccounts(ctx context.Context, cfg *ImportAccountsConfig) error
- func ImportAccountsCli(cliCtx *cli.Context) error
- func ListAccountsCli(cliCtx *cli.Context) error
- func RecoverWallet(ctx context.Context, cfg *RecoverWalletConfig) (*wallet.Wallet, error)
- func RecoverWalletCli(cliCtx *cli.Context) error
- func SendDepositCli(cliCtx *cli.Context) error
- type CreateAccountConfig
- type CreateWalletConfig
- type DeleteAccountConfig
- type ImportAccountsConfig
- type RecoverWalletConfig
Constants ¶
This section is empty.
Variables ¶
var AccountCommands = &cli.Command{ Name: "accounts-v2", Category: "accounts", Usage: "defines commands for interacting with eth2 validator accounts (work in progress)", Subcommands: []*cli.Command{ { Name: "create", Description: `creates a new validator account for eth2. If no wallet exists at the given wallet path, creates a new wallet for a user based on specified input, capable of creating a direct, derived, or remote wallet. this command outputs a deposit data string which is required to become a validator in eth2.`, Flags: []cli.Flag{ flags.WalletDirFlag, flags.WalletPasswordFileFlag, flags.AccountPasswordFileFlag, flags.NumAccountsFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, flags.DeprecatedPasswordsDirFlag, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := CreateAccountCli(cliCtx); err != nil { log.Fatalf("Could not create new account: %v", err) } return nil }, }, { Name: "delete", Description: `deletes the selected accounts from a users wallet.`, Flags: []cli.Flag{ flags.WalletDirFlag, flags.WalletPasswordFileFlag, flags.AccountPasswordFileFlag, flags.DeletePublicKeysFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := DeleteAccountCli(cliCtx); err != nil { log.Fatalf("Could not delete account: %v", err) } return nil }, }, { Name: "list", Description: "Lists all validator accounts in a user's wallet directory", Flags: []cli.Flag{ flags.WalletDirFlag, flags.WalletPasswordFileFlag, flags.ShowDepositDataFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, flags.DeprecatedPasswordsDirFlag, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := ListAccountsCli(cliCtx); err != nil { log.Fatalf("Could not list accounts: %v", err) } return nil }, }, { Name: "backup", Description: "backup accounts into EIP-2335 compliant keystore.json files zipped into a backup.zip file " + "at a desired output directory. Accounts to backup can also " + "be specified programmatically via a --backup-for-public-keys flag which specifies a comma-separated " + "list of hex string public keys", Flags: []cli.Flag{ flags.WalletDirFlag, flags.WalletPasswordFileFlag, flags.BackupDirFlag, flags.BackupPublicKeysFlag, flags.BackupPasswordFile, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := BackupAccountsCli(cliCtx); err != nil { log.Fatalf("Could not backup accounts: %v", err) } return nil }, }, { Name: "import", Description: `imports eth2 validator accounts stored in EIP-2335 keystore.json files from an external directory`, Flags: []cli.Flag{ flags.WalletDirFlag, flags.KeysDirFlag, flags.WalletPasswordFileFlag, flags.AccountPasswordFileFlag, flags.ImportPrivateKeyFileFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, flags.DeprecatedPasswordsDirFlag, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := ImportAccountsCli(cliCtx); err != nil { log.Fatalf("Could not import accounts: %v", err) } return nil }, }, { Name: "voluntary-exit", Description: "Performs a voluntary exit on selected accounts", Flags: []cli.Flag{ flags.WalletDirFlag, flags.WalletPasswordFileFlag, flags.AccountPasswordFileFlag, flags.VoluntaryExitPublicKeysFlag, flags.BeaconRPCProviderFlag, cmd.GrpcMaxCallRecvMsgSizeFlag, flags.CertFlag, flags.GrpcHeadersFlag, flags.GrpcRetriesFlag, flags.GrpcRetryDelayFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := ExitAccountsUnimplemented(cliCtx, os.Stdin); err != nil { log.Fatalf("Could not perform voluntary exit: %v", err) } return nil }, }, { Name: "deposit", Description: "Submits a deposit to the eth2 deposit contract for a validator key by connecting " + "to an eth1 endpoint to submit a transaction. Requires signing the transaction with an eth1 private key", Flags: []cli.Flag{ flags.WalletDirFlag, flags.WalletPasswordFileFlag, flags.HTTPWeb3ProviderFlag, flags.Eth1KeystoreUTCPathFlag, flags.Eth1KeystorePasswordFileFlag, flags.Eth1PrivateKeyFileFlag, flags.DepositDelaySecondsFlag, flags.DepositContractAddressFlag, flags.DepositPublicKeysFlag, flags.SkipDepositConfirmationFlag, flags.DepositAllAccountsFlag, }, Action: func(cliCtx *cli.Context) error { featureconfig.ConfigureValidator(cliCtx) if err := SendDepositCli(cliCtx); err != nil { log.Fatalf("Could not send validator deposit(s): %v", err) } return nil }, }, }, }
AccountCommands for accounts-v2 for Prysm validators.
var WalletCommands = &cli.Command{ Name: "wallet-v2", Category: "wallet-v2", Usage: "defines commands for interacting with eth2 validator wallets (work in progress)", Subcommands: []*cli.Command{ { Name: "create", Usage: "creates a new wallet with a desired type of keymanager: " + "either on-disk (direct), derived, or using remote credentials", Flags: []cli.Flag{ flags.WalletDirFlag, flags.KeymanagerKindFlag, flags.GrpcRemoteAddressFlag, flags.RemoteSignerCertPathFlag, flags.RemoteSignerKeyPathFlag, flags.RemoteSignerCACertPathFlag, flags.WalletPasswordFileFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, flags.DeprecatedPasswordsDirFlag, }, Action: func(cliCtx *cli.Context) error { if _, err := CreateAndSaveWalletCli(cliCtx); err != nil { log.Fatalf("Could not create a wallet: %v", err) } return nil }, }, { Name: "edit-config", Usage: "edits a wallet configuration options, such as gRPC connection credentials and TLS certificates", Flags: []cli.Flag{ flags.WalletDirFlag, flags.GrpcRemoteAddressFlag, flags.RemoteSignerCertPathFlag, flags.RemoteSignerKeyPathFlag, flags.RemoteSignerCACertPathFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, flags.DeprecatedPasswordsDirFlag, }, Action: func(cliCtx *cli.Context) error { if err := EditWalletConfigurationCli(cliCtx); err != nil { log.Fatalf("Could not edit wallet configuration: %v", err) } return nil }, }, { Name: "recover", Usage: "uses a derived wallet seed recovery phase to recreate an existing HD wallet", Flags: []cli.Flag{ flags.WalletDirFlag, flags.MnemonicFileFlag, flags.WalletPasswordFileFlag, flags.NumAccountsFlag, featureconfig.AltonaTestnet, featureconfig.OnyxTestnet, flags.DeprecatedPasswordsDirFlag, }, Action: func(cliCtx *cli.Context) error { if err := RecoverWalletCli(cliCtx); err != nil { log.Fatalf("Could not recover wallet: %v", err) } return nil }, }, }, }
WalletCommands for accounts-v2 for Prysm validators.
Functions ¶
func BackupAccountsCli ¶
func BackupAccountsCli(cliCtx *cli.Context) error
BackupAccountsCli 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 eth2 clients.
func CreateAccount ¶
func CreateAccount(ctx context.Context, cfg *CreateAccountConfig) error
CreateAccount creates a new validator account from user input by opening a wallet from the user's specified path.
func CreateAccountCli ¶
func CreateAccountCli(cliCtx *cli.Context) error
CreateAccountCli creates a new validator account from user input by opening a wallet from the user's specified path. This uses the CLI to extract information to perform account creation.
func CreateAndSaveWalletCli ¶
CreateAndSaveWalletCli from user input with a desired keymanager. If a wallet already exists in the path, it suggests the user alternatives such as how to edit their existing wallet configuration.
func CreateWalletWithKeymanager ¶
func CreateWalletWithKeymanager(ctx context.Context, cfg *CreateWalletConfig) (*wallet.Wallet, error)
CreateWalletWithKeymanager specified by configuration options.
func DeleteAccount ¶
func DeleteAccount(ctx context.Context, cfg *DeleteAccountConfig) error
DeleteAccount deletes the accounts that the user requests to be deleted from the wallet.
func DeleteAccountCli ¶
func DeleteAccountCli(cliCtx *cli.Context) error
DeleteAccountCli deletes the accounts that the user requests to be deleted from the wallet. This function uses the CLI to extract necessary values.
func EditWalletConfigurationCli ¶
func EditWalletConfigurationCli(cliCtx *cli.Context) error
EditWalletConfigurationCli for a user's on-disk wallet, being able to change things such as remote gRPC credentials for remote signing, derivation paths for HD wallets, and more.
func ExitAccountsCli ¶
ExitAccountsCli performs a voluntary exit on one or more accounts.
func ExitAccountsUnimplemented ¶
ExitAccountsUnimplemented is a stub for ExitAccounts until the latter is fully implemented.
func ImportAccounts ¶
func ImportAccounts(ctx context.Context, cfg *ImportAccountsConfig) error
ImportAccounts can import external, EIP-2335 compliant keystore.json files as new accounts into the Prysm validator wallet.
func ImportAccountsCli ¶
func ImportAccountsCli(cliCtx *cli.Context) error
ImportAccountsCli 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 ListAccountsCli ¶
func ListAccountsCli(cliCtx *cli.Context) error
ListAccountsCli displays all available validator accounts in a Prysm wallet.
func RecoverWallet ¶
RecoverWallet uses a menmonic seed phrase to recover a wallet into the path provided.
func RecoverWalletCli ¶
func RecoverWalletCli(cliCtx *cli.Context) error
RecoverWalletCli uses a menmonic seed phrase to recover a wallet into the path provided. This uses the CLI to extract necessary values to run the function.
func SendDepositCli ¶
func SendDepositCli(cliCtx *cli.Context) error
SendDepositCli transaction for user specified accounts via an interactive CLI process or via command-line flags.
Types ¶
type CreateAccountConfig ¶
CreateAccountConfig to run the create account function.
type CreateWalletConfig ¶
type CreateWalletConfig struct { WalletCfg *wallet.Config RemoteKeymanagerOpts *remote.KeymanagerOpts SkipMnemonicConfirm bool }
CreateWalletConfig defines the parameters needed to call the create wallet functions.
type DeleteAccountConfig ¶
type DeleteAccountConfig struct { Wallet *wallet.Wallet Keymanager v2keymanager.IKeymanager PublicKeys [][]byte }
DeleteAccountConfig specifies parameters to run the delete account function.
type ImportAccountsConfig ¶
type ImportAccountsConfig struct { Wallet *wallet.Wallet Keystores []*v2keymanager.Keystore AccountPassword string }
ImportAccountsConfig defines values to run the import accounts function.