August 5, 2022

Sui | Devnet 0.31.0

1package

⠀Sui is a decentralized permissionless smart contract platform biased towards low-latency management of assets.


Content


Information about the project

To the content

Description

⠀Sui is a decentralized permissionless smart contract platform biased towards low-latency management of assets. It uses the Move programming language to define assets as objects that may be owned by an address. Move programs define operations on these typed objects including custom rules for their creation, the transfer of these assets to new owners, and operations that mutate assets.

⠀The network is maintained by a permissionless set of authorities that play a role similar to validators or miners in other blockchain systems. A native asset $SUI is used to pay for gas for all operations and for staking.

⠀The project is being built by a team of Mysten Labs professionals, some of whom are former members of Facebook and Apple teams. Their main mission is to create the basic infrastructure for Web3. Mysten Labs works with key ecosystem developers to gradually improve their networks.

⠀In the December 2021 Series A round, the Mysten Labs project raised $36M from funds such as: a16z, Coinbase Ventures, Electric Capital, Samsung NEXT and others.

Phases

⠀Based on the first and second announcements, the incentivized testnet will begin in September and will be divided into several stages:

  • Launching the network;
  • Staking;
  • Updates;

⠀ To participate, you must launch a node in the Devnet and fill out the form by the end of August.

Rewards

  • 2 000 $SUI per stage if minimum requirements are met;
  • Up to 1 000 000 000 $SUI (up to 10% of the total supply) as delegations to the highest performing validators.

Server requirements

To the content

⠀Recommended (VPS/VDS/DS):
10 CPU, 32 GB RAM, 1000 GB SSD, Ubuntu 20.04

⠀Suitable servers:


Registration

To the content

Registration is closed

⠀Participation requirements:

  • Be over 18 years old (there is a KYC on Coinlist);
  • Have a running node in the Devnet;
  • Fill out the form, and the email address must be the same as the one from the Coinlist account.

⠀ The form must be filled out by August 15 (exact time isn't specified).

⠀ Judging by the questions in the form, the selection will be serious, so it will be hard for newcomers to get through. How many people will be selected isn't specified, there is no information about the limitation of participation by country.


Launching

To the content

All actions must be performed as the root user.

⠀Each subsection is a separate type of installation, you have to select one of them.

Linux

For beginners

⠀Update packages and system

sudo apt update && sudo apt upgrade -y

⠀Install the required packages

sudo apt install wget jq git libclang-dev libpq-dev cmake -y

⠀Install Rust

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh)

⠀The version of Rust must be at least 1.62.0

rustc --version

⠀If not, then delete it with the command below and reinstall it

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh) \
-un

⠀Create a directory for a node

mkdir -p $HOME/.sui

The easy way

⠀Clone the project repository with the node

git clone https://github.com/MystenLabs/sui

The advanced way

⠀Make a fork of the repository (the repository itself).

⠀Clone your repository with the node (insert your username into the link)

git clone https://github.com/YOUR_USERNAME/sui

Continued

⠀Go to the project folder

cd sui

⠀Create a branch with the source repository

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

⠀Fetch the current version

git fetch upstream

⠀Switch to devnet version

git checkout -B devnet --track upstream/devnet

⠀Build binary files (speed depends on the number of processor cores, may take several tens of minutes)

cargo build --release

⠀If an error occurs

error: failed to get `config` as a dependency of package `sui-config v0.0.0 (/root/suirates/sui-config)`

⠀You need to download the binary files compiled by our team

version=`wget -qO- https://api.github.com/repos/SecorD0/Sui/releases/latest | jq -r ".tag_name"`; \
wget -qO- "https://github.com/SecorD0/Sui/releases/download/${version}/sui-linux-amd64-${version}.tar.gz" | tar -C /usr/bin/ -xzf -

⠀Move binary files to the folder with binary files

mv $HOME/sui/target/release/{sui,sui-node,sui-faucet} /usr/bin/

⠀Return to the home directory

cd

⠀Download a genesis file

# Devnet
wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

⠀Copy a config

cp $HOME/sui/crates/sui-config/data/fullnode-template.yaml \
$HOME/.sui/fullnode.yaml

⠀Edit the config

sed -i -e "s%db-path:.*%db-path: \"$HOME/.sui/db\"%; "\
"s%metrics-address:.*%metrics-address: \"0.0.0.0:9184\"%; "\
"s%json-rpc-address:.*%json-rpc-address: \"0.0.0.0:9000\"%; "\
"s%genesis-file-location:.*%genesis-file-location: \"$HOME/.sui/genesis.blob\"%; " $HOME/.sui/fullnode.yaml

⠀Open the ports used

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/ports_opening.sh) \
9000 9184

⠀Create a service file

printf "[Unit]
Description=Sui node
After=network-online.target

[Service]
User=$USER
ExecStart=`which sui-node` --config-path $HOME/.sui/fullnode.yaml
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target" > /etc/systemd/system/suid.service

⠀Run the service file

sudo systemctl daemon-reload
sudo systemctl enable suid
sudo systemctl restart suid

⠀Add an alias of a command to view the log of the node to the system

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n sui_log -v "sudo journalctl -fn 100 -u suid" -a

⠀Check if the command outputs information

wget -qO-  -t 1 -T 5 --header 'Content-Type: application/json' --post-data '{ "jsonrpc":"2.0", "id":1, "method":"sui_getCommitteeInfo", "params":[] }' "http://127.0.0.1:9000/" | jq

⠀You can also check the node synchronization in this checker and find your node in another one by entering the server IP.

Docker

For lovers of beauty

⠀Optionally, make a fork of the repository (the repository itself).

⠀Update packages and system

sudo apt update && sudo apt upgrade -y

⠀Install the required packages

sudo apt install wget jq bc build-essential -y

⠀Install Docker

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/docker.sh)

⠀Create a directory for a node

mkdir -p $HOME/.sui

⠀Download a genesis file

wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

⠀Download a config

wget -qO $HOME/.sui/fullnode.yaml https://github.com/MystenLabs/sui/raw/main/crates/sui-config/data/fullnode-template.yaml

⠀Edit the config

sed -i -e "s%db-path:.*%db-path: \"$HOME/.sui/db\"%; "\
"s%metrics-address:.*%metrics-address: \"0.0.0.0:9184\"%; "\
"s%json-rpc-address:.*%json-rpc-address: \"0.0.0.0:9000\"%; "\
"s%genesis-file-location:.*%genesis-file-location: \"$HOME/.sui/genesis.blob\"%; " $HOME/.sui/fullnode.yaml

⠀Open the ports used

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/ports_opening.sh) \
9000 9184

⠀Run a container with the node

docker run -dit --name sui_node --restart always -u 0:0 \
  --log-opt max-size=50m --log-opt max-file=3 \
  --network host -v $HOME/.sui:/root/.sui secord/sui \
  --config-path $HOME/.sui/fullnode.yaml

⠀Add aliases of commands to the system:

  • To view the log of the node;
  • Reducing the command to perform actions in the container.
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n sui_log -v "docker logs sui_node -fn100" -a
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n sui -v "docker exec -it sui_node ./sui" -a

⠀Check if the command outputs information

wget -qO-  -t 1 -T 5 --header 'Content-Type: application/json' --post-data '{ "jsonrpc":"2.0", "id":1, "method":"sui_getCommitteeInfo", "params":[] }' "http://127.0.0.1:9000/" | jq

⠀You can also check the node synchronization in this checker and find your node in another one by entering the server IP.


Creating a wallet

To the content

The wallet is created once, when the network is updated, you have to recover the previously created one.

⠀To interact with the blockchain it is necessary to create a wallet, to do this you need to run the command below, answer the first questions:

  1. y
  2. Enter
  3. 0
sui client

Make a backup copy of the:

  1. Mnemonic phrase;
  2. Folder with the keys, saving it in a safe place (the command shows the path)
echo $HOME/.sui/sui_config/

⠀Make sure that the address has been created

sui keytool list

Make a statement

To the content

⠀The actions below can be performed as a confirmation of participation in the devnet (unconfirmed information).

Publishing the node RPC

⠀On the server, run the command below to get the node RPC

echo "http://`wget -qO- eth0.me`:9000/"

⠀Open the link in the browser on your PC, the message should appear (if it doesn't appear, then the node doesn't work)

Used HTTP Method is not allowed. POST or OPTIONS is required

⠀ To send your RPC, you have to join the Discord server and send it to a special channel. In this case, it is desirable to keep the node working until the start of the incentivized testnet.

Request tokens from the faucet

⠀Display and copy the wallet address (in the left column)

sui keytool list

⠀Go to:

!faucet 0x___

Create a NFT

⠀NFT-example is created by the command

sui client create-example-nft

Summary

To the content

⠀The folder with the keys must be saved in a safe place so that you can recover the wallet (the command displays the path)

echo $HOME/.sui/sui_config/

⠀Your node can be monitored in the checker by entering the server IP.

⠀Activities were performed:

  • Published node RPC;
  • Requested tokens from the faucet;
  • NFT created.

⠀You can follow the updates of the project in the #📢・announcements channel.

⠀Devnet updates are published in the #📢・devnet-updates channel.


Recovering

To the content

⠀Create a directory for a node

mkdir -p $HOME/.sui

⠀Move the directory with the keys from the backup to the server to the created folder (the command displays the path to the moved folder)

echo $HOME/.sui/sui_config/

Launch a node.


Updating

To the content

Linux

⠀Stop a node

systemctl stop suid

⠀Delete the old database

rm -rf $HOME/.sui/db

⠀Download a new genesis file

wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

⠀Go to the folder with the project

cd $HOME/sui

⠀Create a branch with the source repository, if it wasn't created earlier

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

⠀Fetch the current version

git fetch upstream

⠀Hide local changes

git stash

⠀Update the local repository

git checkout -B devnet --track upstream/devnet

⠀Build binary files (speed depends on the number of processor cores, may take several tens of minutes)

cargo build --release

⠀Move binary files to the folder with binary files

mv $HOME/sui/target/release/{sui,sui-node,sui-faucet} /usr/bin/

⠀Check the version, it should be 0.31.0

sui -V

⠀Restart the node

systemctl restart suid

Docker

⠀ The container has an automatic binary update built into it on restart, but the binary files are manually collected and posted by our team.

⠀Stop a node

docker stop sui_node

⠀Delete the old database

rm -rf $HOME/.sui/db

⠀Download a new genesis file

wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

⠀Restart the node

docker restart sui_node

⠀Wait for a new binary to be downloaded

sui_log

⠀Check the version, it should be 0.31.0

sui -V

Uninstalling

To the content

Linux

⠀Delete the variable

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n sui_log -da

⠀Stop a node

systemctl stop suid

⠀Remove service file from the autorun

systemctl disable suid

⠀Delete node files

rm -rf $HOME/{sui,.sui} /usr/bin/{sui,sui-node,sui-faucet} \
/etc/systemd/system/suid.service

⠀Reload the list of service files

systemctl daemon-reload

Docker

⠀Delete variables

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n sui_log -da
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n sui -da

⠀Stop a node

docker rm sui_node -f

⠀Delete node files

rm -rf $HOME/.sui /usr/bin/{sui,sui-node,sui-faucet}

⠀Delete the image

docker rmi secord/sui

FAQ

To the content

I have a lot of warnings and errors in the log, is this normal?

⠀Yes, it can happen. The main thing is that the node is in the checker.

Node consumes all free RAM, what to do?

The reason:

⠀ The node has a memory leakage problem.

The solution:

⠀The root of the problem should be fixed by the developers, for our part we can:

  • Launch the node using a different method (Systemd/Docker);
  • Periodically restart the node;
  • Set the RAM consumption limit for the Dcoker container when it is created.

Why does the checker display 0 objects?

The reason:

⠀The number of objects in the checker appears to be reset after the node is reloaded.

The solution:

⠀Reinstall or update the node, but it doesn't always work, it's easier to do nothing. If someone finds a different solution, please share the information in the Discord.

error while loading shared libraries: libssl.so.1.1

The solution:

⠀Install the missing library.

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.6_amd64.deb; \
sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.6_amd64.deb

Error: invalid length 0, expected an byte array of size 32

The reasons:

  • Your node binary file isn't current;
  • Your genesis file isn't current.

The solution:

  • Download the current genesis and restart the node
wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob; \
systemctl restart suid
  • Update the binary files. If the problem persists, download the binary files collected by our team:
version=`wget -qO- https://api.github.com/repos/SecorD0/Sui/releases/latest | jq -r ".tag_name"`; \
wget -qO- "https://github.com/SecorD0/Sui/releases/download/${version}/sui-linux-amd64-${version}.tar.gz" | tar -C /usr/bin/ -xzf -; \
systemctl restart suid


Useful commands

To the content

⠀To view the node's log

sui_log
sudo journalctl -fn 100 -u suid
docker logs sui_node -fn100

⠀To view imported wallets

sui keytool list

⠀To view main wallet objects

sui client objects

⠀To view main wallet balance

sui client gas

⠀To restart the node

systemctl restart suid
docker restart sui_node

Useful links

To the content

Official website | Discord | Twitter | GitHub

Official documentation | Checker | Synchronization checker | Explorer


1package

To the content

Telegram (RU) | Chat (RU) | Discord (RU) | Twitter | Learning | Admitix


Acknowledgments

To the content

1package team — studying the project, writing the article