Skip to content

Commit

Permalink
Update docs re public endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Feb 21, 2023
1 parent 15d58e2 commit 76b9010
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
24 changes: 23 additions & 1 deletion cmd/nodeinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (
"github.com/wealdtech/ethdo/util"
)

// defaultBeaconNode is used if no other connection is supplied.
var defaultBeaconNode = "http://mainnet-consensus.attestant.io/"

var nodeInfoCmd = &cobra.Command{
Use: "info",
Short: "Obtain information about a node",
Expand All @@ -36,7 +39,26 @@ In quiet mode this will return 0 if the node information can be obtained, otherw
ctx := context.Background()

eth2Client, err := util.ConnectToBeaconNode(ctx, viper.GetString("connection"), viper.GetDuration("timeout"), viper.GetBool("allow-insecure-connections"))
errCheck(err, "Failed to connect to Ethereum 2 beacon node")
if err != nil {
if viper.GetString("connection") != "" {
// The user provided a connection, so don't second-guess them by using a different node.
fmt.Fprintln(os.Stderr, err.Error())
return
}

// The user did not provide a connection, so attempt to use the default node.
if viper.GetBool("debug") {
fmt.Fprintf(os.Stderr, "No node connection, attempting to use %s\n", defaultBeaconNode)
}
eth2Client, err = util.ConnectToBeaconNode(ctx, defaultBeaconNode, viper.GetDuration("timeout"), viper.GetBool("allow-insecure-connections"))
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
return
}
if !viper.GetBool("quiet") {
fmt.Fprintf(os.Stderr, "No connection supplied; using mainnet public access endpoint\n")
}
}

if quiet {
os.Exit(_exitSuccess)
Expand Down
3 changes: 3 additions & 0 deletions cmd/validator/credentials/set/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ func (c *command) setup(ctx context.Context) error {
if err != nil {
return err
}
if !c.quiet {
fmt.Fprintf(os.Stderr, "No connection supplied; using mainnet public access endpoint\n")
}
}

// Set up chaintime.
Expand Down
18 changes: 12 additions & 6 deletions docs/changingwithdrawalcredentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,33 @@ Here the copy of `ethdo` with access to private keys is on an offline computer,
## Preparation
Regardless of the method selected, preparation must take place on the online computer to ensure that `ethdo` can access your consensus node. `ethdo` will attempt to find a local consensus node automatically, but if not then an explicit connection value will be required. To find out if `ethdo` has access to the consensus node run:

```
ethdo node info --verbose
```sh
ethdo node info
```

The result should be something similar to the following:

```
Version: teku/v22.9.1/linux-x86_64/-privatebuild-openjdk64bitservervm-java-14
Syncing: false
```

It is important to confirm that the "Syncing" value is "false". If this is "true" it means that the node is currently syncing, and you will need to wait for the process to finish before proceeding.
Alternatively, the result may look like this:

If this command instead returns an error you will need to add an explicit connection string. For example, if your consensus node is serving its REST API on port 12345 then you should add `--connection=http://localhost:12345` to all `ethdo` commands in this process, for example:
```
No connection supplied; using mainnet public access endpoint
Syncing: false
```

which means that a local consensus node was not accessed and instead a public endpoint specifically assigned to handle these operations was used instead. If you do have a local consensus node but see this message it means that the local node could not be accessed, usually because it is running on a non-standard port. If this is the case for your configuration, you need to let `ethdo` know where the consensus node's REST API is. For example, if your consensus node is serving its REST API on port 12345 then you should add `--connection=http://localhost:12345` to all `ethdo` commands in this process, for example:

```sh
ethdo --connection=http://localhost:12345 node info --verbose
ethdo --connection=http://localhost:12345 node info
```

Note that some consensus nodes may require configuration to serve their REST API. Please refer to the documentation of your specific consensus node to enable this.

Regardless of your method used above, it is important to confirm that the "Syncing" value is "false". If this is "true" it means that the node is currently syncing, and you will need to wait for the process to finish before proceeding.

Once the preparation is complete you should select either basic or advanced operation, depending on your requirements.

## Basic operation
Expand Down

0 comments on commit 76b9010

Please sign in to comment.