Program Examples
This section contains a set of examples that can be used for familiarization with writing programs on Vara or as the basis for dApps: https://github.com/gear-foundation.
Programs can be written from scratch or built from provided examples.
Stable Environment
All program examples and JS applications have been tested in a stable environment with specific development tool versions necessary for implementing, building, and running programs and JS applications.
The latest releases of Gear librarires are avaible in the GitHub.
Join the Community
Stay up to date with the latest releases and updates from the development team by subscribing to our Telegram channel: @GearVaraDev.
| Compiler Tools | Version | How to install / access |
|---|---|---|
Linux users should generally install GCC and Clang, according to their distribution's documentation. | Latest | For example, on Ubuntu use: On macOS, install a compiler toolset by running: |
| Rust | stable | Install Rustup to get Rust compiler ready: Add Wasm target to the toolchain: |
| Gear Sails library | latest | Install the latest version of Sails library: |
Gear Rust libraries: gstd, gtest, gclient, gear-wasm-builder | latest | The latest version is tagged in the |
| Vara Network Testnet | latest | Ensure connection to the Vara Network Testnet. Switch networks by clicking on the network name in https://idea.gear-tech.io |
| Gear JS Tools | Version | How to install / access |
|---|---|---|
| Gear JS API | latest | Ensure this version is specified in the package.json file of the program repository |
| Sails JS | latest | Ensure this version is specified in the package.json file of the program repository |
| Gear JS React Hooks | latest | Ensure this version is specified in the package.json file of the program repository |
| Vara UI Kit | latest | Ensure this version is specified in the package.json file of the program repository |
Windows Compatibility
Windows users often encounter issues with Rust dependencies. We strongly recommend using Linux or macOS for compiling Vara nodes and programs.
Tip: If you are on Windows, using WSL2 (Windows Subsystem for Linux) is the best way to ensure a stable development environment.
First Steps
-
Create a new project (named, for example -
vara-app) by running:cargo sails program vara-appYour
vara-appdirectory tree should look like thisvara-app │ ├── app │ └── src │ └── lib.rs │ ├── client │ └── ... │ ├── src │ └── lib.rs │ ├── tests │ └── gtest.rs │ ├── build.rs │ ├── Cargo.toml │ └── README.mdCargo.tomlfile is a project manifest in Rust. The essential libraries required for compiling a project are automatically included there. -
Write your program's code
-
Compile the Wasm program in the app folder:
cargo build --release
Refer to Getting Started for additional details.