2020-07-14 00:58:06 +00:00
|
|
|
package v2
|
|
|
|
|
|
|
|
import (
|
2020-08-20 17:53:09 +00:00
|
|
|
"os"
|
|
|
|
|
2020-07-24 00:43:01 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
2020-07-14 00:58:06 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/validator/flags"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
// AccountCommands for accounts-v2 for Prysm validators.
|
2020-07-15 04:05:21 +00:00
|
|
|
var AccountCommands = &cli.Command{
|
|
|
|
Name: "accounts-v2",
|
|
|
|
Category: "accounts",
|
|
|
|
Usage: "defines commands for interacting with eth2 validator accounts (work in progress)",
|
|
|
|
Subcommands: []*cli.Command{
|
|
|
|
// AccountCommands for accounts-v2 for Prysm validators.
|
|
|
|
{
|
2020-07-24 02:18:36 +00:00
|
|
|
Name: "create",
|
2020-07-28 19:23:53 +00:00
|
|
|
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
|
2020-07-14 00:58:06 +00:00
|
|
|
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.`,
|
2020-07-15 04:05:21 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
|
|
|
flags.AccountPasswordFileFlag,
|
2020-07-27 14:03:30 +00:00
|
|
|
flags.NumAccountsFlag,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-08-07 00:02:30 +00:00
|
|
|
flags.DeprecatedPasswordsDirFlag,
|
2020-07-15 04:05:21 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-08-06 12:49:41 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-07-24 02:18:36 +00:00
|
|
|
if err := CreateAccount(cliCtx); err != nil {
|
2020-07-23 00:11:00 +00:00
|
|
|
log.Fatalf("Could not create new account: %v", err)
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
2020-08-11 03:54:37 +00:00
|
|
|
{
|
|
|
|
Name: "delete",
|
|
|
|
Description: `deletes the selected accounts from a users wallet.`,
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.WalletPasswordFileFlag,
|
|
|
|
flags.AccountPasswordFileFlag,
|
2020-08-11 23:15:06 +00:00
|
|
|
flags.DeletePublicKeysFlag,
|
2020-08-11 03:54:37 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
|
|
|
featureconfig.OnyxTestnet,
|
|
|
|
},
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
|
|
|
if err := DeleteAccount(cliCtx); err != nil {
|
|
|
|
log.Fatalf("Could not delete account: %v", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2020-07-15 04:05:21 +00:00
|
|
|
{
|
|
|
|
Name: "list",
|
|
|
|
Description: "Lists all validator accounts in a user's wallet directory",
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
2020-07-29 01:20:13 +00:00
|
|
|
flags.WalletPasswordFileFlag,
|
2020-07-15 04:05:21 +00:00
|
|
|
flags.ShowDepositDataFlag,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-08-07 00:02:30 +00:00
|
|
|
flags.DeprecatedPasswordsDirFlag,
|
2020-07-15 04:05:21 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-08-06 12:49:41 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-07-22 02:04:08 +00:00
|
|
|
if err := ListAccounts(cliCtx); err != nil {
|
2020-07-23 00:11:00 +00:00
|
|
|
log.Fatalf("Could not list accounts: %v", err)
|
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-07-15 04:05:21 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
2020-07-23 03:10:23 +00:00
|
|
|
flags.BackupDirFlag,
|
2020-08-11 23:15:06 +00:00
|
|
|
flags.BackupPublicKeysFlag,
|
|
|
|
flags.BackupPasswordFile,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-07-15 04:05:21 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-08-06 12:49:41 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-08-11 23:15:06 +00:00
|
|
|
if err := BackupAccounts(cliCtx); err != nil {
|
|
|
|
log.Fatalf("Could not backup accounts: %v", err)
|
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",
|
2020-08-11 23:15:06 +00:00
|
|
|
Description: `imports eth2 validator accounts stored in EIP-2335 keystore.json files from an external directory`,
|
2020-07-15 04:05:21 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
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,
|
2020-07-24 00:43:01 +00:00
|
|
|
featureconfig.AltonaTestnet,
|
2020-07-31 01:23:37 +00:00
|
|
|
featureconfig.OnyxTestnet,
|
2020-08-07 00:02:30 +00:00
|
|
|
flags.DeprecatedPasswordsDirFlag,
|
2020-07-15 04:05:21 +00:00
|
|
|
},
|
2020-07-22 02:04:08 +00:00
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2020-08-06 12:49:41 +00:00
|
|
|
featureconfig.ConfigureValidator(cliCtx)
|
2020-08-11 23:15:06 +00:00
|
|
|
if err := ImportAccounts(cliCtx); err != nil {
|
2020-07-23 00:11:00 +00:00
|
|
|
log.Fatalf("Could not import accounts: %v", err)
|
2020-07-22 02:04:08 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
2020-08-20 17:53:09 +00:00
|
|
|
{
|
|
|
|
Name: "voluntary-exit",
|
|
|
|
Description: "Performs a voluntary exit on selected accounts",
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
flags.WalletDirFlag,
|
|
|
|
flags.WalletPasswordFileFlag,
|
|
|
|
flags.AccountPasswordFileFlag,
|
|
|
|
flags.VoluntaryExitPublicKeysFlag,
|
|
|
|
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
|
|
|
|
},
|
|
|
|
},
|
2020-07-14 00:58:06 +00:00
|
|
|
},
|
|
|
|
}
|