Announcing Sui Incentivized Testnet: Get ready for the Sui-nami in August. Read more

Install Sui

Welcome to the Sui development environment! Note, this site is built from the upstream main branch and therefore will contain updates not yet found in devnet. The instructions here recommend use of devnet as the latest stable release. To contribute to Sui, instead use the main branch.

To immediately get started using Sui:

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

Tip: Assuming you have Rust Cargo, the git command, and a GitHub account (see prerequisites(#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

Prerequisites

At a minimum, you should have a machine capable of installing command line tools. These prerequisites are broken down into the essential tools you need to work in Sui and the advanced items needed for Sui source code development.

Essential

Sui is written in Rust, and we are using Cargo to build and manage the dependencies. You will need Cargo to build and install Sui on your machine.

To run Sui, you will need to install:

  1. A command line interface, as virtually everything done here is done by CLI.
  2. The curl command to download other tools, which you can confirm with:
    $ which curl
    
  3. The Rust and Cargo toolchain version 1.60.0 or higher; update it with:
    $ rustup update stable
    
  4. The cmake command.
  5. The Sui binaries.

Advanced

In addition, to conduct advanced work such as altering Sui itself, also obtain:

  1. The git command line interface.
  2. The Sui source code; for simplicity, we recommend installing in ~/sui or using an environment variable

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-json-rpc

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:

$ echo $PATH

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

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

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.

Source code

If you need to download and understand the Sui source code, 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

And see the Rust Crates in use at:

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 could switch to main branch.

Next steps

Continue your journey through:

Last update 6/30/2022, 6:01:14 PM

Contributor(s)