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 nightly build of Gear node:
- Linux x64
- MacOS ARM
- macOS x64
- Windows x64
Terminal:
curl https://get.gear.rs/gear-nightly-linux-x86_64.tar.xz | tar xJ
or
Linux x64: gear-nightly-linux-x86_64.tar.xz
You can try to run the node:
❯ ./gear --version
gear 0.1.0-hashcode
Terminal:
curl https://get.gear.rs/gear-nightly-aarch64-apple-darwin.tar.xz | tar xJ
or
macOS M1/M2: gear-nightly-aarch64-apple-darwin.tar.xz
You can try to run the node:
❯ ./gear --version
gear 0.1.0-hashcode
Terminal:
curl https://get.gear.rs/gear-nightly-x86_64-apple-darwin.tar.xz | tar xJ
or
macOS Intel x64: gear-nightly-x86_64-apple-darwin.tar.xz
You can try to run the node:
❯ ./gear --version
gear 0.1.0-hashcode
Terminal:
curl -O https://get.gear.rs/gear-nightly-x86_64-pc-windows-msvc.zip
or
Windows x64: gear-nightly-x86_64-pc-windows-msvc.zip
Unzip the downloaded package then you can try to run the node:
❯ gear.exe --version
gear.exe 0.1.0-hashcode
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
git checkout testnet
## Optional
## If you need to use the latest or experimental Gear functions,
## you should compile `gear-node` from `master` branch.
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=staging
Connect the node to Gear testnet (default option).
--dev
Run standalone node of Gear network.
purge-chain
Remove storage of the selected chain type. Needs to specify the chain connection type
--chain=staging
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]