概述
这是一份快速入门指南。如果你已经大致了解 CometBFT 的工作方式,并希望立即开始使用,请继续阅读。安装
请参阅安装指南。初始化
运行:$HOME/.cometbft:
本地节点
使用一个简单的进程内应用启动 CometBFT:注意:随后区块将开始持续输出:kvstore是一个非持久化应用。如果你希望运行带持久化能力的应用,请使用--proxy_app=persistent_kvstore。
发送交易
在 KVstore 应用运行后,我们可以发送交易:节点集群
首先,创建四台 Ubuntu 云主机。以下步骤已在 Digital Ocean Ubuntu 16.04 x64(3GB/1CPU,20GB SSD)上测试通过。下文将它们各自的 IP 地址分别记为 IP1、IP2、IP3、IP4。 然后,ssh 登录每台机器,并按照说明安装 CometBFT。
接下来,使用 cometbft testnet 命令创建四个配置文件目录(位于 ./mytestnet),并将每个目录复制到云中的对应机器上,使每台机器都拥有一个 $HOME/mytestnet/node[0-3] 目录。
在启动网络之前,你需要获取各节点的对等节点标识符(仅有 IP 不够,而且 IP 可能会变化)。下文将它们分别记为 ID1、ID2、ID3、ID4。
genesis.json 中)已经上线。
也可以在 config.toml 中指定 persistent peers。有关配置选项的更多信息,请参阅这里。
之后,你就可以像上面单个本地节点示例中那样发送交易。
Overview
This is a quick start guide. If you have a general idea about how CometBFT works and want to get started right away, continue.Install
See the install guide.Initialization
Running:$HOME/.cometbft:
Local Node
Start CometBFT with a simple in-process application:Note:and blocks will start to stream in:kvstoreis a non-persistent app. If you would like to run an application with persistence, run--proxy_app=persistent_kvstore.
Sending Transactions
With the KVstore app running, we can send transactions:Cluster of Nodes
First, create four Ubuntu cloud machines. The following was tested on Digital Ocean Ubuntu 16.04 x64 (3GB/1CPU, 20GB SSD). We’ll refer to their respective IP addresses below as IP1, IP2, IP3, IP4. Then,ssh into each machine and install CometBFT following the instructions.
Next, use the cometbft testnet command to create four directories of config files (found in ./mytestnet) and copy each directory to the relevant machine in the cloud, so that each machine has a $HOME/mytestnet/node[0-3] directory.
Before you can start the network, you’ll need peer identifiers (IPs are not enough and can change). We’ll refer to them as ID1, ID2, ID3, ID4.
genesis.json) have come online.
Persistent peers can also be specified in the config.toml. See here for more information about configuration options.
Transactions can then be sent as covered in the single, local node example above.