LinuxCommandLibrary

sui-client

Interact with the Sui blockchain

TLDR

Create a new address with the ED25519 scheme

$ sui client new-address ed25519 [address-alias]
copy

Create a new testnet environment with an RPC URL and alias
$ sui client new-env --rpc https://fullnode.testnet.sui.io:443 --alias testnet
copy

Switch to the address of your choice (accepts also an alias)
$ sui client switch --address [address-alias]
copy

Switch to the given environment
$ sui client switch --env [env-alias]
copy

Publish a smart contract
$ sui client publish [package-path]
copy

Interact with the Sui faucet
$ sui client faucet [subcommand]
copy

List the gas coins for the given address (accepts also an alias)
$ sui client gas [address]
copy

Create, sign, and execute programmable transaction blocks
$ sui client ptb [options] [subcommand]
copy

SYNOPSIS

sui-client [GLOBAL_OPTIONS] [SUBCOMMAND_OPTIONS] [ARGS]

Examples of common subcommands:
sui-client active-address
sui-client gas
sui-client object
sui-client call --function --module --package --args --gas-budget
sui-client transfer --to-address

--amount --sui-coin --gas-budget

PARAMETERS

--client.config
    Specify the path to the client configuration file, typically a YAML file.

--json
    Output results in JSON format, which is useful for scripting and programmatic parsing.

--rpc
    Override the default RPC server URL to connect to a specific Sui network endpoint.

--faucet
    Override the default faucet server URL for requesting test SUI tokens.

--gas-budget
    Set the maximum gas budget for a transaction in MIST (1 SUI = 1,000,000,000 MIST).

--sign
    Sign the transaction without executing it, returning the signed transaction data.

--serialize-output
    Serialize the output for programmatic use, often in conjunction with --json.

--to-address


    The recipient's Sui address for transfer operations.

--sui-coin
    The object ID of the SUI coin to be used for gas payment or transfer.

--amount
    The amount of SUI or other asset to transfer or interact with.

--package
    The package ID of the Move smart contract to interact with (e.g., for calling functions).

DESCRIPTION

The sui-client command-line interface (CLI) is an essential tool for developers and users to interact with the Sui blockchain. It provides comprehensive functionalities for managing Sui addresses, querying the blockchain state (including objects, transactions, and events), publishing and executing Move smart contracts, and securely transferring assets. It connects to a Sui RPC endpoint, enabling a wide range of operations such as gas management, object manipulation, transaction signing, and network synchronization. With its modular design, supporting various subcommands for specific tasks, sui-client serves as a pivotal component for participation and development within the Sui ecosystem.

CAVEATS

Network Connectivity: Requires a stable internet connection to communicate with Sui RPC endpoints.
Configuration: Proper client configuration, typically in `client.yaml`, is crucial for connecting to the correct network (devnet, testnet, mainnet) and managing cryptographic keys.
Gas Fees: All transactions on the Sui network incur gas fees, which must be managed through your wallet. Insufficient gas will lead to transaction failures.
Key Management: Secure handling of private keys and mnemonic phrases is paramount, as they control access to your funds and assets on the Sui network.

NETWORKS AND CONFIGURATION

sui-client typically reads its configuration from a `client.yaml` file, which specifies the RPC endpoint, faucet URL, and the active keypair. Users can switch between different Sui networks (e.g., devnet, testnet, mainnet) by modifying this configuration file or by using specific command-line flags like `--rpc` and `--faucet`.

MOVE LANGUAGE INTERACTION

A core capability of sui-client is its deep integration with the Move programming language. It allows users to compile, publish, and interact with Move smart contracts deployed on the Sui network, facilitating the development and deployment of decentralized applications (dApps) and custom assets.

HISTORY

The sui-client command is an integral part of the Sui blockchain ecosystem, originally developed by Mysten Labs. It was introduced alongside the initial releases of the Sui network, evolving significantly with the network's development from its early devnet and testnet phases to its mainnet launch. Its design prioritizes ease of interaction for both developers building on Sui and users managing their digital assets within the ecosystem.

SEE ALSO

curl(1): Used for direct interaction with RPC endpoints., jq(1): Useful for parsing JSON output from `sui-client --json`., git(1): Often used to clone Sui source code or Move projects.

Copied to clipboard