Skip to main content

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:
will create the required files for a single, local node. These files are found in $HOME/.cometbft:
For a single, local node, no further configuration is required. Configuring a cluster is covered further below.

Local Node

Start CometBFT with a simple in-process application:
Note: kvstore is a non-persistent app. If you would like to run an application with persistence, run --proxy_app=persistent_kvstore.
and blocks will start to stream in:
Check the status with:

Sending Transactions

With the KVstore app running, we can send transactions:
and check that it worked with:
We can send transactions with a key and value too:
and query the key:
where the value is returned in hex.

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.
Here’s a handy Bash script to compile the persistent peers string, which will be needed for our next step:
Finally, from each machine, run:
Note that after the third node is started, blocks will start to stream in because >2/3 of validators (defined in the 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.