How To Deploy A Sui Node

How To Deploy A Sui Node
How to Deploy a Sui Node

Running a node has become an integral part of the blockchain, and Sui is no exception. Today's article will give you in-depth insights into the Sui node overview, prerequisites, and installation on Linux.

What is a Sui Node?

There are two primary types of nodes on the Sui network:

  • Full nodes: Full nodes are responsible for validating blockchain activities, including transactions, checkpoints, and epoch changes. They also store and service queries for the blockchain state and history. Full nodes are essential for the security and stability of the Sui network.
  • Validator nodes: Validator nodes are responsible for servicing and processing transactions. Staking Sui tokens with validators is also an easy way to interact with the network while earning rewards.

When a validator commits a new set of transactions (or a block of transactions), the validator pushes that block to all connected Full nodes that then service the queries from clients. Validator nodes are also responsible for securing the network by participating in the consensus process.

Sui Node Requirements

To set up your Sui Full node, adhere to the guidelines below.

Hardware Requirements

For optimal performance, it is suggested to meet the following minimum hardware specifications for your Sui Full node:

  • CPUs: 8 physical cores or 16 vCPUs.
  • RAM: 128 GB.
  • Storage (SSD): 4 TB NVMe drive.

Software Requirements

Sui recommends running its Full nodes on Linux, specifically supporting the Ubuntu and Debian distributions. Alternatively, you have the option to run a Sui Full node on macOS.

Don't forget to keep your Rust installation up to date. Check out Sui Docs for the latest updates on node requirements.

How to Deploy a Sui Node

Step 1: Install Linux Dependencies

Run the following command to install the required Linux dependencies:

sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
tzdata \
libprotobuf-dev \
ca-certificates \
build-essential \
libssl-dev \
libclang-dev \
pkg-config \
openssl \
protobuf-compiler \
git \
clang \
cmake

Step 2: Configure a Full Node

You can configure a Sui Full node either using Docker or by building from source.

Using Docker Compose:

Refer to the Full node Docker Readme for instructions on setting up a Sui Full node using Docker, including resetting the environment.

Setting up a Local Sui Repository:

  • Fork the Sui repository on GitHub and clone it to your local machine:
git clone https://github.com/<YOUR-GITHUB-USERNAME>/sui.git
cd sui
  • Set up the Sui repository as a git remote:
git remote add upstream https://github.com/MystenLabs/sui
  • Check out the branch associated with the desired network version (e.g., devnet):
git checkout --track upstream/<BRANCH-NAME>

Setting up a Full Node from Source:

  1. Open a Terminal or Console in the sui directory you downloaded earlier.
  2. Install the required prerequisites.
  3. Create a copy of the Full node YAML template:
cp crates/sui-config/data/fullnode-template.yaml fullnode.yaml

Download the appropriate genesis blob for the network to use.

For Devnet:

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

For Testnet:

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

For Mainnet:

curl -fLJO https://github.com/MystenLabs/sui-genesis/raw/main/mainnet/genesis.blob
  1. If you're setting up a Testnet or Mainnet Full node, edit the fullnode.yaml file to include peer nodes for state synchronization.
  2. Optionally, configure custom paths and aggressive pruning settings in the fullnode.yaml file.

Starting Services:

  1. Open a Terminal or Console in the sui directory.
  2. Start the Sui Full node:
cargo run --release --bin sui-node -- --config-path fullnode.yaml

Optionally, set up JSON-RPC notifications using websockets.

If your setup is successful, your Sui Full node is now connected to the appropriate network.

Your Full node serves the read endpoints of the Sui JSON-RPC API at: http://127.0.0.1:9000.

Troubleshooting:

  • If you encounter a -lpq error, install the libpq library using sudo apt-get install libpq-dev on Linux or brew install libpq on MacOS.
  • If you face an error related to binding at port 9184, update the metrics address in your fullnode.yaml file to use port 9180:
metrics-address: "0.0.0.0:9180"

Step 3: Use Sui Explorer with Your Full Node

You can connect Sui Explorer to your local Full node and view synced transactions. Follow the provided instructions.

Step 4: Monitoring

Monitor your Full node using the instructions for logging, tracing, metrics, and observability.

Step 5: Updating Your Full Node

When Sui releases a new version, update your Full node to ensure compatibility with the network it connects to. For example, update the Sui Testnet version if you're using the Testnet.

Using Docker Compose

Follow the instructions to reset the environment using:

docker-compose down --volumes

Updating from Source

  • Shut down your running Full node.
  • Navigate to your local Sui repository:

cd sui

  • Remove the database and genesis.blob file:

rm -r suidb genesis.blob

  • Fetch the source from the latest release:

git fetch upstream

  • Reset your branch:

git checkout -B <BRANCH-NAME> --track upstream/<BRANCH-NAME>

  • Download the latest genesis blob as needed.
  • Update your fullnode.yaml configuration file if necessary.
  • Restart your Sui Full node:

cargo run --release --bin sui-node -- --config-path fullnode.yaml

Your Full node will start at: http://127.0.0.1:9000.

Read more