2020-10-15 22:31:52 +00:00
|
|
|
package accounts
|
2020-07-14 00:58:06 +00:00
|
|
|
|
|
|
|
import (
|
2022-10-25 03:52:30 +00:00
|
|
|
"os"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/cmd"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/cmd/validator/flags"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/config/features"
|
2021-03-03 17:05:37 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2020-07-14 00:58:06 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
2021-03-03 17:05:37 +00:00
|
|
|
var log = logrus.WithField("prefix", "accounts")
|
|
|
|
|
|
|
|
// Commands for managing Prysm validator accounts.
|
|
|
|
var Commands = &cli.Command{
|
2020-10-15 22:31:52 +00:00
|
|
|
Name: "accounts",
|
2020-07-15 04:05:21 +00:00
|
|
|
Category: "accounts",
|
2024-01-02 18:02:28 +00:00
|
|
|
Usage: "Defines commands for interacting with Ethereum validator accounts.",
|
2020-07-15 04:05:21 +00:00
|
|
|
Subcommands: []*cli.Command{
|
2020-08-11 03:54:37 +00:00
|
|
|
{
|
|
|
|
Name: "delete",
|
|
|
|
Description: `deletes the selected accounts from a users wallet.`,
|
2020-10-11 15:26:59 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-08-11 03:54:37 +00:00
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.WalletPasswordFileFlag,
|
2020-08-11 23:15:06 +00:00
|
|
|
flags.DeletePublicKeysFlag,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2020-10-11 15:26:59 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
2020-10-21 15:13:46 +00:00
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-06-13 15:17:46 +00:00
|
|
|
return features.ConfigureValidator(cliCtx)
|
2020-08-11 03:54:37 +00:00
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2022-05-17 23:13:36 +00:00
|
|
|
if err := accountsDelete(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not delete account")
|
2020-08-11 03:54:37 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2020-07-15 04:05:21 +00:00
|
|
|
{
|
|
|
|
Name: "list",
|
|
|
|
Description: "Lists all validator accounts in a user's wallet directory",
|
2020-10-11 15:26:59 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-07-15 04:05:21 +00:00
|
|
|
flags.WalletDirFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-10-15 16:08:52 +00:00
|
|
|
flags.ShowPrivateKeysFlag,
|
2021-02-26 15:00:05 +00:00
|
|
|
flags.ListValidatorIndices,
|
|
|
|
flags.BeaconRPCProviderFlag,
|
|
|
|
cmd.GrpcMaxCallRecvMsgSizeFlag,
|
|
|
|
flags.CertFlag,
|
|
|
|
flags.GrpcHeadersFlag,
|
|
|
|
flags.GrpcRetriesFlag,
|
|
|
|
flags.GrpcRetryDelayFlag,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2020-10-11 15:26:59 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
2020-10-21 15:13:46 +00:00
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-06-13 15:17:46 +00:00
|
|
|
return features.ConfigureValidator(cliCtx)
|
2020-07-15 04:05:21 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2022-04-28 14:46:46 +00:00
|
|
|
if err := accountsList(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not list accounts")
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
2020-07-15 04:05:21 +00:00
|
|
|
{
|
2020-08-11 23:15:06 +00:00
|
|
|
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",
|
2020-10-11 15:26:59 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-07-15 04:05:21 +00:00
|
|
|
flags.WalletDirFlag,
|
2020-08-31 23:38:20 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-07-23 03:10:23 +00:00
|
|
|
flags.BackupDirFlag,
|
2020-08-11 23:15:06 +00:00
|
|
|
flags.BackupPublicKeysFlag,
|
|
|
|
flags.BackupPasswordFile,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2020-10-11 15:26:59 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
2020-10-21 15:13:46 +00:00
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-06-13 15:17:46 +00:00
|
|
|
return features.ConfigureValidator(cliCtx)
|
2022-06-07 15:19:12 +00:00
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
|
|
|
if err := accountsBackup(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not backup accounts")
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
2020-07-15 04:05:21 +00:00
|
|
|
{
|
|
|
|
Name: "import",
|
2021-06-26 19:00:33 +00:00
|
|
|
Description: `imports Ethereum validator accounts stored in EIP-2335 keystore.json files from an external directory`,
|
2020-10-11 15:26:59 +00:00
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
2020-07-15 04:05:21 +00:00
|
|
|
flags.WalletDirFlag,
|
2020-07-28 14:18:22 +00:00
|
|
|
flags.KeysDirFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-08-02 20:02:04 +00:00
|
|
|
flags.AccountPasswordFileFlag,
|
2020-08-11 16:32:05 +00:00
|
|
|
flags.ImportPrivateKeyFileFlag,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2021-09-15 01:18:39 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-06-15 15:05:44 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2020-10-11 15:26:59 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
2020-10-21 15:13:46 +00:00
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-06-16 14:14:03 +00:00
|
|
|
return features.ConfigureValidator(cliCtx)
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
|
|
|
if err := accountsImport(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not import accounts")
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
2022-10-25 03:52:30 +00:00
|
|
|
{
|
|
|
|
Name: "voluntary-exit",
|
|
|
|
Description: "Performs a voluntary exit on selected accounts",
|
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.WalletPasswordFileFlag,
|
|
|
|
flags.AccountPasswordFileFlag,
|
|
|
|
flags.VoluntaryExitPublicKeysFlag,
|
|
|
|
flags.BeaconRPCProviderFlag,
|
|
|
|
flags.Web3SignerURLFlag,
|
|
|
|
flags.Web3SignerPublicValidatorKeysFlag,
|
|
|
|
flags.InteropNumValidators,
|
|
|
|
flags.InteropStartIndex,
|
|
|
|
cmd.GrpcMaxCallRecvMsgSizeFlag,
|
|
|
|
flags.CertFlag,
|
|
|
|
flags.GrpcHeadersFlag,
|
|
|
|
flags.GrpcRetriesFlag,
|
|
|
|
flags.GrpcRetryDelayFlag,
|
|
|
|
flags.ExitAllFlag,
|
2022-10-27 15:24:41 +00:00
|
|
|
flags.ForceExitFlag,
|
2023-04-17 18:01:13 +00:00
|
|
|
flags.VoluntaryExitJSONOutputPath,
|
2022-10-25 03:52:30 +00:00
|
|
|
features.Mainnet,
|
2023-01-31 01:09:40 +00:00
|
|
|
features.PulseChain,
|
2022-10-25 03:52:30 +00:00
|
|
|
features.PraterTestnet,
|
2023-04-19 18:36:39 +00:00
|
|
|
features.PulseChainTestnetV4,
|
2022-10-25 03:52:30 +00:00
|
|
|
features.SepoliaTestnet,
|
2023-08-29 14:27:50 +00:00
|
|
|
features.HoleskyTestnet,
|
2022-10-25 03:52:30 +00:00
|
|
|
}),
|
|
|
|
Before: func(cliCtx *cli.Context) error {
|
|
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return features.ConfigureValidator(cliCtx)
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2023-01-24 10:05:55 +00:00
|
|
|
log.Info("This command will be deprecated in the future in favor of `prysmctl validator exit`")
|
2023-10-20 16:45:33 +00:00
|
|
|
if err := Exit(cliCtx, os.Stdin); err != nil {
|
2022-10-25 03:52:30 +00:00
|
|
|
log.WithError(err).Fatal("Could not perform voluntary exit")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
|
|
|
}
|