solana-rpc-community/rpc-v2-specs

GraphQL interface

Opened this issue · 2 comments

GraphQL has been discussed as a potential option for a queryable interface to RPC. Especially with a more extensible support for parsed data ( see #5).

There are some examples already:

  • Solana FM has graphql support for querying on chain data
  • Other blockchains have implemented GraphQL as standardised ways to query
  • People in Solana ecosystem have said this would enhance developer eperience

On the negative side is that this is a fairly complex addition compared to the simplistic nature of the jsonrpc interface and that it may enforce an indexed datastore (see #7).

do you know if we need to have queries spanning over accounts and transactions or will we have separated areas?

I think if we lean more heavily on the modular interface side of things, we can possibly have a separate interface for GraphQL, and an RPC sidecar that supports GraphQL can explicitly say so.

Developers could also roll "resolvers" which use some other sidecar/server implementation but allow use of GraphQL queries on their client-side. This would effectively be a "middle-man" approach, and can be done using this:

https://github.com/solana-labs/solana-web3.js/tree/master/packages/rpc-graphql

Regardless, I think the interface for GraphQL should be unrelated to the "vanilla" interface for JSON RPC.