Sui.

Post

Share your knowledge.

article banner.
harry phan.
Jul 08, 2025
Article

Sui CLI Cheat Sheet part 1

When developing smart contracts, it’s also essential to create a client that can interact with them. Beyond just pulling data from the blockchain, clients can also read from and execute functions defined by the contract’s available primitives.

One of the most convenient tools for this job is the Sui CLI, as it allows you to make command-line calls from virtually any programming language you choose to use for your client. In this guide, I’ll walk you through the key commands you’ll commonly use while working with Sui.

Getting Started with Sui CLI

To begin, you’ll need to install the Sui CLI on your machine. The installation process depends on your operating system and preferred package manager.

If you’re using a Unix-based system like macOS or Linux and have Homebrew installed, simply run the following command in your terminal to install the Sui CLI:

brew install sui

Execute this command on your terminal to install Sui CLI if you’re running Windows via Chocolatey:

choco install sui

Another route you can use is the Cargo (Rust package manager) route. First, you’ll need to have Rust installed (ships with cargo) and then execute this command to install Sui CLI.

cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui --features tracing

You can always execute the --version flag to verify your installation and check the version of Sui CLI you have installed.

sui --version

One flag you’ll use frequently is the—- help flag for the description of every command:

sui --help

It works with almost every command. It should be your mantle whenever you’re stuck:

Regardless of the command using -h or --help for help would always be handy.

Environment Management with Sui CLI

Every chain provides you with three fundamental networks: Mainnet, Testnet, and Devnet. You can also spawn a test chain locally to keep development in stealth mode.

Here’s the command you’ll execute to spawn a local network.

RUST_LOG="off,sui_node=info" sui start --with-faucet --force-regenesis

The command calls the Sui CLI binary to start a faucet service and generate a new genesis block without persisting the local network state.

Now, you can connect to the local network with the new-env command like this:

sui client new-env --alias local --rpc <rpc-url>
 
# sui client new-env --alias local --rpc http://127.0.0.1:9000

You can switch and activate any environment with this general command.

sui client switch --env <ENV_NAME>

Now, you can use this command to set the active environment to the new local environment you’ve created.

sui client switch --env local

The command switches the currently active environment to the local network you’re running.

Address and Key Management with Sui CLI

You’ll be switching keys as you deploy smart contracts over the Sui CLI, so here’s how to do that.

You can view the currently active address with the active-address command:

sui client active-address

You can list all the addresses in your client with the addresses command.

sui client addresses

You can switch addresses as you please with the --address flag before specifying the address.

Key Management with Sui CLI

When building your apps, for security or other reasons, you might want to run CLI commands to work with keys. The keytool command is

You can list all the keys in a keystore with the list command like this:

sui keytool list

You can generate keys with the generate command followed with a specification of the scheme.

sui keytool generate [OPTIONS] <KEY_SCHEME> [DERIVATION_PATH] [WORD_LENGTH]

You’re probably familiar with the ed25519 since that’s what most wallets use. Specify it like this.

sui keytool generate ed25519

You should get the output with the Sui address, mnemonic and other details.

sui keytool import "<MNEMONIC_PHRASE>" ed25519

When you’ve imported it, you can switch to the keypair and start sending transactions with it.

  • Sui
  • SDKs and Developer Tools
1
Share
Comments
.

Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

1172Posts3660Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignAugust