Skip to content

Latest commit

 

History

History
277 lines (197 loc) · 9.93 KB

install.md

File metadata and controls

277 lines (197 loc) · 9.93 KB
title
Install Sui

Welcome to the Sui development environment! This site is available in two versions in the menu at top left: the default and stable Devnet branch and the Latest build upstream main branch. Use the devnet version for app development on top of Sui. Use the Latest build main branch for contributing to the Sui blockchain itself. Always check and submit fixes to the main branch.

Summary

To immediately get started using Sui:

  1. Meet the prerequisites.
  2. Install the binaries.
  3. Configure an Integrated Development Environment (IDE).
  4. Request SUI tokens to evaluate Devnet and Sui Wallet
  5. Optionally, download the source code to have local access to examples and modify Sui itself.

Tip: Assuming you on macOS or Linux, have curl, Rust Cargo, the git command, and a GitHub account (see Prerequisites), you can download the sui-setup.sh script and run it to conduct all of the setup below, including removal of any existing sui assets. To use it, run these commands in a terminal:

$ curl https://raw.githubusercontent.com/MystenLabs/sui/main/doc/utils/sui-setup.sh -o sui-setup.sh
chmod 755 sui-setup.sh
./sui-setup.sh

Supported OSes

The following operating systems (OSes) have been tested and are supported for running Sui:

First install the General packages (plus Brew if on macOS), then install the OS-specific packages.

Prerequisites

At a minimum, you should have a machine capable of installing command line tools (namely, a terminal). First install the packages outlined this section. Then add the additional dependencies below for your operating system.

Here are the packages required by operating system:

Package/OS Linux macOS Windows 11
Curl X X X
Rust X X X
Git CLI X X X
CMake X X X
libssl-dev X
libclang-dev X
Brew X
C++ build tools X
LLVM Compiler X
Sui X X X

Follow the instructions below to install them. Then install the Sui binaries.

Finally, if you will be altering Sui itself, also obtain the Sui source code. For simplicity, we recommend installing in ~/sui or using an environment variable.

Important: You will need to restart your command prompt after installing these prerequisites for them to be available in your environment.

Brew

In macOS, first install Brew to install other packages:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

General packages

Ensure each of the packages below exist on each OS:

Curl

Confirm that you can run the curl command to download dependencies.

See whether you already have curl installed by running:

$ which curl

And if you see no output path, install it with:

Linux

$ apt install curl

macOS

$ brew install curl

Microsoft Windows Download and install from: https://curl.se/windows/

Rust

Sui is written in Rust, and we are 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.

Get rustup to install Rust and Cargo:

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

Then update the packages with:

$ rustup update stable

Warning: If you run into issues, you may un-install Rust and Cargo with:

$ rustup self uninstall

And then start the Rust install over. For more details, see: https://www.rust-lang.org/tools/install

Git CLI

Download and install the git command line interface for your operating system.

CMake

Get the cmake command to build Sui:

Linux

$ apt install cmake

macOS

$ brew install cmake

Microsoft Windows

Download and install from: https://cmake.org/download/

If you run into issues, follow this detailed CMake Installation tutorial.

Linux-specific

In Linux, install:

libssl-dev

$ apt install libssl-dev

libclang-dev

$ apt install libclang-dev

macOS-specific

In macOS, other than the aforementioned Brew package manager, the general prerequisites are sufficient.

Microsoft Windows-specific

In Microsoft Windows 11, also install:

For Windows on ARM64 only - Visual Studio 2022 Preview

C++ build tools

The LLVM Compiler Infrastructure

Tip: The installation progress might appear hanging if the cmd.exe window loses focus; press the enter key in the command prompt fix the issue.

Known Issue: The sui console command does not work in PowerShell.

Binaries

To develop in Sui, you will need the Sui binaries. After installing cargo, run:

$ cargo install --locked --git https://github.com/MystenLabs/sui.git --branch "devnet" sui sui-gateway

This will put the following binaries in your PATH (ex. under ~/.cargo/bin) that provide these command line interfaces (CLIs):

  • sui - The Sui CLI tool contains subcommands for enabling genesis of validators and accounts, starting the Sui network, and building and testing Move packages, as well as a client for interacting with the Sui network.
  • rpc-server - run a local Sui gateway service accessible via an RPC interface.

Confirm the installation with:

macOS and Linux

$ echo $PATH

Windows

$ echo %PATH%

And ensure the .cargo/bin directory appears. Access the help for any of these binaries by passing the --help argument to it.

Important: Make sure your entire toolchain stays up-to-date. If you encounter issues building and installing the Sui binaries, update all packages above and re-install.

Integrated Development Environment

For Move development, we recommend the Visual Studio Code (vscode) IDE with the Move Analyzer language server plugin installed:

$ cargo install --git https://github.com/move-language/move move-analyzer --features "address20"

Then follow the Visual Studio Marketplace instructions to install the Move Analyzer extension. (The cargo install command for the language server is broken there; hence, we include the correct command above.)

See more IDE options in the Awesome Move docs.

SUI tokens

To experiment with Devnet or use the Sui Wallet Browser Extension, you will need SUI tokens. These coins have no financial value and will disappear each time we reset the network.

To request SUI test tokens:

  1. Join the Sui Discord If you haven’t already.
  2. Identify your address through either the Sui Wallet Browser Extension or by running the following command and electing to connect to a Sui RPC server if prompted:
    $ sui client active-address
  3. Request tokens in the #devnet-faucet channel using the syntax: !faucet <YOUR_ADDRESS>, for example:
    !faucet 0xd72c2c90ed9d923cb0ed2ca91db5be9e1c9b5ccb
  4. A bot on the channel will distribute tokens to you automatically.

Source code

If you need to download and understand the Sui source code: https://github.com/MystenLabs/sui

Clone the Sui repository:

$ git clone https://github.com/MystenLabs/sui.git --branch devnet

You can start exploring Sui's source code by looking into the following primary directories:

  • sui - the Sui CLI binary
  • sui_programmability - Sui's Move language integration also including games and other Move code examples for testing and reuse
  • sui_core - authority server and Sui Gateway
  • sui-types - coins, gas, and other object types
  • explorer - object explorer for the Sui network
  • sui-network - networking interfaces

Rustdoc

See the Rust Crates in use at:

Help

To contribute updates to Sui code, send pull requests our way.

NOTE: the above git clone command syncs with the devnet branch, which makes sure the source code is compatible with our Devnet. If you want to run network locally using the latest version and don't need to interact with our Devnet, you should switch to main branch.

Next steps

Continue your journey through: