Note: The new GraphQL service has launched, and the old beta version is not available anymore. Click here for more details on the new Sui GraphQL RPC service.

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.

Get started

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

Examples

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.

Release timeline

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: completed

Initial schema design and a live beta version (no SLA) of the service released and available to the general public.

Phase 2 target date: Jan 2024

Release the first version of RPC 2.0, initially operated by Mysten Labs.

Phase 3 target date: Q1 2024

Educate Sui node operators on best practices for running new indexing infrastructure involving RPC 2.0.

Phase 4 target date: TBD

Deprecate JSON-RPC APIs once the ecosystem has successfully migrated to the new RPC 2.0 architecture.

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

Author

Sui Foundation

High-performance blockchain delivering the full stack for a new global economy.

Read more like this

How Settlement Time and Composability Help DeFi Flourish on Sui

Sui offers short settlement times and broad composability, supporting the construction of better DeFi products.

4min read
Sui Foundation

Mysticeti Set to Supercharge Consensus on Sui

A new design for blockchain consensus reduces latency below Sui's already record-breaking speeds.

3min read
George Danezis

Introducing the Sui Foundation

The Sui Foundation exists to promote, grow, and cultivate the holistic development of the Sui ecosystem.

2min read
Sui Foundation

How Sui Primitives Revolutionize Onchain Gaming

Sui's powerful primitives level up onchain gaming experiences!

3min read
Sui Foundation

All About Fiat On-Ramps

Fiat on-ramps are essential gateways facilitating conversion from traditional currencies to digital assets.

3min read
Sam Blackshear

Announcing Sui Education Grant Recipients

Sui Education Grants support teams and programs helping to onboard new developers to Sui.

2min read
Sui Foundation