简介
Cosmos SDK 运行区块链节点需要 Go 环境以及构建好的二进制文件。本教程将介绍如何安装 Go、构建simd 二进制文件,并配置环境以运行 Cosmos SDK 节点。
前置条件
本教程假设你已经安装了以下工具:- 终端应用程序
- 代码编辑器
- 对命令行操作有基本了解
1. 安装 Go
Cosmos SDK 要求 Go 版本为 1.25 或更高。请从Go 官方下载页面下载安装程序,并按照你的操作系统对应的安装说明完成安装。 验证安装:配置 Go 环境变量
- Linux
- macOS
- Windows
打开你的 shell 配置文件(应用更改:
~/.bashrc 或 ~/.zshrc),并添加:source ~/.bashrcgo env GOPATH
2. 克隆 Cosmos SDK 仓库
本教程使用simapp,即 Cosmos SDK 的示例应用。克隆 Cosmos SDK 仓库以获取 simapp。
- 进入你希望使用的目录。此示例使用
~/Documents/GitHub:
- 克隆 Cosmos SDK 仓库:
- 进入克隆后的仓库目录:
3. 构建 simd 二进制文件
simd 二进制文件是用于与 Cosmos SDK 区块链交互的命令行接口。
构建并安装 simd 二进制文件:
Windows 用户:如果系统中没有
make,你可以通过 Chocolatey 安装(choco install make),或者使用 WSL2。simd 是否可用:
后续步骤
- 设置 keyring,用于创建和管理加密密钥
Introduction
The Cosmos SDK requires Go and a built binary to run a blockchain node. This tutorial walks through installing Go, building thesimd binary, and configuring your environment to run a Cosmos SDK node.
Prerequisites
This tutorial assumes you have the following installed:- A terminal application
- A code editor
- Basic familiarity with command-line operations
1. Install Go
The Cosmos SDK requires Go version 1.25 or higher. Download the installer from the official Go downloads page and follow the installation instructions for your operating system. Verify the installation:Configure Go environment variables
- Linux
- macOS
- Windows
Open your shell config file (Apply changes:
~/.bashrc or ~/.zshrc) and add:source ~/.bashrcgo env GOPATH
2. Clone the Cosmos SDK repository
This tutorial usessimapp, the Cosmos SDK example application. Clone the Cosmos SDK repository to access simapp.
- Navigate to your preferred directory. This example uses
~/Documents/GitHub:
- Clone the Cosmos SDK repository:
- Navigate into the cloned repository:
3. Build the simd binary
Thesimd binary is the command-line interface for interacting with the Cosmos SDK blockchain.
Build and install the simd binary:
Windows users: If
make is not available, you can install it via Chocolatey (choco install make) or use WSL2.simd is working:
Next steps
- Set up the keyring to create and manage cryptographic keys