Actions

Mysten Sui RPC endpoint

From Chainlink Community Wiki

Revision as of 17:15, 13 July 2022 by Devtrace (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Mysten-Sui Logo.png

This is a general guide on deploying a Mysten Sui Full Node.

Official Mysten Sui Docs are available here

NOTE

This document assumes base operating system is Debian 10


Install Dependencies

Before we can get our Mysten Sui node running, we need to install some necessary software.

We'll install some packages that we'll need or will at least be handy to have.

sudo apt install -y git curl wget jq node-ws telnet traceroute cmake tree

Install Rust & Cargo

Navigate to the official download page and run the provided command.

curl https://sh.rustup.rs -sSf | sh

Selecting the defaults should work for you.

Once installed, we can confirm that we're running the latest stable release.

rustup update stable

Note: We'll need to be running at least 1.60.0.

Prepare User Environment

Create a directory for the sui database

mkdir ~/suidb

Download the latest genesis.blob

wget -O ~/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

You can confirm the correctness of the genesis.blob by comparing its checksum.

Note: The below checksum is correct as of July 13, 2022

if awk '{print $1}') = "7445999610e415e864777089102a52642214e611cd402b6a81a707ce8f777eff" ; then echo "OK"; else echo "MISMATCHED"; fi;

If the above returns OK, you're good to go



Download & Install Mysten Sui Node Software

First we'll need to clone the Sui repository (please be sure that you're in your home directory if you're intending to follow this guide verbatim -- cd ~

git clone https://github.com/MystenLabs/sui.git --branch devnet</nowiki>

Once cloned, we'll change directories into the newly downloaded ~/sui directory

cd sui

Once inside the directory, we'll need to make some changes to the default configs.

If you're not following this doc verbatim, then you may need to modify the below example.

If you don't know what to put as $YOUR_USERNAME, then running the command whoamiwill tell you Go ahead and open the fullnode.yaml file with youre preferred text editor and make the following changes.

# Update this value to the location you want Sui to store its database
db-path: "/home/$YOUR_USERNAME/suidb"

network-address: "/dns/localhost/tcp/8080/http"
metrics-address: "0.0.0.0:9184"
json-rpc-address: "0.0.0.0:9000"

genesis:
  # Update this to the location of where the genesis file is stored
  genesis-file-location: "/home/$YOUR_USERNAME/genesis.blob"

Note: The above changes we're making to the metrics-address & json-rpc-address are to adjust the address that the host is listening on. For example, with the default values, it will only listen on the loopback address. (If you're not familiar with what a loopback address is, check out this doc) By adjusting it to 0.0.0.0, we are telling the application to listen on any destination address. That could be it's loopback, local, and public IP addresses.

Now that we have the necessary configurations in place, let's go ahead and run the application.

cd ~/sui && cargo run --release --bin sui-node -- --config-path fullnode.yaml

If all is well, we should see SuiNode started !

If we want to configure this as a service, let's go ahead and stop the application and create a systemd file.

Creating a Sui Node Service

Use your preferred text editor to create a new file in the /etc/systemd/system/ directory.

sudo nano /etc/systemd/system/mysten-sui-devnet.service copy, paste, and edit the below example:

[Unit]
Description=Mysten Sui Node
After=network.target auditd.service
Wants=network.target

[Service]
Type=simple
User=$YOUR_USERNAME
WorkingDirectory=/home/$YOUR_USERNAME/sui/
TimeoutStartSec=0
TimeoutStopSec=120
ExecStart=/home/$YOUR_USERNAME/sui/target/release/sui-node --config-path /home/$YOUR_USERNAME/sui/fullnode.yaml
Restart=always
RestartSec=20s

[Install]
WantedBy=multi-user.target
RequiredBy=swarm.service
Alias=mysten-sui-devnet.service

Save and exit from the editor.

Enable the service.

sudo systemctl enable mysten-sui-devnet.service

Start the service.

sudo systemctl start mysten-sui-devnet.service

Check the service logs.

sudo journalctl -f -u mysten-sui-devnet.service