Running a Single Node Local Network
Following this guide, you can set up a single-node local network manually or by using the provided automated script. Running a single-node setup is beneficial for developers who need a quick and simple environment to test their applications and protocol features. For more complex setups, please refer to the Multi-Node Setup guide.
Prerequisites
Install Binary
Automated Script
Automated Script
The simplest way to start a local Dhive node is by utilizing the helper script included in the Dhive repository. This script sets up a default configuration optimized for testing purposes:
Tip: To prevent accidental data loss on a production node, the automatically generated test configuration is stored at ~/.tmp-dhived
instead of the default ~/.dhived
.
When using the local_node.sh
script, all dhived
commands targeting the local test node must include the --home ~/.tmp-dhived
flag, as the home directory cannot be stored in the dhived
configuration. To simplify usage, consider exporting this directory as an environment variable:
You can customize the local node script by modifying the configuration variables. For example:
Manual Deployment
This guide walks you through setting up a single validator node for local testing and development.
Initialize the Chain
Before running the node, initialize the chain and its genesis file using the following command:
Tip: The moniker can be edited later by modifying the config.toml
file.
Adding Genesis Accounts
Create a local account and fund it with tokens:
To add a validator, create a gentx
transaction:
After creating the gentx
, add it to the genesis file:
Running a Single Node
Validate the genesis.json
file:
Start the node:
Tip: Use the --help
flag to explore customizable options.
Key Management
To ensure the same key is used across restarts, modify local_node.sh
:
Generate a new key:
To export your Dhive key as an Ethereum private key:
Clearing Data
To reset the blockchain data and address book:
To delete all data and start fresh:
Recording Transactions Per Second (TPS)
To monitor TPS using Prometheus, update your config.yaml
:
Start Prometheus:
In the Prometheus dashboard (http://localhost:9090
), use this query to monitor TPS:
This guide provides the necessary steps to set up a single-node local network with Dhive efficiently. For multi-node configurations and additional features, please refer to the official documentation.
Last updated
Was this helpful?