sui-client

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Client Configuration & Tokens

客户端配置与代币

MCP tool: When available in your environment, also query the Sui documentation MCP server (
https://sui.mcp.kapa.ai
) for up-to-date answers. Use it for verification and for details not covered by these reference files.
Source constraint: All information sourced exclusively from docs.sui.io.
MCP工具: 如果你的环境中可用,也可查询Sui文档MCP服务器(
https://sui.mcp.kapa.ai
)获取最新答案。用它来验证信息,或获取这些参考文件未涵盖的细节。
来源限制: 所有信息均独家来自docs.sui.io

Configuring the Sui client

配置Sui客户端

First-time setup

首次设置

Running
sui client
for the first time prompts you to create a configuration file. Accept the default (press Enter or type
Y
). You can skip the prompt with
sui client -y
.
This generates:
  • A new key pair and address
  • A 12-word recovery phrase (displayed once, never stored — save it immediately)
  • A
    client.yaml
    configuration file
首次运行
sui client
时,系统会提示你创建配置文件。接受默认设置(按回车键或输入
Y
)。你也可以使用
sui client -y
跳过提示。
此操作会生成:
  • 一对新的密钥和地址
  • 一个12词助记词(仅显示一次,不会存储——请立即保存)
  • 一个
    client.yaml
    配置文件

Configuration file

配置文件

Sui stores its configuration at:
  • macOS/Linux:
    ~/.sui/sui_config/client.yaml
  • Windows:
    %USERPROFILE%\.sui\sui_config\client.yaml
The file contains:
  • Network environment connections (Mainnet, Testnet, Devnet, Localnet)
  • The active environment (default: Testnet)
  • The active address
  • The keystore file path
Sui的配置存储在以下位置:
  • macOS/Linux:
    ~/.sui/sui_config/client.yaml
  • Windows:
    %USERPROFILE%\.sui\sui_config\client.yaml
该文件包含:
  • 网络环境连接(主网、测试网、开发网、本地网)
  • 活跃环境(默认:测试网)
  • 活跃地址
  • 密钥库文件路径

Managing environments and addresses

管理环境与地址

CommandPurpose
sui client active-env
Show the current network
sui client active-address
Show the current address
sui client envs
List all configured environments
sui client switch --env devnet
Switch to a different network
sui client switch --address <ADDRESS>
Switch to a different address
sui client new-address ed25519
Create a new address
sui client addresses
List all local addresses with aliases
sui client balance
Check SUI token balance
sui client gas
List gas coin objects
命令用途
sui client active-env
查看当前网络
sui client active-address
查看当前地址
sui client envs
列出所有已配置的环境
sui client switch --env devnet
切换到其他网络
sui client switch --address <ADDRESS>
切换到其他地址
sui client new-address ed25519
创建新地址
sui client addresses
列出所有带别名的本地地址
sui client balance
查询SUI代币余额
sui client gas
列出Gas代币对象

Key storage

密钥存储

Private keys are stored in a separate file:
  • macOS/Linux:
    ~/.sui/sui_config/sui.keystore
  • Windows:
    %USERPROFILE%\.sui\sui_config\sui.keystore
This file contains Base64-encoded private keys. It is not the same as your machine's system keystore.
私钥存储在单独的文件中:
  • macOS/Linux:
    ~/.sui/sui_config/sui.keystore
  • Windows:
    %USERPROFILE%\.sui\sui_config\sui.keystore
该文件包含Base64编码的私钥,与你的机器系统密钥库不同。

Recovery

恢复地址

To recover an address from a recovery phrase:
bash
sui keytool import '<12-WORD-PHRASE>' ed25519
The entire phrase must be in single quotes and in the correct order.
要通过助记词恢复地址:
bash
sui keytool import '<12-WORD-PHRASE>' ed25519
整个助记词必须用单引号括起来,且顺序正确。

Getting SUI tokens

获取SUI代币

Development on Testnet and Devnet requires SUI tokens for gas. Tokens on these networks are free and hold no monetary value.
在测试网(Testnet)和开发网(Devnet)上进行开发需要SUI代币作为Gas。这些网络上的代币是免费的,不具备货币价值。

Faucet methods

水龙头获取方式

MethodHow
Web faucetVisit
faucet.sui.io
, enter your address, select network, click Request SUI
CLI (Devnet/Localnet only)
sui client faucet
— works on Devnet and Localnet only, not Testnet
TypeScript SDK
requestSuiFromFaucetV2()
from
@mysten/sui/faucet
DiscordJoin the Sui Discord, use
!faucet <ADDRESS>
in
#devnet-faucet
or
#testnet-faucet
Community faucetsN1Stake faucet, SuiLearn faucet (separate rate limits)
IMPORTANT:
sui client faucet
only works on Devnet and Localnet. It does NOT work on Testnet. For Testnet tokens, use the web faucet at
faucet.sui.io
or another method above. NEVER suggest
sui client faucet
for Testnet.
Faucets are rate-limited. If you hit a limit, wait or try a different faucet.
方式操作步骤
网页水龙头访问
faucet.sui.io
,输入你的地址,选择网络,点击“Request SUI”
CLI(仅开发网/本地网)
sui client faucet
— 仅适用于开发网和本地网,不适用于测试网
TypeScript SDK使用
@mysten/sui/faucet
中的
requestSuiFromFaucetV2()
Discord加入Sui Discord服务器,在
#devnet-faucet
#testnet-faucet
频道中使用
!faucet <ADDRESS>
命令
社区水龙头N1Stake水龙头、SuiLearn水龙头(有单独的速率限制)
重要提示:
sui client faucet
仅适用于开发网和本地网,不适用于测试网。若要获取测试网代币,请使用网页水龙头
faucet.sui.io
或上述其他方式。切勿向用户建议在测试网使用
sui client faucet
水龙头有速率限制。如果达到限制,请等待一段时间或尝试其他水龙头。

Coin management

代币管理

If you have many small SUI coin objects but no single coin large enough for gas, merge them using
sui client ptb
:
bash
undefined
如果你有许多小额SUI代币对象,但没有单个代币足够支付Gas费用,可以使用
sui client ptb
合并它们:
bash
undefined

Merge one coin into another

将一个代币合并到另一个中

sui client ptb
--merge-coins @0xPRIMARY_COIN_ID "[@0xCOIN_TO_MERGE_ID]"
sui client ptb
--merge-coins @0xPRIMARY_COIN_ID "[@0xCOIN_TO_MERGE_ID]"

Merge multiple coins at once

一次性合并多个代币

sui client ptb
--merge-coins @0xPRIMARY_COIN_ID "[@0xCOIN_A, @0xCOIN_B, @0xCOIN_C]"

Use `sui client ptb` for all transaction operations from the CLI. Avoid legacy helpers like `sui client merge-coin` — they are less composable and may be deprecated. See the `ptbs` skill's `cli.md` for more patterns.
sui client ptb
--merge-coins @0xPRIMARY_COIN_ID "[@0xCOIN_A, @0xCOIN_B, @0xCOIN_C]"

所有CLI交易操作都使用`sui client ptb`。避免使用旧版辅助命令如`sui client merge-coin`——它们的可组合性较差,可能会被弃用。更多模式请参考`ptbs`技能的`cli.md`文件。

Verify balance

验证余额

bash
sui client balance
Or use explorers: SuiVision (
suivision.xyz
) or Suiscan (
suiscan.xyz
).
bash
sui client balance
或使用浏览器工具:SuiVision(
suivision.xyz
)或Suiscan(
suiscan.xyz
)。

Explorers and data tools

浏览器与数据工具

Use SuiVision (
suivision.xyz
) or Suiscan (
suiscan.xyz
) to inspect transactions, objects, addresses, and token balances. Sui provides a GraphQL RPC for rich data queries per network. Use
sui replay
(CLI built-in) to locally re-execute past transactions for debugging.
使用SuiVision(
suivision.xyz
)或Suiscan(
suiscan.xyz
)查看交易、对象、地址和代币余额。Sui为每个网络提供GraphQL RPC用于复杂数据查询。使用内置CLI命令
sui replay
可在本地重新执行过往交易以进行调试。

Rules

规则

  • Submit writes and reads to the same fullnode for consistency.
  • Let wallets manage gas budget, gas price, and coin selection. Do not hardcode gas budgets in frontends.
  • Use
    sui client ptb
    for all CLI transaction operations instead of legacy single-purpose commands (
    merge-coin
    ,
    split-coin
    ,
    transfer
    , etc.).
  • 向同一个全节点提交写入和读取请求以保证一致性。
  • 让钱包管理Gas预算、Gas价格和代币选择。不要在前端硬编码Gas预算。
  • 所有CLI交易操作使用
    sui client ptb
    ,而非旧版单一用途命令(
    merge-coin
    split-coin
    transfer
    等)。