Post
Share your knowledge.
Sui gRPC vs JSON-RPC for Developers
Title: Switching to gRPC — worth it for Sui dApps?
With gRPC coming to Sui, I’m wondering how developers are planning to adopt it.
Have you tested latency differences compared to JSON-RPC?
Is the feature set identical, or are there gaps?
Do you see gRPC as better for production apps or mostly for internal tooling?
Any migration tips, sample client code, or performance metrics would help others decide when and how to switch.
- Move CLI
- Move Module
- Move Bug
- Feature Request
Answers
1Sui’s adoption of gRPC in full beta, replacing JSON-RPC as the default full node API, offers developers a faster, more efficient way to interact with blockchain data, and many are eyeing it for its performance edge and real-time capabilities. Latency tests show gRPC is significantly faster than JSON-RPC, with serialization speeds up to six times quicker due to its use of Protocol Buffers (Protobuf) over JSON’s text-based format, and HTTP/2’s multiplexing reduces network overhead, cutting response times by up to 50% in high-traffic scenarios like DeFi or gaming dApps. The feature set isn’t identical—gRPC adds powerful streaming capabilities via SubscriptionService for real-time updates (e.g., checkpoints, transactions), which JSON-RPC lacks due to its polling-based approach, but JSON-RPC’s simpler setup might still suit basic queries where human-readable JSON is preferred. gRPC shines for production apps needing low latency and scalability, like exchanges or real-time analytics, while JSON-RPC may remain handy for internal tooling or simpler scripts due to its broader language support and ease of use. For migration, start by reviewing Sui’s gRPC proto files on GitHub (sui-apis repository) to generate client libraries in languages like Rust or TypeScript, and test on Sui’s testnet to compare performance with JSON-RPC endpoints. A sample client in TypeScript might look like:
const { SuiClient } = require('@mysten/sui.js/client');
const client = new SuiClient({ url: 'grpc://fullnode.sui.io:443' });
async function getBalance(address) { const response = await client.getBalance({ owner: address });
console.log(response); }
—ensure you install @mysten/sui.js and set up gRPC dependencies. Performance metrics from Sui’s beta show gRPC handling thousands of concurrent requests with sub-second latency, compared to JSON-RPC’s multi-second delays under similar loads. To switch, gradually integrate gRPC for high-performance components, keep JSON-RPC for legacy compatibility (still supported for now), and use tools like grpcurl to experiment with endpoints. Watch for gRPC’s steeper learning curve with Protobuf schemas, and always simulate with suiClient.dryRunTransactionBlock to catch integration issues.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.
