Sui CLI Cookbook
The sui CLI is the primary command-line interface for interacting with Sui nodes, wallets, and developer tools. This cookbook provides quick, copy-paste examples for common tasks.
Install
Homebrew (macOS / Linux / WSL)
brew install suiChocolatey (Windows)
choco install suiInstall with suiup
suiup is a tool similar to rustup. Install it and then install sui:
curl -sSfL https://raw.githubusercontent.com/Mystenlabs/suiup/main/install.sh | sh
suiup install suiAlternatively, download releases from the Sui GitHub Releases.
Cookbook
Below are unordered, practical commands you can copy and paste. For many commands, you may need to run sui client once and accept prompts to create the configuration and an initial keypair.
Note
Sui’s documentation is sometimes inconsistent about RPC endpoints. The canonical fullnode RPC endpoints are:
- Devnet:
https://fullnode.devnet.sui.io:443 - Testnet:
https://fullnode.testnet.sui.io:443 - Mainnet:
https://fullnode.mainnet.sui.io:443
[!INFORMATION]
Many commands accept --help for usage (for example sui client --help). To get JSON output for scripting, append --json.
Creating Accounts
Create an ed25519 account (alias alice):
sui client new-address ed25519 aliceCreate secp256k1 and secp256r1 accounts:
sui client new-address secp256k1 bob
sui client new-address secp256r1 charlieRequest faucet funds (testnet/devnet or local faucet):
sui client faucet --address aliceCheck an account balance:
sui client balance aliceStarting a Local Network
Start a local network (example with faucet):
RUST_LOG="off,sui_node=info" sui start --with-faucet --force-regenesisAdd a local RPC endpoint and switch the CLI to it:
sui client new-env --alias localnet --rpc http://localhost:9000
sui client switch --env localnetRequest funds from the local faucet:
sui client faucet --address aliceUsing dApps with Localnet
Nightly App and other wallets (e.g., Surf) can connect to a local network. In Nightly, add https://localhost:9000 (or http://localhost:9000 if the dApp supports it) as a custom RPC endpoint.
Quick tips
- Use
--helpon anysuisubcommand for details (for example,sui start --help). - Use
--jsonwhere available to integratesuioutput into scripts.