casper
December 18, 2021, 10:18am
1
Is it possible to use goal
with a remote data directory as it is with the SDKs? I have a private network running on Digital Ocean that I would like to run goal commands against without shelling into the container
Ben
December 18, 2021, 12:13pm
2
Not easily
See this issue:
opened 09:07AM - 17 Sep 21 UTC
new-feature-request
Team Scytale
community interest
## Problem
When getting started, goal is often the easiest method to start se… nding transactions. This ease is complicated by the need to have a node installed to get config/make requests.
## Solution
Allow a config option for an Algod client that makes requests to a remote API.
@nullun pointed out that the algod.net file has the ip/port for a REST api. Pointing it to `algoexplorerapi.io:443` worked to get node status on the cli after tweaking:
```
ben@LAPTOP-4EV1BSD6:~/go/src/github.com/algorand/go-algorand$ git diff
diff --git a/nodecontrol/algodControl.go b/nodecontrol/algodControl.go
index d6aed9f4..b180dfd4 100644
--- a/nodecontrol/algodControl.go
+++ b/nodecontrol/algodControl.go
@@ -86,7 +86,7 @@ func (nc NodeController) ServerURL() (url.URL, error) {
if err != nil {
return url.URL{}, err
}
- return url.URL{Scheme: "http", Host: addr}, nil
+ return url.URL{Scheme: "https", Host: addr}, nil
}
// GetHostAddress retrieves the REST address for the node from its algod.net file.
```
```sh
ben@LAPTOP-4EV1BSD6:~$ cat .algorand/algod.net
algoexplorerapi.io:443
ben@LAPTOP-4EV1BSD6:~$ goal node status
Last committed block: 16279285
Time since last block: 1.2s
Sync Time: 0.0s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/abc54f79f9ad679d2d22f0fb9909fb005c16f8a1
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/abc54f79f9ad679d2d22f0fb9909fb005c16f8a1
Round for next consensus protocol: 16279286
Next consensus protocol supported: true
Last Catchpoint: 16270000#QK7RJHDC6FDDZ3QR4M5IDOSWXPD4XEQQP7ARI3EHKHVWRWOXMQQQ
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=
ben@LAPTOP-4EV1BSD6:~$ goal asset info --assetid 438831
Error processing command: json: cannot unmarshal array into Go struct field Account.assets of type map[uint64]v1.AssetHolding
```
It looks like the rest client has a number of the endpoints hardcoded to v1 endpoints/data structures
https://github.com/algorand/go-algorand/blob/4b675629252d6f14e206998f4fba235eebc2023b/daemon/algod/api/client/restClient.go#L361-L401
I haven't tested all the endpoints yet.
## Dependencies
goal, libgoal
It is possible but you’ll have to recompile goal to allow https and even then, there are some spots it uses v1 endpoints which aren’t well supported on remote APIs.
Please give the issue a thumbs up if its something you’re interested in
1 Like
tsachi
December 18, 2021, 1:41pm
3
Some of the goal commands cannot be invoked over http.
Two examples for that are the starting / stopping of a node, where a new process needs to be created/destroyed.