Skip to content

Commit

Permalink
docs: simd testnet commands (cosmos#9411)
Browse files Browse the repository at this point in the history
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

This pull request is a follow-up pull request for cosmos#9246 that adds documentation for the `simd testnet` command.
 
---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [x] Review `Codecov Report` in the comment section below once CI passes
  • Loading branch information
ryanchristo authored Jul 15, 2021
1 parent 2eda28e commit 615f224
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/run-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ parent:
This folder contains documentation on how to run a node and interact with it.

1. [Setting up the keyring](./keyring.md)
1. [Running a Node](./run-node.md)
1. [Interacting with a Node](./interact-node.md)
1. [Generating, Signing and Broadcasting Transactions](./txs.md)
1. [Cosmos Upgrade Manager](./cosmovisor.md)
1. [Rosetta API](./rosetta.md)
2. [Running a Node](./run-node.md)
3. [Interacting with a Node](./interact-node.md)
4. [Generating, Signing and Broadcasting Transactions](./txs.md)
5. [Cosmos Upgrade Manager](./cosmovisor.md)
6. [Rosetta API](./rosetta.md)
7. [Running a Testnet](./run-testnet.md)
4 changes: 4 additions & 0 deletions docs/run-node/cosmovisor.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!--
order: 5
-->

# Cosmosvisor Quick Start

`cosmovisor` is a small process manager around Cosmos SDK binaries that monitors the governance module via stdout to see if there's a chain upgrade proposal coming in. If it see a proposal that gets approved it can be run manually or automatically to download the new code, stop the node, run the migration script, replace the node binary, and start with the new genesis file.
Expand Down
4 changes: 4 additions & 0 deletions docs/run-node/rosetta.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!--
order: 6
-->

# Rosetta

Package rosetta implements the rosetta API for the current cosmos sdk release series.
Expand Down
99 changes: 99 additions & 0 deletions docs/run-node/run-testnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<!--
order: 7
-->

# Running a Testnet

The `simd testnet` subcommand makes it easy to initialize and start a simulated test network for testing purposes. {synopsis}

In addition to the commands for [running a node](./run-node.html), the `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 the `init-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](#start-testnet)).

In order to initialize the files for a test network, run the following command:

```bash
simd testnet init-files
```

You should see the following output in your terminal:

```bash
Successfully initialized 4 node directories
```

The default output directory is a relative `.testnets` directory. Let's take a look at the files created within the `.testnets` directory.

### gentxs

The `gentxs` 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 a `simd` 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 the `start` 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:

```bash
simd testnet start
```

You should see something similar to the following:

```bash
acquiring test network lock
preparing test network with chain-id "chain-mtoD9v"


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++ THIS MNEMONIC IS FOR TESTING PURPOSES ONLY ++
++ DO NOT USE IN PRODUCTION ++
++ ++
++ sustain know debris minute gate hybrid stereo custom ++
++ divorce cross spoon machine latin vibrant term oblige ++
++ moment beauty laundry repeat grab game bronze truly ++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


starting test network...
started test network
press the Enter Key to terminate
```

The first validator node is now running in-process, which means the test network will terminate once you either close the terminal window or you press the Enter key. In the output, the mnemonic phrase for the first validator node is provided for testing purposes. The validator node is using the same default addresses being used when initializing and starting a single node (no need to provide a `--node` flag).

Check the status of the first validator node:

```
simd status
```

Import the key from the provided mnemonic:

```
simd keys add test --recover --keyring-backend test
```

Check the balance of the account address:

```
simd q bank balances [address]
```

Use this test account to manually test against the test network.

## 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.

0 comments on commit 615f224

Please sign in to comment.