Skip to main content

Developing Programs

This Wiki, along with the Vara Educational Hub, serves as a primary source of knowledge for getting started with writing programs using the Gear Protocol and uploading them to the Vara Network.

For a quick overview of writing and running programs on Vara, refer to this guide. It walks through writing a program, compiling it to Wasm, and deploying it to the Vara Network within just 5 minutes.

Gear Protocol's Library

Messages are the main interface for communications between Actors (users and programs). Each Vara program contains code for processing incoming messages. During message processing, programs can send messages to other programs and users, including replies to the initial message.

The Gear Protocol's library gstd provides necessary and sufficient custom functions and methods, including arbitrary async/await syntax for developing programs.

The next articles in this section cover various aspects of the Gear library, executable and state functions, data decoding/encoding, asynchronous programming, program testing, and more.

Vara Node

Vara Node provides a runtime that assists program developers in implementation and testing (personal node) while also enabling participation in the Vara Network as validators.

Anyone can either compile a Vara node or download the prebuilt binary (nightly build). From a functional standpoint, it doesn't matter whether it was downloaded or built manually. The Node can be built, installed, and run on Linux, Mac, and Windows operating systems.

For detailed instructions on installing and running the Vara Node, as well as keeping it operational, backing up, restoring, and troubleshooting, refer to the guide here.

Gear-JS API

The Gear-JS API provides a range of utilities, libraries, and tools that enable JavaScript applications to interact with programs running on the Vara Network via queries to a Vara Node.

The basic API is implemented on the Substrate layer and remains consistent across all Substrate-based networks. It enables connection to a local or remote node, getting node info, subscribing to events, etc. The main capabilities of the Gear-JS API include working with the program's metadata, calculating gas required for network operations, uploading programs to the network, sending a message or a reply to a program, reading a program's state, getting messages from the user's mailbox, and more.

To learn more about implementing a web application to interact with programs on the Vara Network, check out the Gear-JS API. Also, take a look at the NFT frontend application example, which describes how to implement a frontend application that interacts with the program on the blockchain.

Gear Idea

Gear Idea is a convenient tool that allows program developers to easily and swiftly upload programs to the Vara Network directly through their browser without additional configuration.

For development and testing purposes, Gear Idea can be connected to any supported Gear-based network, including test networks (public or private) or even a localhost Node.

This application encompasses all interactions with programs in the Vara Networks (mainnet and testnet), such as uploading new programs, sending messages to contracts, and receiving responses. Gear Idea also facilitates account and balance management, observation of transaction events, working with various wallets, and more.

Program Examples

For developers' convenience, the Gear Foundation provides numerous examples for various use cases. These examples serve as useful references for getting acquainted with writing programs on the Gear Protocol or as a foundation for developing custom dApps. They can be utilized as they are or modified to suit specific scenarios. The source code is available on GitHub.