Skip to main content

Node Setup and Configuration Tools

The setup command provides functions for creating and managing node configuration and data, including:

  • performing quick setup of a standalone Kwil node (init) and Kwil test networks (testnet)
  • resetting node state and all data files (reset)
  • generating just a new genesis file (genesis)

Quick Setup of a Single Kwil Node

The init command facilitates quick setup of an isolated Kwil node on a fresh network in which that node is the single validator. This permits rapid prototyping and evaluation of Kwil DB functionality.

For example, to create a node configuration for a new network in a node root folder at ~/.kwild-new:

$ kwild setup init --root ~/.kwild-new
Kwil node configuration generated at /home/jon/.kwild-new

The above command generates new config.toml, genesis.json. and nodekey.json files in the node's root directory.

Additional nodes may join this new network by specifying the existing node as a bootstrap peer in kwild's configuration, and using the same genesis.json file. See Kwil Daemon Configuration for more information on node setup.

Creating a New Test Network of Several Nodes

The setup testnet command is used to create multiple node configurations, all with the same genesis config, and pre-configured to connect to each other. This command has several options:

kwild setup testnet [--vals/-v V] [--non-vals/-n N] [--out-dir DIR]
[--port/-p PORT] [--unique-ports/-u] [--db-owner OWNER]

There are defaults for each flag, with the output writing to a folder called .testnet in the current folder. For example, the following command creates a new test network with 3 total nodes, all of which are validators:

$ kwild s setup testnet -o ~/.kwild-testnet-xyz
Generated testnet configuration in .kwild-testnet-xyz

$ tree ~/.kwild-testnet-xyz
/home/user/.kwild-testnet-xyz
├── node0
│   ├── config.toml
│   ├── genesis.json
│   └── nodekey.json
├── node1
│   ├── config.toml
│   ├── genesis.json
│   └── nodekey.json
└── node2
├── config.toml
├── genesis.json
└── nodekey.json

The config files for each of the nodes will specify all of the other nodes as persistent peers so that they will connect to each other on startup. This is generally only practical for small test networks with fewer than 12 nodes.

For more information on usage, configurations, and more, use the --help flag:

kwild setup testnet --help

Resetting All Application Data

To delete all of a Kwil node's data files, use the reset command.

WARNING: This command should not be used on production systems. This should only be used to reset disposable test nodes.

kwild setup reset [--root DIR] [--force] [--dbname DBNAME] [--host HOST] \
[--port PORT] [--user USER] [--password PASSWORD]

This command only requires one: (a) --root to specify a node root directory containing the files to reset, or (b) --force to automatically reset the files in the default node root directory at ~/.kwild.

Extra Postgres configurations can be provided if needed, but the command will attempt to connect using the configurations in the config.toml file in the node root.

Generating a Genesis File

A less common operation provided by the setup genesis command is the ability to generate a new genesis file without creating a root directory (as with setup init) or multiple root directories for a testnet (as with setup testnet). This is of use in the following case:

  1. When you already have a node private key and config file and want to create a genesis file for a new network. This scenario is described in the Production Guide.
  2. When you want to prepare a genesis file to provide to the setup init command with the --genesis flag, as when preparing for a network migration, as described in the Migration Tutorial.

Please see the above links for more information on this command.