设置

在项目的这个阶段,我们的 Walrus 代码尚未公开。相反,我们提供了适用于 macOS(Intel 和 Apple CPU)和 Ubuntu 的预编译 walrus 客户端二进制文件,支持不同的使用模式(请参阅下一章)。本章介绍了 Walrus 客户端的先决条件安装配置

先决条件:Sui 钱包和测试网 SUI

Quick wallet setup

If you just want to set up a new SUI wallet for Walrus, you can skip this section and use the walrus generate-sui-wallet command after installing Walrus. In that case, make sure to set the wallet_config parameter in the Walrus configuration to the newly generated wallet.

与 Walrus 交互需要一个有效的 Sui 测试网钱包和一些 SUI 代币。设置此钱包的正常方法是通过 Sui CLI;请参阅 Sui 文档中的安装说明

安装 Sui CLI 后,您需要通过运行 sui client 来设置测试网钱包,这会提示您设置新配置。请确保将其指向 Sui 测试网,您可以使用 https://fullnode.testnet.sui.io:443 的全节点。有关更多详细信息,请参见此处

如果您已经配置了 Sui 钱包,可以直接设置测试网环境(如果您还没有),

sui client new-env --alias testnet --rpc https://fullnode.testnet.sui.io:443

并将活动环境切换到它:

sui client switch --env testnet

之后,您应该会得到类似的内容(除了 testnet 行之外的所有内容都是可选的):

$ sui client envs ╭──────────┬─────────────────────────────────────┬────────╮ │ alias │ url │ active │ ├──────────┼─────────────────────────────────────┼────────┤ │ devnet │ https://fullnode.devnet.sui.io:443 │ │ │ localnet │ http://127.0.0.1:9000 │ │ │ testnet │ https://fullnode.testnet.sui.io:443 │ * │ │ mainnet │ https://fullnode.mainnet.sui.io:443 │ │ ╰──────────┴─────────────────────────────────────┴────────╯

最后,确保您至少有一个至少包含 1 SUI 的 gas 代币。您可以从测试网水龙头获得一个:

sui client faucet

几秒钟后,您应该会看到您的新 SUI 代币:

$ sui client gas ╭─────────────────┬────────────────────┬──────────────────╮ │ gasCoinId │ mistBalance (MIST) │ suiBalance (SUI) │ ├─────────────────┼────────────────────┼──────────────────┤ │ 0x65dca966dc... │ 1000000000 │ 1.00 │ ╰─────────────────┴────────────────────┴──────────────────╯

如果没有指定其他路径,Walrus 将使用系统范围的钱包。如果您想使用不同的 Sui 钱包,可以在 Walrus 配置文件 中指定,或在运行 CLI 时指定。

安装

我们目前提供适用于 macOS(Intel 和 Apple CPU)、Ubuntu 和 Windows 的 walrus 客户端二进制文件:

操作系统CPU架构
UbuntuIntel 64位ubuntu-x86_64
UbuntuIntel 64位(通用)ubuntu-x86_64-generic
MacOSApple Siliconmacos-arm64
MacOSIntel 64位macos-x86_64
WindowsIntel 64位windows-x86_64.exe

Windows

We now offer a pre-built binary also for Windows. However, most of the remaining instructions assume a UNIX-based system for the directory structure, commands, etc. If you use Windows, you may need to adapt most of those.

您可以从我们的 Google Cloud Storage (GCS) 存储桶下载最新版本(正确设置 $SYSTEM 变量):

SYSTEM= # 将此设置为您的系统:ubuntu-x86_64, ubuntu-x86_64-generic, macos-x86_64, macos-arm64, windows-x86_64.exe curl https://storage.googleapis.com/mysten-walrus-binaries/walrus-testnet-latest-$SYSTEM -o walrus chmod +x walrus

在 Ubuntu 上,您通常应使用 ubuntu-x86_64 版本。然而,这与旧硬件和某些虚拟化环境不兼容(会抛出 "Illegal instruction (core dumped)" 错误);在这些情况下,您可以使用 ubuntu-x86_64-generic 版本。

为了能够简单地以 walrus 运行它,请将二进制文件移动到包含在您的 $PATH 环境变量中的任何目录。标准位置是 /usr/local/bin/$HOME/bin/$HOME/.local/bin/

Note

Previously, this guide recommended placing the binary in $HOME/.local/bin/. If you install the latest binary somewhere else, make sure to clean up old versions. You can find the binary in use by calling which walrus and its version through walrus -V.

完成此操作后,您应该能够在终端中简单地键入 walrus。例如,您可以获取使用说明(有关详细信息,请参见下一章):

$ walrus --help Walrus client Usage: walrus [OPTIONS] <COMMAND> Commands: ⋮

Tip

Our latest Testnet Walrus binaries are also available on Walrus itself, namely on https://bin.blob.store, for example, https://bin.blob.store/walrus-testnet-latest-ubuntu-x86_64.

以前的版本(可选)

除了最新版本的 walrus 二进制文件外,GCS 存储桶还包含以前的版本。XML 格式的概览可在 https://storage.googleapis.com/mysten-walrus-binaries/ 获得。

配置

Walrus 客户端需要了解存储 Walrus 系统和质押信息的 Sui 对象,请参阅开发者指南。这些需要在文件 ~/.config/walrus/client_config.yaml 中配置。

当前的 Testnet 部署使用以下对象:

system_object: 0x50b84b68eb9da4c6d904a929f43638481c09c03be6274b8569778fe085c1590d staking_object: 0x37c0e4d7b36a2f64d51bba262a1791f844cfd88f31379f1b7c04244061d43914 exchange_object: 0x0e60a946a527902c90bbc71240435728cd6dc26b9e8debc69f09b71671c3029b

获取最新配置的最简单方法是从 https://github.com/MystenLabs/walrus-docs/blob/main/docs/client_config.yaml 下载。

自定义路径(可选)

默认情况下,Walrus 客户端将在当前目录、$XDG_CONFIG_HOME/walrus/~/.config/walrus/~/.walrus/ 中查找 client_config.yaml(或 client_config.yml)配置文件。但是,您可以将文件放置在任何位置并命名为任何您喜欢的名称;在这种情况下,您需要在运行 walrus 二进制文件时使用 --config 选项。

高级配置(可选)

配置文件当前支持以下参数:

# 这些是唯一的必填字段。这些对象特定于特定的 Walrus # 部署,但不会随时间变化。 system_object: 0x50b84b68eb9da4c6d904a929f43638481c09c03be6274b8569778fe085c1590d staking_object: 0x37c0e4d7b36a2f64d51bba262a1791f844cfd88f31379f1b7c04244061d43914 exchange_object: 0x0e60a946a527902c90bbc71240435728cd6dc26b9e8debc69f09b71671c3029b # 您可以在此处定义 Sui 钱包配置的自定义路径。如果未设置或为 `null`, # 钱包将从 `./sui_config.yaml`(相对于您的当前工作目录)或 # 系统范围的钱包 `~/.sui/sui_config/client.yaml` 中配置,按此顺序。 wallet_config: null # 以下参数可用于调整客户端的网络行为。玩弄这些值没有风险。 # 在最坏的情况下,您可能无法存储/读取 # blob,因为超时或其他网络错误。 communication_config: max_concurrent_writes: null max_concurrent_sliver_reads: null max_concurrent_metadata_reads: null max_concurrent_status_reads: null max_data_in_flight: null reqwest_config: total_timeout: secs: 30 nanos: 0 pool_idle_timeout: null http2_keep_alive_timeout: secs: 5 nanos: 0 http2_keep_alive_interval: secs: 30 nanos: 0 http2_keep_alive_while_idle: true request_rate_config: max_node_connections: 10 max_retries: 5 min_backoff: secs: 2 nanos: 0 max_backoff: secs: 60 nanos: 0 disable_proxy: false disable_native_certs: false sliver_write_extra_time: factor: 0.5 base: secs: 0 nanos: 500000000

Important

If you specify a wallet path, make sure your wallet is set up for Sui Testnet.

Testnet WAL 水龙头

Walrus Testnet 使用 Testnet WAL 代币来购买存储和质押。Testnet WAL 代币没有价值,可以通过以下命令以 1:1 的比例兑换一些 Testnet SUI 代币,这些代币也没有价值:

walrus get-wal

您可以通过检查 Sui 余额来确认您是否已收到 Testnet WAL:

sui client balance ╭─────────────────────────────────────────╮ │ Balance of coins owned by this address │ ├─────────────────────────────────────────┤ │ ╭─────────────────────────────────────╮ │ │ │ coin balance (raw) balance │ │ │ ├─────────────────────────────────────┤ │ │ │ Sui 8869252670 8.86 SUI │ │ │ │ WAL 500000000 0.50 WAL │ │ │ ╰─────────────────────────────────────╯ │ ╰─────────────────────────────────────────╯

默认情况下,0.5 SUI 兑换 0.5 WAL,但可以使用 --amount 选项兑换不同数量的 SUI(值以 MIST/FROST 为单位),并且可以通过 --exchange-id 选项使用特定的 SUI/WAL 兑换对象。walrus get-wal --help 命令提供了有关这些的更多信息。