Setting Up Gear Node
Introduction
This guide covers the steps required to install and run the Gear node.
There are two ways to get started with the Gear node. First, you can download a pre-built binary file and run it, or second, you can compile the binary file and configure it by yourself. Using a ready-made build is a quick and convenient way to get started as you can skip the installation of Rust and all its dependencies and you can also skip the node compiling process. On the other hand, if you decide that you want to go through the process of creating your development node, it may take about twenty minutes or more depending on your hardware.
System requirements:
Gear node doesn't have any special hardware requirements excepting at least 64 Gbytes of free space on the SSD disk.
Install with pre-build binary
Depending on your OS you need to download the last release build of Gear node from https://get.gear.rs:
- Linux x86-64
- macOS ARM
- macOS x86-64
- Windows x86-64
Terminal:
curl https://get.gear.rs/gear-v1.2.1-x86_64-unknown-linux-gnu.tar.xz | tar xJ
or
Linux x86-64: gear-v1.2.1-x86_64-unknown-linux-gnu.tar.xz
Run the node:
❯ ./gear --version
gear 1.2.1-a218853
Terminal:
curl https://get.gear.rs/gear-v1.2.1-aarch64-apple-darwin.tar.xz | tar xJ
or
macOS ARM: gear-v1.2.1-aarch64-apple-darwin.tar.xz
You can try to run the node:
❯ ./gear --version
gear 1.2.1-a218853
Terminal:
curl https://get.gear.rs/gear-v1.2.1-x86_64-apple-darwin.tar.xz | tar xJ
or
macOS x86-64: gear-v1.2.1-x86_64-apple-darwin.tar.xz
You can try to run the node:
❯ ./gear --version
gear 1.2.1-a218853
Terminal:
curl -O https://get.gear.rs/gear-v1.2.1-x86_64-pc-windows-msvc.zip
or
Windows x86-64: gear-v1.2.1-x86_64-pc-windows-msvc.zip
Unzip the downloaded package then you can try to run the node:
❯ gear.exe --version
gear.exe 1.2.1-a218853
You can use nightly builds if you want the latest features.
Compile Gear node by yourself
Compiling the build will take some time and requires the installation of some dependencies.
Windows users may encounter some problems related to the installation of Rust components and dependencies. It is highly recommended to use Linux or macOS for compiling Gear node and smart-contracts.
Prerequisites
Linux users should generally install GCC
and Clang
, according to their distribution’s documentation. Also, one should install binaryen
toolset that contains required wasm-opt
tool.
For example, on Ubuntu use:
sudo apt install -y clang build-essential binaryen cmake protobuf-compiler
On macOS, you can get a compiler toolset and binaryen
by running:
xcode-select --install
brew install binaryen
Install Rust:
If you already have Rust installed, you can skip this step.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
And then you should reboot your terminal.
Install Wasm Toolchains:
rustup toolchain add nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
Clone Gear repo
git clone https://github.com/gear-tech/gear.git
cd gear
# Checkout to the latest release tag
git checkout v1.2.1 -b release-1.2.1
If you need to use the latest or experimental Gear functions, you should compile the node from master
branch. It is the default branch after clone, but you can switch back to the master
branch using a command:
git checkout master
Compile
cargo build -p gear-cli --release
or
make node-release
You can find the final build at the following location: gear/target/release/gear
Go to:
cd target/release
Run Gear Node
It doesn't matter if you downloaded the prebuild binary or built it yourself. Being in the directory where the gear node is installed to run it without special arguments to get a node connected to the testnet:
./gear
To run Gear node in dev mode use the following command:
./gear --dev
Command Flags and Options
gear [subcommand] [options]
-
--chain=testnet
Connect the node to the test network (default option).
-
--chain=vara
Connect the node to the Vara network.
-
--dev
Run a local node in development mode for testing purposes. This node will not be connected to any external network and will store the state in temporary storage.
-
purge-chain
Remove storage of the selected chain type. Needs to specify the chain connection type
--chain=testnet
,--chain=vara
, or--dev
. -
help
,--help
Print the available subcommands/options or the help of the given subcommand.
Special environment variables
To run Gear node with logs from contracts use:
RUST_LOG="gwasm=debug" gear [subcommand] [options]