Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full Node Endpoints #261

Closed
wants to merge 6 commits into from
Closed

Full Node Endpoints #261

wants to merge 6 commits into from

Conversation

zachfc
Copy link
Contributor

@zachfc zachfc commented Sep 3, 2024

Work in progress:

  • Need to test and add examples
  • Need to link to missing API specs

This page introduces infrastructure provider users to full node APIs. After reading the intro, a user should understand which API they want to use and find the right query method. After reading a section on their preferred query method, a user should be able to connect to a node and use the linked spec.

@matthewdowney, could you please fact-check what's here and call out missing information? Including additional examples you'd like to see, if any

Preview - Full Node Endpoints

Copy link

vercel bot commented Sep 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-teacher ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 3, 2024 1:02pm

Comment on lines +20 to +21
| REST | ✅ | ✖ |
| RPC | ✖ | ✅ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth distinguishing between REST and (Comet's) RPC? Both are JSON over HTTP. I think it's technically correct to separate them but might be confusing.


|| Full Node API | CometBFT API |
| ------ | ------------- | ------------ |
| gRPC | `grpcurl --plaintext <url>.dydxprotocol` | ✖ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is right:

❯ grpcurl dydx-ops-grpc.kingnodes.com:443.dydxprotocol
Too few arguments.
Try 'grpcurl -help' for more details.

❯ grpcurl dydx-ops-grpc.kingnodes.com:443 list
cosmos.auth.v1beta1.Query
cosmos.authz.v1beta1.Query
cosmos.autocli.v1.Query
...

# this one just hangs, can't use --plaintext with SSL
❯ grpcurl --plaintext dydx-ops-grpc.kingnodes.com:443 list
^C

| ------ | ------------- | ------------ |
| gRPC | `grpcurl --plaintext <url>.dydxprotocol` | ✖ |
| REST | `curl <url>/dydxprotocol/` | ✖ |
| RPC | ✖ | `grpcurl --plaintext <url>.status` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RPC should be checked through CURL not gRPC

|| Full Node API | CometBFT API |
| ------ | ------------- | ------------ |
| gRPC | `grpcurl --plaintext <url>.dydxprotocol` | ✖ |
| REST | `curl <url>/dydxprotocol/` | ✖ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the expected response is "Not Implemented"

❯ curl https://dydx-ops-rest.kingnodes.com/dydxprotocol/
{"code":12, "message":"Not Implemented", "details":[]}%

[gRPC endpoints](#grpc) and
[REST endpoints](#rest-grpc-gateway). You can use either framework. Generally, [gRPC](https://grpc.io/) provides a faster connection.

### gRPC Endpoints
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that gRPC and REST endpoints are the same, just with different protocols for access, I'd think it makes more sense to combine the gRPC and REST sections into "Full Node Endpoints", and then show the example requests for both gRPC and REST.


See the [CometBFT RPC v0.38 API specification](https://docs.cometbft.com/v0.38/rpc) for CometBFT endpoints.

**Examples**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "stream the height of the network" (rather than query) is the most important one

@@ -1,3 +1,3 @@
# Full Node gRPC Streaming

This page has moved to [API Integration > Full Node Streaming API](../api_integration-full-node-streaming.md).
This page has moved to [API Integration > Full Node Streaming](../api_integration-full-node-streaming.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This page has moved to [API Integration > Full Node Streaming](../api_integration-full-node-streaming.md).
This page has moved to [API Integration > Full Node Streaming](../../api_integration-full-node-streaming.md).


See the [API specification]() for gRPC endpoints.

**Examples**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO examples would be clearer if they used a live node URL from a specific deployment, like https://dydx-ops-rest.kingnodes.com/ directly, so you can link e.g. straight to https://dydx-ops-rest.kingnodes.com/dydxprotocol/vault/params, and have a separate section explaining that you can substitute your node's address for the base URL.

### REST Endpoints
You can interact with the Full Node API using `curl` or your own tool to send RESTful requests. Nodes provide support for REST through [gRPC-Gateway](https://grpc-ecosystem.github.io/grpc-gateway/). The gRPC-Gateway server is available on port `1317` by default.

See the [Silk Nodes API specification](https://dydx.api.silknodes.io/swagger/#/) for REST endpoints.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to link the swagger spec, but having it hosted elsewhere could be confusing (what is silknodes?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same vein, I think it makes sense to link to the gRPC query service definitions underlying the gRPC endpoints. Maybe just have a quick paragraph explaining how to find the source code for a given endpoint. One of the cool things about DC, for an API user, is that you can just "read the code".

@zachfc
Copy link
Contributor Author

zachfc commented Sep 4, 2024

Thanks for the review @matthewdowney, I'll let you know on slack when I've addressed everything

@zachfc
Copy link
Contributor Author

zachfc commented Sep 9, 2024

I'm reworking and expanding the page. I expect it to take a few more days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants