Vara 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.
Stay up to date with the latest releases and updates from the development team by subscribing to this Telegram channel - https://t.me/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 | 0.38.1 | Ensure this version is specified in the package.json file of the program repository |
Sails JS | 0.1.8 | Ensure this version is specified in the package.json file of the program repository |
Gear JS React Hooks | 0.13.0 | Ensure this version is specified in the package.json file of the program repository |
Vara UI Kit | 0.0.11 | Ensure this version is specified in the package.json file of the program repository |
Windows users may encounter problems related to the installation of Rust components and dependencies. It is highly recommended to use Linux or macOS for compiling Vara nodes and programs.
First Steps
-
Create a new project (named, for example -
vara-app
) by running:cargo sails new-program vara-app
Your
vara-app
directory tree should look like thisvara-app
│
├── app
│ └── src
│ └── lib.rs
│
├── client
│ └── ...
│
├── src
│ └── lib.rs
│
├── tests
│ └── gtest.rs
│
├── build.rs
│
├── Cargo.toml
│
└── README.mdCargo.toml
file 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.