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

GraphQL API #269

Open
lrettig opened this issue Sep 26, 2023 · 0 comments
Open

GraphQL API #269

lrettig opened this issue Sep 26, 2023 · 0 comments

Comments

@lrettig
Copy link
Member

lrettig commented Sep 26, 2023

One reason the current API is so broken is that the data model is not well designed. As one example there's currently no way to query a single reward or reward by smesherID (spacemeshos/api#272). It's not possible to query account data (AccountDataQuery, AccountDataStream), smesher reward data (SmesherDataQueryRequest) or global state data (GlobalStateStreamRequest) by layer. It's not possible to read global state data except using a stream, which means there's no way to query historical state data. It's not possible to query account data (AccountMeshDataQueryRequest) using a range of layers (only a start layer). There's no way to look up a block, without looking up a layer, and there's no way to look up an epoch, only a stream EpochStreamRequest. Etc.

For many applications, including the explorer and much of what Smapp does, a GraphQL API would make a lot more sense. It would largely replace the need for the explorer to use streams (which continually time out), and would make historical queries and resyncing/checking data much easier. It would allow custom queries that "drill down" to a specific data item, e.g., a specific block or tx without performing multiple back-and-forth queries (e.g. epoch -> layer -> block -> tx).

I'm not suggesting replacing the existing gRPC API entirely with GraphQL. Certain API services, e.g., admin/debug services, those used to control the node, the new PoST service API, etc. are probably better off as gRPC.

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

No branches or pull requests

2 participants