gaiad 二进制文件并运行 CLI。将该二进制文件安装到服务器后,你可以作为 全节点 或 验证者 参与主网。
构建要求
目前,SDK 已完整支持在 Linux 发行版上安装。为便于说明,本文将使用Ubuntu 22.04 LTS。你也可以在 Unix 系统上安装 gaiad,而 Windows 可能需要额外的、未受支持的第三方安装方式。下面列出了全新安装所需的全部步骤。
构建工具
安装make 和 gcc。
Ubuntu:
安装 Go
我们建议使用以下两种方式之一安装 Go。请查看官方文档和 Go 安装程序,以获取适合你操作系统的正确下载项。或者,你也可以通过命令行自行安装 Go。下文列出了标准的默认安装位置,但你也可以按需自定义。 自 Gaia v18 引入 CosmWasm 以来,建议在启用CGO 的情况下构建二进制文件,只需在构建前于终端中设置 CGO_ENABLED=1。
由于依赖问题,Windows 上不支持构建 gaiad 二进制文件。
Go 二进制下载
Ubuntu:
在撰写本文时,最新版本为 1.23.6。我们将下载 tarball,将其解压到 /usr/local,并把 GOROOT 导出到 $PATH 中。
GOPATH 添加到你的 $PATH 环境变量中。如果你不确定它在哪里,请运行 go env GOPATH。这样我们就能在下一步运行 gaiad 二进制文件。如果你不确定如何设置 $PATH,请参考这些说明。
安装二进制文件
接下来,我们来安装最新版 Gaia。请确保你已git checkout 到正确的发布版本。
LDFLAGS。
注意:如果你在这一步仍然遇到问题,请检查是否安装了最新稳定版的 GO。这将安装
gaiad 二进制文件。运行以下命令以验证是否安装成功:
Docker
在 gaia 仓库中提供了Dockerfile。
构建方式:
静态链接
如果你需要构建一个将所有依赖都静态链接的二进制文件,请查看我们的 Dockerfile。 你的机器上必须提供libwasmvm。
请选择与你的平台和操作系统匹配的构建版本:
更多信息请查看 wasmvm 的文档。
构建标签
构建标签表示该二进制文件启用了哪些特殊特性。| 构建标签 | 说明 |
|---|---|
| netgo | 名称解析将使用纯 Go 代码 |
| ledger | 支持 Ledger 设备(硬件钱包) |
| static_wasm/muslc | 用于静态链接的 wasmd 依赖 |
配合 Cosmos SDK 克隆仓库使用
如果你想基于自己修改过的 Cosmos SDK 进行开发,请先 fork 此仓库,然后在go.mod 文件中添加 replace 子句。
你添加到 go.mod 中的 replace 子句必须提供正确的导入路径。
下一步
现在你可以加入主网或加入公共测试网。This guide will explain how to install the
gaiad binary and run the cli. With this binary installed on a server, you can participate on the mainnet as either a Full Node or a Validator.
Build Requirements
At present, the SDK fully supports installation on linux distributions. For the purpose of this instruction set, we’ll be usingUbuntu 22.04 LTS. It is also possible to install gaiad on Unix, while Windows may require additional unsupported third party installation. All steps are listed below for a clean install.
Build Tools
Installmake and gcc.
Ubuntu:
Install Go
We suggest the following two ways to install Go. Check out the official docs and Go installer for the correct download for your operating system. Alternatively, you can install Go yourself from the command line. Detailed below are standard default installation locations, but feel free to customize. Since the introduction of CosmWasm in Gaia v18 it is recommended to build the binaries withCGO enabled - simply set CGO_ENABLED=1 in your terminal before building the binary.
Building the gaiad binary on Windows is not supported due to dependency issues.
Go Binary Downloads
Ubuntu:
At the time of this writing, the latest release is 1.23.6. We’re going to download the tarball, extract it to /usr/local, and export GOROOT to our $PATH
GOPATH to your $PATH environment variable. If you’re not sure where that is, run go env GOPATH. This will allow us to run the gaiad binary in the next step. If you’re not sure how to set your $PATH take a look at these instructions.
Install the binaries
Next, let’s install the latest version of Gaia. Make sure yougit checkout the
correct released version.
LDFLAGS prior to running this step.
NOTE: If you still have issues at this step, please check that you have the latest stable version of GO installed.That will install the
gaiad binary. Verify that everything installed successfully by running:
Docker
Dockerfile is available in the gaia repo.
Building:
Static linking
In case you need to build a binary with all dependencies statically linked please check our Dockerfile. You must havelibwasmvm available on your machine.
Choose the build that matches your platform and OS:
For more information, please check wasmvm documentation.
Build Tags
Build tags indicate special features that have been enabled in the binary.| Build Tag | Description |
|---|---|
| netgo | Name resolution will use pure Go code |
| ledger | Ledger devices are supported (hardware wallets) |
| static_wasm/muslc | Used for statically linked wasmd dependencies |
Work with a Cosmos SDK Clone
To work with your own modifications of the Cosmos SDK, make a fork of this repo, and add areplace clause to the go.mod file.
The replace clause you add to go.mod must provide the correct import path.