SUI Network - complete guide to run a Node & Validator

|
by: GLCstaked

SUI is a layer 1 blockchain designed by Mysten Labs from the ground up in smart contract specific language called MOVE

This guide will go over installing a Full Node and Validator from scratch in order to run a Sui network node, assumes a fresh install of Ubuntu 20.04LTS.

Hardware Requirements:

Node Requirements: Full node requirements are lower, but storage can be expected to increase over time

CPUs: 2
RAM: 8GB
Storage: 50GB

Validator Requirements: Validators perform work and deal with chain consensus, requirements are much higher.

Sui Full Node- Build from source

1.     Start Up -initialize device

Update your system

sudo apt update && sudo apt upgrade -y

Firewall Settings

We will enable ports 8080 & 9000, don’t forget to enable your SSH port if you also require remote access.

sudo ufw allow 8080/tcp
sudo ufw allow 9000/tcp
sudo ufw allow 9184/tcp
sudo ufw allow 22/tcp        # sudo ufw allow ssh
sudo ufw enable

Check status

sudo ufw status  

Good idea to check if you can still remote into server at this point before continuing

2. install prerequisite software for Sui

We need a lot of dependencies in order to run SUI

Install the following packages

sudo apt-get update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo apt-get install -y --no-install-recommends \
tzdata \
git \
ca-certificates \
curl \
build-essential \
libssl-dev \
pkg-config \
libclang-dev \
cmake

Install Rust

We will be using the latest version of the Cargo toolchain to build and manage the dependencies. You will need Cargo to build and install Sui on your machine.

check for current installation

cargo --version
rustc --version

Download Rust and Cargo from script

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

you will be prompted with options, select 1 for default installation

run, to include  PATH environment variable to include Cargo's bin directory ($HOME/.cargo/bin).

source $HOME/.cargo/env
rustup update stable

Should you need to uninstall

rustup self uninstall

3. install form Sui from Git

we will first fork the repository to our own account, you need to log into your github.com account and fork from

back to the terminal of your device, clone the forked repository

git clone https://github.com/<YOUR-GITHUB-USERNAME>/sui.git

change to our working directory

cd sui

Set up the Sui repository as a git remote

git remote add upstream https://github.com/MystenLabs/sui

Sync your fork

git fetch upstream

check out the devnet branch

git checkout --track upstream/devnet

make copy of the fullnode configuration template:

cp crates/sui-config/data/fullnode-template.yaml fullnode.yaml

Download the latest genesis state for Devnet by clicking that link or by running the following in your terminal

curl -fLJO https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

Optional - Specify working paths

skip for now

4. Create a System service to Run Sui

Create A Service

We will create a system service to run SUI in the background as a continuous process allowing the node to remain active

sudo tee <<EOF >/dev/null /etc/systemd/system/sui-node.service
[Unit]
Description=Sui node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=/$HOME/sui
ExecStart=/$HOME/.cargo/bin/cargo run --release --bin sui-node -- --config-path /$HOME/sui/fullnode.yaml
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Enable and Start our Service- this will start our node

sudo systemctl enable sui-node
sudo systemctl daemon-reload
sudo systemctl start sui-node

To check the status of the service

sudo systemctl status sui-node

To output the logs

journalctl -u sui-node.service -f

Our full node will be running in the background and should look something like this

Find your Node

check that your node is reachable externally and can be reached by other peers, community member build this tool to check on

to do this you may need to change the default settings in your fullnode.yaml config, follow the steps under ‘making changes to the node’ to do this. We need to make sure the metrics-address and json-rpc-address in the fullnode.yaml is 0.0.0.0 (it was 127.0.0.1 for me) like so

Other Useful Commands

Making changes to the Node

Stop the Node service

sudo systemctl stop sui-node

you can confirm its stopped with

sudo systemctl status sui-node

Locate and open the config file, you can find this with ls -la, and exploring the folders, it should be here by default though

cd sui 

open the config, and edit in the terminal, ctrl+o to write the changes and ctrl+x to exit back to the terminal

nano fullnode.yaml 

Restart the service

sudo systemctl daemon-reload
sudo systemctl restart sui-node

Updating Sui Full Node- for Re-Genesis

to upgrade Sui full node, follow this process. NOTE: this is for a re-genesis upgrade which requires a clean db and full restart. Keep and eye on SUI discord for devnet updates.

Stop the node

sudo systemctl stop sui-node

Move to working directory

cd sui

Remove the old on-disk database and 'genesis.blob' file

rm -r suidb genesis.blob

Fetch the source from the latest release

git fetch upstream

Reset branch

git checkout -B devnet --track upstream/devnet

Download the latest genesis state for Devnet

curl -fLJO https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

Restart your node

sudo systemctl daemon-reload
sudo systemctl restart sui-node

this will take a while to compile all the packages and start to sync again, NOTE: your full node will once again be running at: http://127.0.0.1:9000

so we need to make changes to the .yml to ’find your node’, follow the sections for making changes and ‘find your node’

Sui Wallet

Sui Wallet is an open-sourced wallet for SUI network, allowing users the ability to create an address, view and manage assets on the Sui network, and interact with dApps. This is now available on Devnet for testing, so we can experiment with SUI features on devnet.

Download the Chrome extension from the store

Create a new account, click on the application > get started > create new account

Agree to the terms of service and click ‘Create’

Here you will be prompted with a Seed Phrase, which is the only way to recover your account. Save this and find your wallet address here.

Request Tokens

These are testnet tokens with no value but you can experiment and get involved early to get familiar with SUI before mainnet release

Now head over to the SUI discord, facet channel to request testnet tokens to your wallet like so

There’s a few features within the wallet we can test out, such as minting an NFT

Found on the top right of the extension, click to expand

Found on the top right of the extension, click to expand

Full Node with Docker compose– (pending)

Sui Validator Node- (pending)