Skip to main content

Building Smart Contracts

To get started with writing smart contracts on the Gear Protocol and uploading them to the Vara Network, you will need specific prerequisites and tools. The Gear Team offers a centralized resource known as the Gear Wiki, which serves as a single point of knowledge.

For a quick overview of writing and running smart contracts on Gear-powered networks, you can refer to this guide. It walks you through the process of writing a smart contract, compiling it to Wasm, and deploying it to the Vara Network within just 5 minutes.

Gear Protocol's library

Messages is the main interface for communications between Actors (users and programs). Each Gear 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 smart-contracts.

For detailed information on developing dApps on the Gear Protocol, check out these articles. They cover various aspects such as the Gear library, executable and state functions, data decoding/encoding, asynchronous programming, program testing, and more.

Gear Node

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

Anyone can either compile a Gear node on their own 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 Gear Node, as well as keeping it operational, backing up, restoring, and troubleshooting, refer to the guide here.


The Gear-JS API provides a range of utilities, libraries, and tools that enable JavaScript applications to interact with smart contracts running on the Vara Network via queries to a Gear 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, get node info, subscribe to events etc. The main capabilities of Gear-JS API are - working with the program's metadata, calculating gas required for network operations, uploading programs in the network, sending a message or a reply to a program, reading program's state, getting messages from the user's mailbox and more.

To learn more about implementing your web application to interact with smart contracts on the Vara Network, check out this resource.

Gear Idea

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

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

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

Smart Contract Examples

The Gear Team has implemented 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 your own dApp. They can be utilized as they are or modified to suit your specific scenarios.

For more details on Smart Contract Examples, you can visit this link, and the source code is available on GitHub.