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. Requests and responses are JSON-RPC, and the result payloads are encoded with Amino JSON. See JSON-RPC endpoints for the methods, the encoding rules and the limits.

When to use it? The HTTP-RPC interface is used under-the-hood by gnokey and all the other methods. Queries are simple enough to issue over a plain HTTP connection. Submitting a transaction means building and signing an Amino-encoded std.Tx, which is why most applications use one of the following methods instead.

Protobuf message definitions​

What is it? The core Gno codebase uses the light-weight Amino package to encode messages. Amino can generate Protobuf definitions for those message types, which a non-Go application can use to build and parse them.

When to use it? Amino is a Go package, so an application written in another language cannot import it. Generated Protobuf definitions cover the message types — but the transport is still the JSON-RPC interface above. There is no gRPC server: the grpc_laddr setting present in config.toml is carried by the config tooling, and nothing starts a server from it.

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-RPCProtobuf message definitionsGo code with gnoclient crypto/keysGno Native Kittm2-js / gno-jstx-indexer with GraphQL
App programming languageAny language with an HTTP libraryAny language with a Protobuf and an HTTP libraryGoGo, JavaScript, Java, Swift, C#, via the kit's own 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?NoYesYesYesYesYes
Supports browser applicationsYesYesNoNoNoN/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)