In order to address many known pain points with the existing RPC, Sui is preparing to launch a new RPC service based on GraphQL, dubbed Sui RPC 2.0. GraphQL is an open-source data query and manipulation language designed to facilitate building expressive APIs and services that require complex data querying.
Users currently have access to a READ-ONLY snapshot of the beta version of Sui mainnet and testnet networks. This version is not intended for production-ready applications, but rather to serve as a playground for developers to get familiar with the upcoming GraphQL RPC schema and service.
The current JSON-RPC remains the main RPC service until the end of Q1 2024.
Why build a new RPC service?
The RPC service redesign solves many of the challenges faced by developers working with the current RPCs. RPC 2.0 deprecates the unsafe transaction serialization API and provides more efficient query patterns for dynamic fields, among other fixes for usability issues reported by current users.
On the back-end, the RPC service and its data-store will be decoupled from fullnodes. Fullnodes’ APIs will be limited to transaction execution and data ingestion for indexers, with all read requests served by a new, stateless RPC service, reading from its own data store. Indexers will consume transaction data from fullnodes in bulk, post-process them and write them to the store.
More technical details on the architecture of the new GraphQL RPC service and why Sui is switching to it are available in this GitHub issue.
Sui provides an interactive playground for using GraphQL on Sui mainnet and testnet networks based on the GraphQL IDE . The online IDE offers autocomplete support (use ctrl+space) and documentation of the schema and the available types. If you’d like to inspect the schema that is currently used , hit the /schema endpoint (e.g., https://graphql-beta.mainnet.sui.io/schema)
For current known issues and limitations, please consult the docs.
For query examples, visit the examples folder in the repository.
Below is a screenshot of a query written in the online IDE and the result.
We continue to work on the GraphQL RPC in order to implement all the envisioned features. Here is the current timeline for building and releasing the service.
Phase 1 target date: Oct 31, 2023
Initial schema design and a live beta version (no SLA) of the service released and available to the general public.
Phase 2 target date: Dec 30, 2023
Release RPC 2.0 with full feature support including subscription, writing data on-chain, and more.
Phase 3 target date: Mar 31, 2024
Share your feedback
Try out the API and provide feedback about any potential difficulties you have identified in adopting the GraphQL RPC via this forum post.