arrow-left
All pages
gitbookPowered by GitBook
1 of 1

Loading...

Run a localnet with Docker

hashtag
Context

This document provides instructions on how to run a localnet with multiple validator/non-validator nodes. This can be useful if you are developing applications to work on cheqd network, or in automated testing pipelines.

The techniques described here are used in CI/CD contexts, for example, in this repository itself in the test.yml Github workflowarrow-up-right.

hashtag
Pre-requisites

  • A clone of the

  • Either , or (the latter is mandatory if you've modified any code in the repository cline).

  • Docker Engine and Docker Compose (same versions as described in )

hashtag
Instructions

Our localnet setup instructions are designed to set up a local network with the following node types:

  • 3x validator nodes

  • 1x non-validator/observer node

  • 1x seed node

The definition for this network is described in a , which can be modified as required for your specific use case. Since it's not possible to cover all possible localnet setups, the following instructions describe the steps necessary to execute a setup similar to that using in .

hashtag
Generate localnet configuration (one-time)

Execute the to generate validator keys and node configuration for the node types above.

You may modify the output if you want a different mix of node types.

hashtag
Import the generated keys (one-time)

Import the keys generated using the :

hashtag
Bring up the localnet using Docker Compose

Modify the docker-compose.yml file if necessary, along with the per-container environment variables under the container-env folder.

hashtag
Interacting with localnet

The default Docker localnet will configure a running network with a pre-built image or custom image.

hashtag
Nodes

The five nodes and corresponding ports set up by the default Docker Compose setup will be:

  1. Validator nodes

    1. validator-0

      1. P2P: 26656

You can tests connection to a node using browser: http://localhost:<rpc_port>. Example for the first node: http://localhost:26657.

hashtag
Accounts

Key and corresponding accounts will be placed in the network config folder by the import-keys.sh script, which are used within the nodes configured above.

When connecting using CLI, provide the --home parameter to any CLI command to point to the specific home directory of the corresponding node: --home network-config/validator-x.

hashtag
CLI commands

See to learn about the most common CLI commands.

A cheqd-node binary to run the network config generation script below.

RPC: 26657

  • validator-1

    1. P2P: 26756

    2. RPC: 26757

  • validator-2

    1. P2P: 26856

    2. RPC: 26857

  • validator-3

    1. P2P: 26956

    2. RPC: 26957

  • Seed node

    1. seed-0

      1. P2P: 27056

      2. RPC: 27057

  • Observer node

    1. observer-0

      1. P2P: 27156

      2. RPC: 27157

  • cheqd-node repositoryarrow-up-right
    a pre-built Docker image downloaded from Github Container Registryarrow-up-right
    a custom-built Docker image
    configuration instructions for Docker setup
    localnet Docker Compose filearrow-up-right
    our Github test workflowarrow-up-right
    bash script gen-network-config.sharrow-up-right
    import-keys.sh bash scriptarrow-up-right
    the cheqd CLI guide
    ./docker/localnet/gen-network-config.sh
    ./docker/localnet/import-keys.sh
    docker compose --env-file build-latest.env up --detach --no-build