The
simd testnet
subcommand makes it easy to initialize and start a simulated test network for testing purposes.simd
binary also includes a testnet
command that allows you to start a simulated test network in-process or to initialize files for a simulated test network that runs in a separate process.
Initialize Files
First, let’s take a look at theinit-files
subcommand.
This is similar to the init
command when initializing a single node, but in this case we are initializing multiple nodes, generating the genesis transactions for each node, and then collecting those transactions.
The init-files
subcommand initializes the necessary files to run a test network in a separate process (i.e. using a Docker container). Running this command is not a prerequisite for the start
subcommand (see below).
In order to initialize the files for a test network, run the following command:
.testnets
directory. Let’s take a look at the files created within the .testnets
directory.
gentxs
Thegentxs
directory includes a genesis transaction for each validator node. Each file includes a JSON encoded genesis transaction used to register a validator node at the time of genesis. The genesis transactions are added to the genesis.json
file within each node directory during the initilization process.
nodes
A node directory is created for each validator node. Within each node directory is asimd
directory. The simd
directory is the home directory for each node, which includes the configuration and data files for that node (i.e. the same files included in the default ~/.simapp
directory when running a single node).
Start Testnet
Now, let’s take a look at thestart
subcommand.
The start
subcommand both initializes and starts an in-process test network. This is the fastest way to spin up a local test network for testing purposes.
You can start the local test network by running the following command:
--node
flag).
Check the status of the first validator node:
Testnet Options
You can customize the configuration of the test network with flags. In order to see all flag options, append the--help
flag to each command.