Skip to main content

Sui CLI Cheat Sheet

The cheat sheet highlights common Sui CLI commands.

Addresses & Aliases

sui client active-addressGet the active address
sui client addressesList the addresses, their aliases, and the active address
sui client new-address ed25519Create a new address with ED25519 scheme
sui client new-address ed25519 MY_ALIASCreate a new address with ED25519 scheme and alias
sui client switch --address ADDRESSMake this the active address (accepts also an alias)
sui keytool convert PRIVATE_KEYConvert private key in Hex or Base64 to new format (Bech32 encoded 33 byte flag || private key starting with "suiprivkey")
sui keytool generate ed25519Generate a new keypair with ED25519 scheme and save it to file
sui keytool import INPUT KEY_SCHEMEAdd a new key to Sui CLI Keystore using either the input mnemonic phrase or a Bech32 encoded 33-byte flag || privkey starting with "suiprivkey"
sui keytool update-alias OLD_ALIAS NEW_ALIASUpdate the alias of an address

Faucet & Gas

sui client faucetGet a SUI coin from the faucet associated with the active network
sui client faucet --address ADDRESSGet a SUI coin for the address (accepts also an alias)
sui client faucet --url CUSTOM_FAUCET_URLGet a SUI coin from custom faucet
sui client gasList the gas coins for the active address
sui client gas ADDRESSList the gas coins for the given address (accepts also an alias)

Network Command Description

sui client active-envGet the active environment
sui client envsList defined environments
sui client new-env --rpc URL --alias ALIASCreate a new environment with URL and alias
sui client switch --env ENV_ALIASSwitch to the given environment
sui genesisBootstrap and initialize a new Sui network
sui startStart the local Sui network
sui-faucetStart a local faucet. Note this is a different binary

Create, Build, and Test a Move Project

sui move buildBuild the Move project in the current directory
sui move build --path PATHBuild the Move project from the given path
sui move migrate PATHMigrate to Move 2024 for the package at provided path
sui move new PROJECT_NAMECreate a new Move project in the given folder
sui move testTest the Move project in the current directory

Executing Transactions

sui client call \
  --package PACKAGE \
  --module MODULE \
  --function FUNCTION
Call a Move package
sui client merge-coins \
  --primary-coin COIN_ID \
  --coin-to-merge COIN_ID
Merge two coins
sui client split-coins \
  --coin-id COIN_ID \
  --amounts 1000
Split a coin into two coins: one with 1000 MIST and the rest

sui client pay-sui \
  --input-coins COIN_ID \
  --recipients ADDRESS \
  --amounts 100000000

Transfer 0.1 SUI to an address and use the same coin for gas
sui client transfer-sui \
  --sui-coin-object-id COIN_ID \
  --to ADDRESS
Transfer SUI object to an address and use the same coin for gas

Programmable Transaction Blocks (PTBs)

sui client ptb --move-call p::m::f "<type>" argsCall a Move function from a package and module
sui client ptb --make-move-vec "<u64>" "[1000,2000]"Make a Move vector with two elements of type u64

sui client ptb \
  --split-coins gas "[1000]" \
  --assign new_coins \
  --transfer-objects "[new_coins]" ADDRESS

Split a gas coin and transfer it to address
sui client ptb --transfer-objects "[object_id]" ADDRESS

Transfer an object to an address. Note that you can pass multiple objects in the array

sui client ptb \
  --move-call sui::tx_context::sender \
  --assign sender \
  --publish "." \
  --assign upgrade_cap \
  --transfer-objects "[upgrade_cap]" sender

Publish a Move package, and transfer the upgrade capability to sender