Update output and associated documentation.

This commit is contained in:
Jim McDonald
2022-10-06 18:19:38 +00:00
parent f78b2922ec
commit 0c36239b8b
4 changed files with 14 additions and 4 deletions

View File

@@ -42,11 +42,13 @@ func output(ctx context.Context, data *dataOut) (string, error) {
if data.showPrivateKey {
builder.WriteString(fmt.Sprintf("Private key: %#x\n", data.key.Marshal()))
}
builder.WriteString(fmt.Sprintf("Public key: %#x", data.key.PublicKey().Marshal()))
if data.showWithdrawalCredentials {
withdrawalCredentials := util.SHA256(data.key.PublicKey().Marshal())
withdrawalCredentials[0] = byte(0) // BLS_WITHDRAWAL_PREFIX
builder.WriteString(fmt.Sprintf("\nWithdrawal credentials: %#x", withdrawalCredentials))
builder.WriteString(fmt.Sprintf("Withdrawal credentials: %#x\n", withdrawalCredentials))
}
if !(data.showPrivateKey || data.showWithdrawalCredentials) {
builder.WriteString(fmt.Sprintf("Public key: %#x\n", data.key.PublicKey().Marshal()))
}
return builder.String(), nil

View File

@@ -15,6 +15,7 @@ package accountderive
import (
"context"
"strings"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -45,5 +46,5 @@ func Run(cmd *cobra.Command) (string, error) {
return "", errors.Wrap(err, "failed to obtain output")
}
return results, nil
return strings.TrimSuffix(results, "\n"), nil
}

View File

@@ -112,7 +112,6 @@ ethdo account derive --mnemonic='abandon … art' --path='m/12381/3600/0/0' --sh
again replacing the first '0' in the path with the validator number. This will provide an output similar to:
```
Public key: 0x99b1f1d84d76185466d86c34bde1101316afddae76217aa86cd066979b19858c2c9d9e56eebc1e067ac54277a61790db
Withdrawal credentials: 0x008ba1cc4b091b91c1202bba3f508075d6ff565c77e559f0803c0792e0302bf1
```

View File

@@ -587,6 +587,14 @@ Validator commands focus on interaction with Ethereum 2 validators.
$ ethdo validator credentials get --validator=Validators/1
```
#### `credentials set`
`ethdo validator credentials set` updates withdrawal credentials from BLS "type 0" credentials to execution "type 1" credentials. Full information about using this command can be found in the [specific documentation](./changingwithdrawalcredentials.md).
```sh
$ ethdo validator credentials set --validator=Validators/1 --execution-address=0x8f…9F --private-key=0x3b…9c
```
#### `depositdata`
`ethdo validator depositdata` generates the data required to deposit one or more Ethereum 2 validators. Options include: