You can run a local test validator network to test and debug services you are developing for the Diem Blockchain and to build and test Move module code changes. This local test network is not part of the Diem Ecosystem and is only meant for testing and development purposes.
You can use the Diem CLI command dev to compile, publish, and execute Move Intermediate Representation (IR) programs on your local test validator network.
Note: Your local test network of validator nodes will not be connected to the testnet, and will not be using the actual validator nodes on the Diem Blockchain.
You can run a local test validator network in two ways: using the Diem Core source code or Docker. The Diem Core source code is useful when testing modifications to the Diem Core code base. Docker is particularly useful when building services on top of the Diem Blockchain as there is no build overhead and the ledger state persists across restarts of the network by default.
Download and clone the Diem Core repository from GitHub and prepare your developer environment by running the following commands:git clone https://github.com/diem/diem.gitcd diem./scripts/dev_setup.shsource ~/.cargo/env
Run the process:
cargo run -p diem-node -- --test. Note, after starting this process, the config path:
You can later restore the ledger state by running
diem-nodewith a previously used configuration path:
cargo run -p diem-node -- --test --config /distinct/tmp/path.
Install Docker and Docker-Compose.
Create a directory for your local test validator network.
Download the validator testnet docker compose.
Create configuration files in the same directory so that the data can be exported out of the docker container:# Linux / Mactouch genesis.blob diem_root_key waypoint.txt# Windowsfsutil file createnew genesis.blob 0fsutil file createnew diem_root_key 0fsutil file createnew waypoint.txt 0Run docker-compose: docker-compose up
After starting your local test validator network, the following will be output on your terminal:
This will output a lot of information that will be required for starting the Diem CLI tool:
- ChainId - For testing
- Diem root key path - Available in the docker compose folder under
- Waypoint - Printed on screen and available in the docker compose folder under waypoint.txt
- JSON-RPC Endpoint -
In another terminal, start a
diem-client using data from the output above:
At the end of this tutorial you will have:
- A single local validator test network
- A Diem CLI client connected to that network
The configuration management of the validator network generates:
- A genesis transaction.
- A waypoint that serves as a verifiable checkpoint into the blockchain.
- A chain id to uniquely distinguish this chain from other chains.
- Diem root key (also known as a mint or faucet key) for the account that's allowed to perform the mint operation.