title |
---|
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:
- Meet the prerequisites.
- Install the binaries.
- Configure an Integrated Development Environment (IDE).
- Request SUI tokens to evaluate Devnet and Sui Wallet
- 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, thegit
command, and a GitHub account (see Prerequisites), you can download thesui-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
The following operating systems (OSes) have been tested and are supported for running Sui:
- Linux - Ubuntu version 18.04 (Bionic Beaver)
- macOS - macOS Monterey
- Microsoft Windows - Windows 11
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.
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.
Install the Sui binaries as described below.
Install the curl
command to download dependencies:
$ sudo apt install curl
Sui is written in Rust, and we are using Cargo toolchain version 1.60.0 or higher to build and manage the dependencies. You will need Cargo to build and install Sui on your machine.
See if you already have it by running:
$ which curl
And if not, get it with:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Then update it with:
$ rustup update stable
Download and install the git
command line interface
for your operating system.
Get the cmake
command to build Sui:
$ sudo apt install cmake
In Linux, also install:
libssl-dev
$ sudo apt install libssl-dev
libclang-dev
$ sudo apt install libclang-dev
In macOS, the general prerequisites outlined above are sufficient.
In Microsoft Windows, also install:
The LLVM Compiler Infrastructure
Tip: The installation progress might appear hanging if the
cmd.exe
window loses focus; press theenter
key in the command prompt fix the issue.
Known Issue: The
sui console
command does not work in PowerShell.
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:
$ echo $PATH
$ echo %PATH%
And ensure the .cargo/bin
directory appears. Access the help for any of these binaries by passing the --help
argument to it.
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.
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:
- Join the Sui Discord If you haven’t already.
- Identify your address through either the Sui Wallet Browser Extension or by running the command:
$ sui client active-address
- Request tokens in the #devnet-faucet channel using the syntax:
!faucet <YOUR_ADDRESS>
, for example:!faucet 0xd72c2c90ed9d923cb0ed2ca91db5be9e1c9b5ccb
- A bot on the channel will distribute tokens to you automatically.
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
See the Rust Crates in use at:
- https://mystenlabs.github.io/sui/ - the Sui blockchain
- https://mystenlabs.github.io/narwhal/ - the Narwhal and Tusk consensus engine
- https://mystenlabs.github.io/mysten-infra/ - Mysten Labs infrastructure
To contribute updates to Sui code, send pull requests our way.
NOTE: the above
git clone
command syncs with thedevnet
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 tomain
branch.
Continue your journey through: