Closed
Description
Problem
When getting started, goal is often the easiest method to start sending 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.
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
go-algorand/daemon/algod/api/client/restClient.go
Lines 361 to 401 in 4b67562
I haven't tested all the endpoints yet.
Dependencies
goal, libgoal