How to set up Rust and NEAR for Blockchain/Web3 Development

How to set up Rust and NEAR for Blockchain/Web3 Development

This post covers the setup procedure for Rust development on Linux-based OS, Ubuntu.

Play this article

Near protocol is a decentralized application platform that gives developer-friendly features to build and develop smart contracts.

Near offers the platform to build smart contracts in Rust and deploy them. By default, Near supports Rust and AssemblyScript. Rust is recommended for its greater developer experience when it comes to memory allocation and a minimal runtime, among other great reasons.

Installing Rust (Ubuntu/Linux)

To install Rust, follow the steps below:

Install Curl

If you don't have curl installed, use the scripts below:

sudo apt update
sudo apt install curl

Install Rust

To install Rust, paste and run the script below on your terminal:

curl --proto '=https' --tlsv1.2 -sSf | sh

Configure your shell using:

source $HOME/.cargo/env

To confirm a successful installation, run the following in a terminal:


Screenshot from 2022-06-08 14-55-45.png

After that, run

sudo apt-get install build-essential

Add wasm target to your toolchain

rustup target add wasm32-unknown-unknown

To test out for the installation, create a simple Hello, World! program in rust:

On an empty folder create a file named: and add the following:

fn main() {
    println!("Hello, world!");

Save the file and compile the code using:


Run the simple program:


If Hello, world! did print, congratulations! You have successfully installed Rust

Screenshot from 2022-06-08 15-05-51.png

Installing near-cli

To install thenear-cli simply use:

npm install -g near-cli

More on near-cli can be found here.


The post takes you through installing Rust and near-cli for blockchain development.