mirror of
https://github.com/wealdtech/ethdo.git
synced 2026-01-07 21:24:01 -05:00
Update flags
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
Development:
|
||||
- use go-eth2-client for beacon node communications
|
||||
- deprecated "--basedir" in favor of "--base-dir"
|
||||
- deprecated "--storepassphrase" in favor of "--store-passphrase"
|
||||
- deprecated "--walletpassphrsae" in favor of "--wallet-passphrsae"
|
||||
- renamed "--exportpassphrase" and "--importpassphrase" flags to "--passphrase"
|
||||
- reworked internal structure of account-related commands
|
||||
- reject weak passphrases by default
|
||||
|
||||
30
cmd/root.go
30
cmd/root.go
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/wealdtech/ethdo/util"
|
||||
e2types "github.com/wealdtech/go-eth2-types/v2"
|
||||
e2wallet "github.com/wealdtech/go-eth2-wallet"
|
||||
dirk "github.com/wealdtech/go-eth2-wallet-dirk"
|
||||
@@ -103,7 +104,7 @@ func persistentPreRun(cmd *cobra.Command, args []string) {
|
||||
// Set up our wallet store
|
||||
switch rootStore {
|
||||
case "s3":
|
||||
assert(viper.GetString("base-dir") == "", "--basedir does not apply for the s3 store")
|
||||
assert(util.GetBaseDir() == "", "--base-dir does not apply for the s3 store")
|
||||
var err error
|
||||
store, err = s3.New(s3.WithPassphrase([]byte(getStorePassphrase())))
|
||||
errCheck(err, "Failed to access Amazon S3 wallet store")
|
||||
@@ -112,8 +113,8 @@ func persistentPreRun(cmd *cobra.Command, args []string) {
|
||||
if getStorePassphrase() != "" {
|
||||
opts = append(opts, filesystem.WithPassphrase([]byte(getStorePassphrase())))
|
||||
}
|
||||
if viper.GetString("base-dir") != "" {
|
||||
opts = append(opts, filesystem.WithLocation(viper.GetString("base-dir")))
|
||||
if util.GetBaseDir() != "" {
|
||||
opts = append(opts, filesystem.WithLocation(util.GetBaseDir()))
|
||||
}
|
||||
store = filesystem.New(opts...)
|
||||
default:
|
||||
@@ -157,15 +158,30 @@ func init() {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().String("basedir", "", "Base directory for filesystem wallets")
|
||||
if err := viper.BindPFlag("base-dir", RootCmd.PersistentFlags().Lookup("basedir")); err != nil {
|
||||
if err := viper.BindPFlag("basedir", RootCmd.PersistentFlags().Lookup("basedir")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().MarkDeprecated("basedir", "use --base-dir")
|
||||
RootCmd.PersistentFlags().String("base-dir", "", "Base directory for filesystem wallets")
|
||||
if err := viper.BindPFlag("base-dir", RootCmd.PersistentFlags().Lookup("base-dir")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().String("storepassphrase", "", "Passphrase for store (if applicable)")
|
||||
if err := viper.BindPFlag("store-passphrase", RootCmd.PersistentFlags().Lookup("storepassphrase")); err != nil {
|
||||
if err := viper.BindPFlag("storepassphrase", RootCmd.PersistentFlags().Lookup("storepassphrase")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().MarkDeprecated("storepassphrase", "use --store-passphrase")
|
||||
RootCmd.PersistentFlags().String("store-passphrase", "", "Passphrase for store (if applicable)")
|
||||
if err := viper.BindPFlag("store-passphrase", RootCmd.PersistentFlags().Lookup("store-passphrase")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().String("walletpassphrase", "", "Passphrase for wallet (if applicable)")
|
||||
if err := viper.BindPFlag("wallet-passphrase", RootCmd.PersistentFlags().Lookup("walletpassphrase")); err != nil {
|
||||
if err := viper.BindPFlag("walletpassphrase", RootCmd.PersistentFlags().Lookup("walletpassphrase")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().MarkDeprecated("walletpassphrase", "use --wallet-passphrase")
|
||||
RootCmd.PersistentFlags().String("wallet-passphrase", "", "Passphrase for wallet (if applicable)")
|
||||
if err := viper.BindPFlag("wallet-passphrase", RootCmd.PersistentFlags().Lookup("wallet-passphrase")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
RootCmd.PersistentFlags().StringSlice("passphrase", nil, "Passphrase for account (if applicable)")
|
||||
@@ -318,7 +334,7 @@ func walletAndAccountFromPath(ctx context.Context, path string) (e2wtypes.Wallet
|
||||
|
||||
locker, isLocker := wallet.(e2wtypes.WalletLocker)
|
||||
if isLocker {
|
||||
err = locker.Unlock(ctx, []byte(viper.GetString("wallet-passphrase")))
|
||||
err = locker.Unlock(ctx, []byte(util.GetWalletPassphrase()))
|
||||
if err != nil {
|
||||
return nil, nil, errors.New("failed to unlock wallet")
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@ func input(ctx context.Context) (*dataIn, error) {
|
||||
var err error
|
||||
data := &dataIn{}
|
||||
|
||||
if viper.Get("remote") != "" {
|
||||
return nil, errors.New("cannot create remote wallets")
|
||||
}
|
||||
|
||||
if viper.GetDuration("timeout") == 0 {
|
||||
return nil, errors.New("timeout is required")
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func setup() error {
|
||||
// Set up our wallet store.
|
||||
switch viper.GetString("store") {
|
||||
case "s3":
|
||||
if viper.GetString("base-dir") != "" {
|
||||
if util.GetBaseDir() != "" {
|
||||
return errors.New("basedir does not apply to the s3 store")
|
||||
}
|
||||
store, err = s3.New(s3.WithPassphrase([]byte(util.GetStorePassphrase())))
|
||||
@@ -55,7 +55,7 @@ func setup() error {
|
||||
if util.GetStorePassphrase() != "" {
|
||||
opts = append(opts, filesystem.WithPassphrase([]byte(util.GetStorePassphrase())))
|
||||
}
|
||||
if viper.GetString("base-dir") != "" {
|
||||
if util.GetBaseDir() != "" {
|
||||
opts = append(opts, filesystem.WithLocation(viper.GetString("base-dir")))
|
||||
}
|
||||
store = filesystem.New(opts...)
|
||||
@@ -142,7 +142,7 @@ func WalletAndAccountFromPath(ctx context.Context, path string) (e2wtypes.Wallet
|
||||
|
||||
locker, isLocker := wallet.(e2wtypes.WalletLocker)
|
||||
if isLocker {
|
||||
err = locker.Unlock(ctx, []byte(viper.GetString("wallet-passphrase")))
|
||||
err = locker.Unlock(ctx, []byte(util.GetWalletPassphrase()))
|
||||
if err != nil {
|
||||
return nil, nil, errors.New("failed to unlock wallet")
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ The first thing you need to do is to create a wallet. To do this run the comman
|
||||
- rename the wallet to something other than `Wallet` if you so desire. If so, you will need to change it in all subsequent commands
|
||||
|
||||
```
|
||||
$ ethdo wallet create --type=hd --mnemonic='abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art' --wallet=Wallet --walletpassphrase=secret
|
||||
$ ethdo wallet create --type=hd --mnemonic='abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art' --wallet=Wallet --wallet-passphrase=secret
|
||||
```
|
||||
|
||||
### I want a specific public key.
|
||||
@@ -29,7 +29,7 @@ You should first create a wallet as per the previous step. To then create an ac
|
||||
- pick a suitable passphrase for your account in place of `secret2`. you will need to use this in all subsequent commands
|
||||
|
||||
```
|
||||
$ ethdo account create --account=Wallet/Account --path=m/12381/3600/0/0 --walletpassphrase=secret --passphrase=secret2
|
||||
$ ethdo account create --account=Wallet/Account --path=m/12381/3600/0/0 --wallet-passphrase=secret --passphrase=secret2
|
||||
```
|
||||
|
||||
At this point you should be able to view your account info with:
|
||||
@@ -66,8 +66,8 @@ To recreate these as `ethdo` accounts run these commands with the following chan
|
||||
- pick suitable passphrases for your account in place of `secret2`
|
||||
|
||||
```
|
||||
$ ethdo account create --account=Wallet/Withdrawal_i_ --path=m/12381/3600/_i_/0 --walletpassphrase=secret --passphrase=secret2
|
||||
$ ethdo account create --account=Wallet/Validator_i_ --path=m/12381/3600/_i_/0/0 --walletpassphrase=secret --passphrase=secret2
|
||||
$ ethdo account create --account=Wallet/Withdrawal_i_ --path=m/12381/3600/_i_/0 --wallet-passphrase=secret --passphrase=secret2
|
||||
$ ethdo account create --account=Wallet/Validator_i_ --path=m/12381/3600/_i_/0/0 --wallet-passphrase=secret --passphrase=secret2
|
||||
```
|
||||
|
||||
### I want to recreate the deposit data for my _i_th validator
|
||||
|
||||
@@ -29,7 +29,7 @@ Additional options are available to decide the type of wallet and encryption.
|
||||
HD wallets can be created from an existing mnemonic by adding the `--mnemonic` parameter to `ethdo wallet create`, for example:
|
||||
|
||||
```sh
|
||||
ethdo wallet create --wallet="Recreated wallet" --type=hd --walletpassphrase="secret" --mnemonic="tooth moon mad fun romance athlete envelope next mix divert tip top symbol resemble stock family melody desk sheriff drift bargain need jaguar method"
|
||||
ethdo wallet create --wallet="Recreated wallet" --type=hd --wallet-passphrase="secret" --mnemonic="tooth moon mad fun romance athlete envelope next mix divert tip top symbol resemble stock family melody desk sheriff drift bargain need jaguar method"
|
||||
```
|
||||
|
||||
## Back up a wallet
|
||||
@@ -71,7 +71,7 @@ Recreating launchpad accounts requires two steps: recreating the wallet, and rec
|
||||
To recreate the wallet with the given mnemonic run the following command (changing the wallet name, passphrase and mnemonic as required):
|
||||
|
||||
```sh
|
||||
ethdo wallet create --wallet="Launchpad" --type=hd --walletpassphrase=walletsecret --mnemonic="faculty key lamp panel appear choose express off absent dance strike twenty elephant expect swift that resist bicycle kind sun favorite evoke engage thumb"
|
||||
ethdo wallet create --wallet="Launchpad" --type=hd --wallet-passphrase=walletsecret --mnemonic="faculty key lamp panel appear choose express off absent dance strike twenty elephant expect swift that resist bicycle kind sun favorite evoke engage thumb"
|
||||
```
|
||||
|
||||
Launchpad accounts are identified by their path. The path can be seen in the filename of the keystore, for example the filename `keystore-m_12381_3600_1_0_0-1596891358.json` relates to a path of `m/12381/3600/1/0/0`. It is also present directly in the keystore under the `path` key.
|
||||
@@ -79,5 +79,5 @@ Launchpad accounts are identified by their path. The path can be seen in the fi
|
||||
To create an account corresponding to this key with the account name "Account 1" you would use the command:
|
||||
|
||||
```sh
|
||||
ethdo account create --account="Launchpad/Account 1" --walletpassphrase=walletsecret --passphrase=secret --path=m/12381/3600/1/0/0
|
||||
ethdo account create --account="Launchpad/Account 1" --wallet-passphrase=walletsecret --passphrase=secret --path=m/12381/3600/1/0/0
|
||||
```
|
||||
|
||||
232
docs/prysm.md
232
docs/prysm.md
@@ -1,232 +0,0 @@
|
||||
# Using ethdo with Prysm
|
||||
|
||||
## Installing ethdo
|
||||
|
||||
1. To install `ethdo`, use the instructions on the [main page](https://github.com/wealdtech/ethdo).
|
||||
|
||||
## Typical validating setups
|
||||
|
||||
This section outlines the process of setting up a configuration with two validators and a single withdrawal account using ethdo.
|
||||
|
||||
### Generating a wallet
|
||||
|
||||
To create a non-deterministic wallet, where keys generated from random data, issue the command:
|
||||
```sh
|
||||
ethdo wallet create --wallet=Validators
|
||||
```
|
||||
|
||||
If you prefer to have a hierarchical deterministic wallet, where keys are generated from a seed, issue the command:
|
||||
|
||||
```sh
|
||||
ethdo wallet create --wallet=Validators --type=hd --walletpassphrase=walletsecret
|
||||
```
|
||||
|
||||
This creates a wallet called "Validators" in the default wallet directory (see https://github.com/wealdtech/ethdo/#wallets-and-accounts for details) which contains the newly generated seed data.
|
||||
|
||||
> The `--walletpassphrase` flag and input is required to protect the seed. It is critical that you keep it private and secure.
|
||||
|
||||
Once the wallet is created, fetch its data to ensure it exists by issuing the following command:
|
||||
|
||||
```sh
|
||||
ethdo wallet info --wallet=Validators
|
||||
```
|
||||
|
||||
This command will produce output like so:
|
||||
|
||||
```sh
|
||||
Type: non-deterministic
|
||||
Accounts: 0
|
||||
```
|
||||
|
||||
### Generating accounts
|
||||
|
||||
To create two separate accounts with different passphrases, issue the command:
|
||||
```sh
|
||||
ethdo account create --account=Validators/1 --passphrase=validator1secret
|
||||
ethdo account create --account=Validators/2 --passphrase=validator2secret
|
||||
```
|
||||
|
||||
> The two accounts are given different passphrases in the above example. This is not required; all accounts can have the same password if you prefer.
|
||||
|
||||
### Creating a withdrawal wallet and account
|
||||
|
||||
It is recommended to set up separate wallets for withdrawals and validator nodes. This allows users to have a validator wallet actively running on the node, while a second wallet can be kept securely offline in cold storage.
|
||||
|
||||
Creating a withdrawal wallet and account is very similar to the process above to generate the validator wallet. For example:
|
||||
|
||||
```sh
|
||||
ethdo wallet create --wallet=Withdrawal
|
||||
ethdo account create --account=Withdrawal/Primary --passphrase=withdrawalsecret
|
||||
```
|
||||
|
||||
This creates a wallet called "Withdrawal" and within it an account called "Primary". It is also possible to apply additional protection to the Withdrawal wallet if desired; see the `ethdo` documentation for details.
|
||||
|
||||
### Depositing funds for a validator
|
||||
|
||||
The validator now requires deposited funds. If you do not have any Göerli Ether, the best approach is to follow the steps at https://prylabs.net/participate to use the faucet and make a deposit -- **however**, for step 3, do not run the commands provided. Instead, run the following command to generate the deposit data requested:
|
||||
|
||||
```sh
|
||||
ethdo validator depositdata \
|
||||
--validatoraccount=Validators/1 \
|
||||
--withdrawalaccount=Withdrawal/Primary \
|
||||
--depositvalue=32Ether \
|
||||
--passphrase=validator1secret \
|
||||
--raw
|
||||
```
|
||||
|
||||
The raw data output of this command can be pasted in to the webpage above to generate the required transaction for validator 1 (and can be repeated for validator 2, or as many validators as you wish).
|
||||
|
||||
Alternatively, if you have your own Göerli ETH, you can send deposit transactions directly to the Göerli testnet. You can create JSON output containing the deposit data:
|
||||
|
||||
```sh
|
||||
ethdo validator depositdata \
|
||||
--validatoraccount=Validators/1 \
|
||||
--withdrawalaccount=Withdrawal/Primary \
|
||||
--depositvalue=32Ether \
|
||||
--passphrase=validator1secret
|
||||
{"account":"Validators/1","pubkey":"a9ca9cf7fa2d0ab1d5d52d2d8f79f68c50c5296bfce81546c254df68eaac0418717b2f9fc6655cbbddb145daeb282c00","withdrawal_credentials":"0059a28dc2db987d59bdfc4ab20b9ad4c83888bcd32456a629aece07de6895aa","signature":"9335b872253fdab328678bd3636115681d52b42fe826c6acb7f1cd1327c6bba48e3231d054e4f274cc7c1c184f28263b13083e01db8c08c17b59f22277dff341f7c96e7a0407a0a31c8563bcf479d31136c833712ae3bfd93ee9ea6abdfa52d4","value":3200000000,"deposit_data_root":"14278c9345eeeb7b2d5307a36ed1c72eea5ed09a30cf7c47525e34f39f564ef5"}
|
||||
```
|
||||
|
||||
This can be passed to [ethereal](https://github.com/wealdtech/ethereal) to send the deposit (replacing `0x21A1A52aba41DB18F9F1D2625e1b19A251F3e0A9` below with your local Göerli account containing the funds and `eth1secret` with that account's passphrase; `ethereal --network=goerli account list --verbose` will provide details of your local accounts and their current funds).
|
||||
|
||||
on Linux/OSX:
|
||||
|
||||
```sh
|
||||
DEPOSITDATA=`ethdo validator depositdata \
|
||||
--validatoraccount=Validators/1 \
|
||||
--withdrawalaccount=Withdrawal/Primary \
|
||||
--depositvalue=32Ether \
|
||||
--passphrase=validator1secret`
|
||||
ethereal beacon deposit \
|
||||
--network=goerli \
|
||||
--data="${DEPOSITDATA}" \
|
||||
--from=0x21A1A52aba41DB18F9F1D2625e1b19A251F3e0A9 \
|
||||
--passphrase=eth1secret
|
||||
```
|
||||
|
||||
or on Windows:
|
||||
|
||||
```sh
|
||||
ethdo validator depositdata \
|
||||
--validatoraccount=Validators/1 \
|
||||
--withdrawalaccount=Withdrawal/Primary \
|
||||
--depositvalue=32Ether \
|
||||
--passphrase=validator1secret >depositdata.json
|
||||
ethereal beacon deposit \
|
||||
--network=goerli \
|
||||
--data=depositdata.json \
|
||||
--from=0x21A1A52aba41DB18F9F1D2625e1b19A251F3e0A9 \
|
||||
--passphrase=eth1secret
|
||||
erase depositdata.json
|
||||
```
|
||||
|
||||
The `ethereal` command can either take a `passphrase`, if the `from` address is a local account (confirm with `ethereal --network=goerli account list`) or a `privatekey` if not.
|
||||
|
||||
### Validating
|
||||
|
||||
The next step is to start the validator using the validating keys that have been created.
|
||||
|
||||
#### Keymanager options
|
||||
|
||||
Although options for the wallet keymanager can be supplied directly on the command-line this is not considered best practice, as it exposes sensitive information such as passphrases, so it is better to create a file that contains this information and reference that file.
|
||||
|
||||
To create the relevant directory run the following for Linux/OSX:
|
||||
|
||||
```sh
|
||||
mkdir -p ${HOME}/prysm/validator
|
||||
```
|
||||
|
||||
or for Windows:
|
||||
|
||||
```sh
|
||||
mkdir %APPDATA%\prysm\validator
|
||||
```
|
||||
|
||||
|
||||
and then use your favourite text editor to create a file in this directory called `wallet.json` with the following contents:
|
||||
|
||||
```json
|
||||
{
|
||||
"accounts": [
|
||||
"Validators/1",
|
||||
"Validators/2"
|
||||
],
|
||||
"passphrases": [
|
||||
"validator1secret",
|
||||
"validator2secret"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Starting the validator with Bazel
|
||||
|
||||
To start the validator you must supply the desired keymanager and the location of the keymanager options file. Run the following command for Linux/OSX:
|
||||
|
||||
```sh
|
||||
bazel run //validator:validator -- --keymanager=wallet --keymanageropts=${HOME}/prysm/validator/wallet.json
|
||||
```
|
||||
|
||||
or for Windows:
|
||||
|
||||
```sh
|
||||
bazel run //validator:validator -- --keymanager=wallet --keymanageropts=%APPDATA%\prysm\validator\wallet.json
|
||||
```
|
||||
|
||||
#### Starting the validator with Docker
|
||||
|
||||
Docker will not have direct access to the wallet created above, and requires the keymanager to be informed of the mapped location of the wallet. Edit the `wallet.json` file to include a location entry, as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"location": "/wallets",
|
||||
"accounts": [
|
||||
"Validators/1",
|
||||
"Validators/2"
|
||||
],
|
||||
"passphrases": [
|
||||
"validator1secret",
|
||||
"validator2secret"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Then run the validator by issuing the following command on Linux:
|
||||
|
||||
```sh
|
||||
docker run -v "${HOME}/prysm/validator:/data" \
|
||||
-v "${HOME}/.config/ethereum2/wallets:/wallets" \
|
||||
gcr.io/prysmaticlabs/prysm/validator:latest \
|
||||
--keymanager=wallet \
|
||||
--keymanageropts=/data/wallet.json
|
||||
```
|
||||
|
||||
or for OSX:
|
||||
|
||||
```sh
|
||||
docker run -v "${HOME}/prysm/validator:/data" \
|
||||
-v "${HOME}/Library/Application Support/ethereum2/wallets:/wallets" \
|
||||
gcr.io/prysmaticlabs/prysm/validator:latest \
|
||||
--keymanager=wallet \
|
||||
--keymanageropts=/data/wallet.json
|
||||
```
|
||||
|
||||
or for Windows:
|
||||
|
||||
```sh
|
||||
docker run -v %APPDATA%\prysm\validator:/data" \
|
||||
-v %APPDATA%\ethereum2\wallets:/wallets" \
|
||||
gcr.io/prysmaticlabs/prysm/validator:latest \
|
||||
--keymanager=wallet \
|
||||
--keymanageropts=/data/wallet.json
|
||||
```
|
||||
|
||||
#### Confirming validation
|
||||
|
||||
When the validator is operational, you should see output similar to:
|
||||
|
||||
```text
|
||||
[2020-02-07 10:00:59] INFO node: Validating for public key pubKey=0x85016bd4ca67e57e1438308fdb3d98b74b81428fb09e6d16d2dcbc72f240be090d5faebb63f84d6f35a950fdbb36f910
|
||||
[2020-02-07 10:00:59] INFO node: Validating for public key pubKey=0x8de04b4cd3f0947f4e76fa2f86fa1cfd33cc2500688f2757e406448c36f0f1255758874b46d72002ad206ed560975d39
|
||||
```
|
||||
|
||||
where each line states a public key that is being used for validating. Confirm that these values match your expectations.
|
||||
@@ -30,11 +30,11 @@ Spending: 0x85dfc6dcee4c9da36f6473ec02fda283d6c920c641fc8e3a76113c5c227d4aeeb100
|
||||
`ethdo wallet create` creates a new wallet with the given parameters. Options for creating a wallet include:
|
||||
- `wallet`: the name of the wallet to create
|
||||
- `type`: the type of wallet to create. This can be either "nd" for a non-deterministic wallet, where private keys are generated randomly, or "hd" for a hierarchical deterministic wallet, where private keys are generated from a seed and path as per [ERC-2333](https://github.com/CarlBeek/EIPs/blob/bls_path/EIPS/eip-2334.md) (defaults to "nd")
|
||||
- `walletpassphrase`: the passphrase for of the wallet. This is required for hierarchical deterministic wallets, to protect the seed
|
||||
- `wallet-passphrase`: the passphrase for of the wallet. This is required for hierarchical deterministic wallets, to protect the seed
|
||||
- `mnemonic`: for hierarchical deterministic wallets only, use a pre-defined 24-word [BIP-39 seed phrase](https://en.bitcoin.it/wiki/Seed_phrase) to create the wallet, along with an additional "seed extension" phrase if required. **Warning** The same mnemonic can be used to create multiple wallets, in which case they will generate the same keys.
|
||||
|
||||
```sh
|
||||
$ ethdo wallet create --wallet="Personal wallet" --type="hd" --walletpassphrase="my wallet secret"
|
||||
$ ethdo wallet create --wallet="Personal wallet" --type="hd" --wallet-passphrase="my wallet secret"
|
||||
```
|
||||
|
||||
#### `delete`
|
||||
@@ -114,12 +114,12 @@ Account commands focus on information about local accounts, generally those used
|
||||
- `passphrase`: the passphrase for the account
|
||||
- `path`: the HD path for the account (only for hierarchical deterministic accounts)
|
||||
|
||||
Note that for hierarchical deterministic wallets you will also need to supply `--walletpassphrase` to unlock the wallet seed.
|
||||
Note that for hierarchical deterministic wallets you will also need to supply `--wallet-passphrase` to unlock the wallet seed.
|
||||
|
||||
For distributed accounts you will also need to supply `--participants` and `--signing-threshold`.
|
||||
|
||||
```sh
|
||||
$ ethdo account create --account="Personal wallet/Operations" --walletpassphrase="my wallet secret" --passphrase="my account secret"
|
||||
$ ethdo account create --account="Personal wallet/Operations" --wallet-passphrase="my wallet secret" --passphrase="my account secret"
|
||||
```
|
||||
#### `import`
|
||||
|
||||
|
||||
31
go.mod
31
go.mod
@@ -4,51 +4,56 @@ go 1.13
|
||||
|
||||
require (
|
||||
github.com/OneOfOne/xxhash v1.2.5 // indirect
|
||||
github.com/attestantio/dirk v0.9.2
|
||||
github.com/attestantio/dirk v0.9.3
|
||||
github.com/attestantio/go-eth2-client v0.6.10
|
||||
github.com/ferranbt/fastssz v0.0.0-20201030134205-9b9624098321
|
||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||
github.com/gofrs/uuid v3.3.0+incompatible
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/google/uuid v1.1.2
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.2 // indirect
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201019012252-4b463a10c225
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201104034342-d782bdf735de
|
||||
github.com/magiconair/properties v1.8.4 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/mitchellh/mapstructure v1.3.3 // indirect
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d
|
||||
github.com/pelletier/go-toml v1.8.1 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201003171600-a72e5f77d233
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201020182719-7f66dae2bbba
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20200618145306-2ae0807bef65
|
||||
github.com/prysmaticlabs/go-ssz v0.0.0-20200612203617-6d5c9aa213ae
|
||||
github.com/rs/zerolog v1.20.0
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.4.1 // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/spf13/viper v1.7.1
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/tyler-smith/go-bip39 v1.0.2
|
||||
github.com/tj/assert v0.0.3 // indirect
|
||||
github.com/tyler-smith/go-bip39 v1.1.0
|
||||
github.com/ugorji/go v1.1.4 // indirect
|
||||
github.com/wealdtech/eth2-signer-api v1.6.0
|
||||
github.com/wealdtech/go-bytesutil v1.1.1
|
||||
github.com/wealdtech/go-ecodec v1.1.1
|
||||
github.com/wealdtech/go-eth2-types/v2 v2.5.1
|
||||
github.com/wealdtech/go-eth2-util v1.6.1
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.2
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.4
|
||||
github.com/wealdtech/go-eth2-util v1.6.2
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.3
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.1.4
|
||||
github.com/wealdtech/go-eth2-wallet-distributed v1.1.2
|
||||
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.1.2
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.2
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.3
|
||||
github.com/wealdtech/go-eth2-wallet-nd/v2 v2.3.2
|
||||
github.com/wealdtech/go-eth2-wallet-store-filesystem v1.16.13
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.1
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.2
|
||||
github.com/wealdtech/go-eth2-wallet-store-scratch v1.6.1
|
||||
github.com/wealdtech/go-eth2-wallet-types/v2 v2.8.1
|
||||
github.com/wealdtech/go-string2eth v1.1.0
|
||||
golang.org/x/text v0.3.3
|
||||
google.golang.org/grpc v1.33.1
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
|
||||
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd // indirect
|
||||
golang.org/x/text v0.3.4
|
||||
google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6 // indirect
|
||||
google.golang.org/grpc v1.33.2
|
||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||
)
|
||||
|
||||
34
go.sum
34
go.sum
@@ -67,6 +67,7 @@ github.com/attestantio/dirk v0.9.1 h1:oof1Xm0uI4a2T9vhQB+f3Wjlngd2rnfsKi8aj1wqNh
|
||||
github.com/attestantio/dirk v0.9.1/go.mod h1:oWsyIb/OXdx9pvDQqS3hdFBB1eFaYnrNjuvLtVwo69w=
|
||||
github.com/attestantio/dirk v0.9.2 h1:yv/Tp/Y/1wATdASROOoY2ZxP1NFjZZCD0b5TasnvYSg=
|
||||
github.com/attestantio/dirk v0.9.2/go.mod h1:yIpIiADNeBmhsCxhZ0o3gFVmUnpl9sPqRhVtwNApJoc=
|
||||
github.com/attestantio/dirk v0.9.3/go.mod h1:EfppeT+VjQXnE9Ti5/vxa6ptZJAN2vMXO6KZojvSOXA=
|
||||
github.com/attestantio/go-eth2-client v0.6.8 h1:Lsjx5P0pB8ruZBfJUbqy5hpevD4Zt8Z0Lg4V5m2s53E=
|
||||
github.com/attestantio/go-eth2-client v0.6.8/go.mod h1:lYEayGHzZma9HMUJgyxFIzDWRck8n2IedP7KTkIwe0g=
|
||||
github.com/attestantio/go-eth2-client v0.6.9 h1:Hbf4tX9MvxCsLokED8Ic3tQxmEAb/phoBkBmk8sKJm0=
|
||||
@@ -90,6 +91,8 @@ github.com/aws/aws-sdk-go v1.35.7 h1:FHMhVhyc/9jljgFAcGkQDYjpC9btM0B8VfkLBfctdNE
|
||||
github.com/aws/aws-sdk-go v1.35.7/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
|
||||
github.com/aws/aws-sdk-go v1.35.14 h1:nucVVXXjAr9UkmYCBWxQWRuYa5KOlaXjuJGg2ulW0K0=
|
||||
github.com/aws/aws-sdk-go v1.35.14/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
|
||||
github.com/aws/aws-sdk-go v1.35.26 h1:MawRvDpAp/Ai859dPC1xo1fdU/BIkijoHj0DwXLXXkI=
|
||||
github.com/aws/aws-sdk-go v1.35.26/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
@@ -286,6 +289,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.14.7 h1:Nk5kuHrnWUTf/0GL1a/vchH/om9Ap2
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.2 h1:HC+hWRWf+v5zTMPyoaYTKIJih+4sd4XRWmj0qlG87Co=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.2/go.mod h1:vO11I9oWA+KsxmfFQPhLnnIb1VDE24M+pdxZFiuZcA8=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
@@ -328,6 +333,8 @@ github.com/herumi/bls-eth-go-binary v0.0.0-20201008062400-71567a52ad65 h1:KUHKqK
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201008062400-71567a52ad65/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U=
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201019012252-4b463a10c225 h1:S7pKW74AvYc89WawL6IxGSnJRxF4TkE1GITYqKFyYy4=
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201019012252-4b463a10c225/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U=
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201104034342-d782bdf735de h1:qLlwYGvpvAx/nDBnPt2KpZTXGli0oHBGddyYxJHTOds=
|
||||
github.com/herumi/bls-eth-go-binary v0.0.0-20201104034342-d782bdf735de/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
@@ -505,6 +512,8 @@ github.com/prysmaticlabs/ethereumapis v0.0.0-20200812153649-a842fc47c2c3 h1:0f++
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20200812153649-a842fc47c2c3/go.mod h1:k7b2dxy6RppCG6kmOJkNOXzRpEoTdsPygc2aQhsUsZk=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201003171600-a72e5f77d233 h1:dGeuKeaXxCepTbwsz7kYSfP1yazw1uRMn58CqNCcPP4=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201003171600-a72e5f77d233/go.mod h1:k7b2dxy6RppCG6kmOJkNOXzRpEoTdsPygc2aQhsUsZk=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201020182719-7f66dae2bbba h1:ItW6tq3B45Gws8dO0cIuU1Srlgf4qomZnWkc0sDCln0=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201020182719-7f66dae2bbba/go.mod h1:k7b2dxy6RppCG6kmOJkNOXzRpEoTdsPygc2aQhsUsZk=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20191017011753-53b773adde52/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20200322041314-62c2aee71669/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20200618145306-2ae0807bef65 h1:hJfAWrlxx7SKpn4S/h2JGl2HHwA1a2wSS3HAzzZ0F+U=
|
||||
@@ -561,6 +570,8 @@ github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
|
||||
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
@@ -593,6 +604,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8=
|
||||
github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
|
||||
github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=
|
||||
github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U=
|
||||
github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
|
||||
github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
|
||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
||||
@@ -632,6 +645,8 @@ github.com/wealdtech/go-eth2-util v1.6.0 h1:l2OR0SqfYdEnb1I1Ggnk0w+B9/LA5aHdQ2KK
|
||||
github.com/wealdtech/go-eth2-util v1.6.0/go.mod h1:0PGWeWWc6qjky/aNjdPdguJdZ2HSEHHCA+3cTjvT+Hk=
|
||||
github.com/wealdtech/go-eth2-util v1.6.1 h1:gYW2s6iea/6NoSuSbisMqETpcnQYfqQnpmGLPYc0XHY=
|
||||
github.com/wealdtech/go-eth2-util v1.6.1/go.mod h1:0hCjncDU0yi6dzGgrCgWAj6grdvJ6loEKCGpCMfxo9c=
|
||||
github.com/wealdtech/go-eth2-util v1.6.2 h1:Gk7xVTG/bY1IUw/8wxOf97DuPbLTGGoZ0k5dNayudhk=
|
||||
github.com/wealdtech/go-eth2-util v1.6.2/go.mod h1:0hCjncDU0yi6dzGgrCgWAj6grdvJ6loEKCGpCMfxo9c=
|
||||
github.com/wealdtech/go-eth2-wallet v1.10.2 h1:oUgi6Ih5fA9thhIipzXMSaLkiwDQXwT8q3bCOLpCr7s=
|
||||
github.com/wealdtech/go-eth2-wallet v1.10.2/go.mod h1:8H9pgp5K7X1kU1cJMS/B3DrMZF74ZlwBThownrcRYgk=
|
||||
github.com/wealdtech/go-eth2-wallet v1.11.0 h1:2KfrWDqF4sWGgk4N5+DaYmh0hOnqiCl0P4vCz5mx17U=
|
||||
@@ -646,6 +661,8 @@ github.com/wealdtech/go-eth2-wallet v1.14.1 h1:0XQ6Bc2vZQCvDMg4qD6usObsXEVUPaNdv
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.1/go.mod h1:MfQZSlMPfUlvh8EAnlHan/ZQSr+lSWA1zD4QTl4116w=
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.2 h1:pk6JGQdeEafVmZw5JYg2gk/8IeZjf0mY8gjufdTfYo8=
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.2/go.mod h1:irzlGFMyRCWlvGgdI7IjS+/Oyr3Y+Dkkh5kxo0VCRDg=
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.3 h1:VskYm62CSMPm9pc/93E2mO3p1GcYUg8HHUSW/rgXPks=
|
||||
github.com/wealdtech/go-eth2-wallet v1.14.3/go.mod h1:cGFCLvyUua84+WQ9e9ETnXjx9hnlZgjRRYYltn+RfOE=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.0 h1:1QUcWILF3h4OLCgTPpWklvRSuPu0fqrt15jwSm7CSC4=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.0/go.mod h1:VTzjJ51dedvYPr4huI7g7KXZVTpGR6ZrCDQwBxJpLck=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.1 h1:YUE1QlJPun8b+xbz0JM71/3t1i9zp9KjcZdJvtJQL+E=
|
||||
@@ -656,6 +673,9 @@ github.com/wealdtech/go-eth2-wallet-dirk v1.0.3 h1:NWwxzYjFG3k7S9mzVOvj02A5S9QOa
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.3/go.mod h1:WIy6Xx0FgTNG5bP7IytxsEt8y1Yl46HbsWVFbE4Yc94=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.4 h1:BOESKDQ2n8EsaeyD+wsTk71zx6VY1mpPe8ADjRqGMoE=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.0.4/go.mod h1:ezepVp6m3sNGsZwFzcA6kjgljGek9ZGYh5AdC5PndPo=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.1.2 h1:HSF3j/RY5bl46cPgskNNz9k7NEeVRrZq+qKWDKRWqP8=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.1.2/go.mod h1:WQ0YW8E+A8r+SjMYX8ZwouZNAHEQPvoxy4Q3OtC0KqU=
|
||||
github.com/wealdtech/go-eth2-wallet-dirk v1.1.4/go.mod h1:CEQyNdk+egD2UbvnVn4qGeSBkvR09dmknCA293WiCVk=
|
||||
github.com/wealdtech/go-eth2-wallet-distributed v1.0.1 h1:3BxMII8T6t16g6lWcYWXjfdvaw8rXuwMQx9h0TG5wRg=
|
||||
github.com/wealdtech/go-eth2-wallet-distributed v1.0.1/go.mod h1:Ha/8S+SCLEuSfXHdvhTLwnKaEF47o6gzQ+FURKwftvU=
|
||||
github.com/wealdtech/go-eth2-wallet-distributed v1.1.0 h1:OZjjuxcIYo+EhAfph7lYP1z+VeNs9ruOI32kqtYe1Jg=
|
||||
@@ -686,6 +706,8 @@ github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.1 h1:QoIyyVQ/vaztkeG88L1vOZKkKMM4
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.1/go.mod h1:smW8Ca0x7JO41urG0sgrlJALb1mGTSagnqaapMWiHfk=
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.2 h1:3EYbuUrs4cCId+WxFAtx+H/uQXRRlBLzosMRSijpwps=
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.2/go.mod h1:hmDme779S5sqxN+W+zmHpS0K8n13fGekHM3gUUB1Ip0=
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.3 h1:9Gt/UGrg3wWkZEFuXOdmm5Ih/wOJPP/p8l9v3MIPPzc=
|
||||
github.com/wealdtech/go-eth2-wallet-hd/v2 v2.5.3/go.mod h1:UzS7JsWmOGjaSky+NTSjriTpdv+Vww1pWemb+3+GRk8=
|
||||
github.com/wealdtech/go-eth2-wallet-nd/v2 v2.1.2/go.mod h1:IssxoHII0ewO1VysMfCmdJP1D00tRhRhXIhhaEXIOVE=
|
||||
github.com/wealdtech/go-eth2-wallet-nd/v2 v2.2.0 h1:h4eePfG0ANOJYMonmIYOvxJ9uLmBEX4APb2O8Vhtv6k=
|
||||
github.com/wealdtech/go-eth2-wallet-nd/v2 v2.2.0/go.mod h1:Un2EtseZWSObmTBjgkt7Qz2am54S/0115jrF83lto1U=
|
||||
@@ -711,6 +733,8 @@ github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.0 h1:O5211UskLbK1WDecTXwugUlIN
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.0/go.mod h1:dcQPLsRRYDiMV0DFYzTX6HRpP9WP+gWreAX5SLBOJ0I=
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.1 h1:YGw5YanOepPGalSyvDKwCEdwvAmG9E3pwo7v6jR/7IM=
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.1/go.mod h1:FR+mhCaoZN4d+EEBSV2QT2cO4szdKvDLTHRygMrH6fk=
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.2 h1:HFT1w+8icvHj5Yb1qDZUjzIQYnFbau1ahYwB08kwwJM=
|
||||
github.com/wealdtech/go-eth2-wallet-store-s3 v1.9.2/go.mod h1:oKDDrc/BMDotY8/zT9TfmnELt+QMaPCiWwTiBmjlwTw=
|
||||
github.com/wealdtech/go-eth2-wallet-store-scratch v1.4.2 h1:GvG3ZuzxbqFjGUaGoa8Tz7XbPlDA33G6nHQbSZInC3g=
|
||||
github.com/wealdtech/go-eth2-wallet-store-scratch v1.4.2/go.mod h1:+TbqLmJuT98PWi/xW1bp5nwZbKz+SIJYVh/+NUkmnb4=
|
||||
github.com/wealdtech/go-eth2-wallet-store-scratch v1.5.0/go.mod h1:RMIIV5/N8TgukTVzyumQd7AplpC440ZXDSk8VffeEwQ=
|
||||
@@ -871,6 +895,8 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb h1:mUVeFHoDKis5nxCAzoAi7E8Gh
|
||||
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201024042810-be3efd7ff127 h1:pZPp9+iYUqwYKLjht0SDBbRCRK/9gAXDy7pz5fRDpjo=
|
||||
golang.org/x/net v0.0.0-20201024042810-be3efd7ff127/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -951,12 +977,16 @@ golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20201024232916-9f70ab9862d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 h1:a/mKvvZr9Jcc8oKfcmgzyp7OwF73JPWsQLvH1z2Kxck=
|
||||
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd h1:5CtCZbICpIOFdgO940moixOPjc0178IU44m4EjOO5IY=
|
||||
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@@ -1102,6 +1132,8 @@ google.golang.org/genproto v0.0.0-20201013134114-7f9ee70cb474/go.mod h1:FWY/as6D
|
||||
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201022181438-0ff5f38871d5 h1:YejJbGvoWsTXHab4OKNrzk27Dr7s4lPLnewbHue1+gM=
|
||||
google.golang.org/genproto v0.0.0-20201022181438-0ff5f38871d5/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6 h1:iRN4+t0lvZX/l9gH14ARF9i58tsVa5a97k6aH95rC3Y=
|
||||
google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
|
||||
@@ -1129,6 +1161,8 @@ google.golang.org/grpc v1.33.0 h1:IBKSUNL2uBS2DkJBncPP+TwT0sp9tgA8A75NjHt6umg=
|
||||
google.golang.org/grpc v1.33.0/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
||||
28
util/basedir.go
Normal file
28
util/basedir.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright © 2020 Weald Technology Trading
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// GetBaseDir() fetches the base directory for wallets.
|
||||
func GetBaseDir() string {
|
||||
baseDir := viper.GetString("base-dir")
|
||||
if baseDir == "" {
|
||||
// Try deprecated name.
|
||||
baseDir = viper.GetString("basedir")
|
||||
}
|
||||
return baseDir
|
||||
}
|
||||
67
util/basedir_test.go
Normal file
67
util/basedir_test.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright © 2020 Weald Technology Trading
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package util_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/wealdtech/ethdo/util"
|
||||
)
|
||||
|
||||
func TestBaseDir(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
inputs map[string]interface{}
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "Nil",
|
||||
},
|
||||
{
|
||||
name: "Current",
|
||||
inputs: map[string]interface{}{
|
||||
"base-dir": "/tmp",
|
||||
},
|
||||
expected: "/tmp",
|
||||
},
|
||||
{
|
||||
name: "Deprecated",
|
||||
inputs: map[string]interface{}{
|
||||
"basedir": "/tmp",
|
||||
},
|
||||
expected: "/tmp",
|
||||
},
|
||||
{
|
||||
name: "Override",
|
||||
inputs: map[string]interface{}{
|
||||
"basedir": "/tmp",
|
||||
"base-dir": "/tmp2",
|
||||
},
|
||||
expected: "/tmp2",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
viper.Reset()
|
||||
for k, v := range test.inputs {
|
||||
viper.Set(k, v)
|
||||
}
|
||||
res := util.GetBaseDir()
|
||||
require.Equal(t, test.expected, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -20,12 +20,22 @@ import (
|
||||
|
||||
// GetStorePassphrases() fetches the store passphrase supplied by the user.
|
||||
func GetStorePassphrase() string {
|
||||
return viper.GetString("store-passphrase")
|
||||
storePassphrase := viper.GetString("store-passphrase")
|
||||
if storePassphrase == "" {
|
||||
// Try deprecated name.
|
||||
storePassphrase = viper.GetString("storepassphrase")
|
||||
}
|
||||
return storePassphrase
|
||||
}
|
||||
|
||||
// GetWalletPassphrases() fetches the wallet passphrase supplied by the user.
|
||||
func GetWalletPassphrase() string {
|
||||
return viper.GetString("wallet-passphrase")
|
||||
walletPassphrase := viper.GetString("wallet-passphrase")
|
||||
if walletPassphrase == "" {
|
||||
// Try deprecated name.
|
||||
walletPassphrase = viper.GetString("walletpassphrase")
|
||||
}
|
||||
return walletPassphrase
|
||||
}
|
||||
|
||||
// GetPassphrases() fetches the passphrases supplied by the user.
|
||||
|
||||
@@ -160,3 +160,93 @@ func TestGetOptionalPassphrase(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorePassphrase(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
inputs map[string]interface{}
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "Nil",
|
||||
},
|
||||
{
|
||||
name: "Current",
|
||||
inputs: map[string]interface{}{
|
||||
"store-passphrase": "secret",
|
||||
},
|
||||
expected: "secret",
|
||||
},
|
||||
{
|
||||
name: "Deprecated",
|
||||
inputs: map[string]interface{}{
|
||||
"storepassphrase": "secret",
|
||||
},
|
||||
expected: "secret",
|
||||
},
|
||||
{
|
||||
name: "Override",
|
||||
inputs: map[string]interface{}{
|
||||
"storepassphrase": "secret",
|
||||
"store-passphrase": "secret2",
|
||||
},
|
||||
expected: "secret2",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
viper.Reset()
|
||||
for k, v := range test.inputs {
|
||||
viper.Set(k, v)
|
||||
}
|
||||
res := util.GetStorePassphrase()
|
||||
require.Equal(t, test.expected, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWalletPassphrase(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
inputs map[string]interface{}
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "Nil",
|
||||
},
|
||||
{
|
||||
name: "Current",
|
||||
inputs: map[string]interface{}{
|
||||
"wallet-passphrase": "secret",
|
||||
},
|
||||
expected: "secret",
|
||||
},
|
||||
{
|
||||
name: "Deprecated",
|
||||
inputs: map[string]interface{}{
|
||||
"walletpassphrase": "secret",
|
||||
},
|
||||
expected: "secret",
|
||||
},
|
||||
{
|
||||
name: "Override",
|
||||
inputs: map[string]interface{}{
|
||||
"walletpassphrase": "secret",
|
||||
"wallet-passphrase": "secret2",
|
||||
},
|
||||
expected: "secret2",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
viper.Reset()
|
||||
for k, v := range test.inputs {
|
||||
viper.Set(k, v)
|
||||
}
|
||||
res := util.GetWalletPassphrase()
|
||||
require.Equal(t, test.expected, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user