Skip to main content

Comparison of the various ways to communicate with Gno.land

This document is an overview of the various methods to interact with gnoland. This is mainly for developers writing applications.

JSON-RPC

What is it? The RPC interface is the base-level method to interact with the gno.land blockchain over an HTTP-RPC connection. The actual RPC messages are encoded in Protocol Buffers binary wire format (as used by Protobuf).

When to use it? The HTTP-RPC interface is used under-the-hood by gnokey and all the other methods. Some of the messages are simple and your app could open an HTTP connection and interact with the blockchain. But most Protobuf messages are more complex and you would want to use one of the following methods.

gRPC clients generated by Protobuf

What is it? The core Gno codebase uses the light-weight Amino package to format the Protobuf messages when interacting with the blockchain. Another method is to use a Protobuf library to format the messages.

When to use it? Amino is a Go package, so you can't use it if your app is written in a different programming language. Instead, you can import a Protobuf library to format and parse the messages for interacting with the blockchain.

Go code with gnoclient and crypto/keys

What is it? The gnoclient and crypto/keys packages are part of the core Gno codebase, written in Go. The gnoclient API is for querying the blockchain, calling realm functions, and other basic interactions. The crypto/keys API is for generating cryptographical keys and managing the local keys database.

When to use it? If your app is written in Go, you can use these packages (as gnokey and other command-line apps do).

Gno Native Kit

What is it? Gno Native Kit is a framework that allows developers to build and port gno.land dApps written in the dApp's native language such as TypeScript, Java or C#. It is a wrapper on top of the gnoclient and crypto/keys which allows your app to use the functionality in these core Gno packages.

When to use it? If your app is not written in Go (for example, React Native on mobile), then Gno Native Kit can provide access to all the functionality.

tm2-js / gno-js

What is it? tm2-js is a JavaScript/TypeScript client implementation for Tendermint2-based chains (such as Gno.land). gno-js is an extension of tm2-js, but with Gno-specific functionality.

gno-js is designed to make it easy for developers to interact with the Gno.land blockchain by providing a simplified API for account and transaction management.

When to use it? When developing a browser app without access to the Go runtime (which is used by all the other methods).

tx-indexer with GraphQL

What is it? tx-indexer is a tool which makes an indexed database of the transactions on the gno.land blockchain. It comes with a GraphQL interface which you can use directly in a web page or from your app through WebSocket.

When to use it? If your app needs to do CPU-intensive processing of your realm data, then it is better to have a dedicated service running on a server instead of on-chain processing. tx-indexer provides efficient read-only queries of just the data that needs to be processed. Then your end-user app can fetch the result from the service.

JSON-RPCgRPC clients generated by ProtobufGo code with gnoclient crypto/keysGno Native Kittm2-js / gno-jstx-indexer with GraphQL
App programing languageAny language with an HTTP libraryGo, JavaScript, Java, Swift, C#, more supported by gRPCGoGo, JavaScript, Java, Swift, C#, more supported by gRPCJavaScriptAny language with a WebSocket library
PlatformAny constrained platform where you can't use any of the other methodsAny platform that has a Protobuf libraryDesktop utilitiesMobile, desktop appsBrowserOff-chain service apps
Uses core Gno code?NoNoYesYesNoYes
Requires programming in Protobuf?NoNoYesYesYesYes
Supports browser applicationsYesNoNoNoNoN/A
Recommended forSituations where you can't use any of the other methods due to significant constraints. (e.g. a Raspberry Pi querying the blockchain for an account balance)Apps which can't link to the core Go codeBasic Go apps (like command-line utils)Robust mobile and desktop apps where devs use gRPC to bypass the complexity of interacting directly with the blockchainBrowser appsComplex read-only interactions (e.g.: compute the home feed of a dApp)