Dhive EVM "CLI"
dhived is the all-in-one command-line interface (CLI). It allows you to run a Dhive node, manage wallets, and interact with the Dhive network through queries and transactions. This introduction will explain how to install the dhived binary onto your system and guide you through some simple examples of how to use dhived.
Prerequisites
Go
Dhive is built using Go version 1.20+. Check your version with:
Once you have installed the right version, confirm that your GOPATH is correctly configured by running the following command and adding it to your shell startup script:
jq
Dhive scripts use jq version 1.6+. Check your version with:
Installation
You can download the latest binaries from the repository and install them, or you can build and install the dhived binaries from source or using Docker.
Download the Binaries
Go to the releases section of the repository.
Choose the desired release or pre-release you want to install on your machine.
Select and download from the Assets dropdown the corresponding tar or zip file for your OS.
Extract the files. The dhived binary is located in the
bin
directory of the extracted files.Add the dhived binary to your path, e.g., you can move it to
$(go env GOPATH)/bin
.
After installation is done, check that the dhived binary has been successfully installed:
Build From Source
Clone and build Dhive from source using Git. The <tag>
refers to a release tag on GitHub. Check the latest Dhive version in the releases section of the repository:
After installation is done, check that the dhived binary has been successfully installed:
Note: If the dhived: command not found
error message is returned, confirm that you have configured Go correctly.
Docker
When using Docker with Dhive, there are two options available: Build a binary of the Dhive daemon inside a dockerized build environment or build a Docker image that can be used to spin up individual containers running the Dhive binary. For information on how to achieve this, proceed to the dedicated page on working with Docker.
Run a Dhive Node
To become familiar with Dhive, you can run a local blockchain node that produces blocks and exposes EVM and Cosmos endpoints. This allows you to deploy and interact with smart contracts locally or test core protocol functionality.
Run the local node by executing the local_node.sh
script in the base directory of the repository:
The script stores the node configuration, including the local default endpoints, under ~/.tmp-dhived/config/config.toml
. If you have previously run the script, it allows you to overwrite the existing configuration and start a new local node.
Once your node is running, you will see it validating and producing blocks in your local Dhive blockchain:
For more information on how to customize a local node, refer to the Single Node page.
Using dhived
After installing the dhived binary, you can run commands using:
There is also a -h, --help
command available:
It is possible to maintain multiple node configurations at the same time. To specify a configuration, use the --home
flag. In the following examples, we will be using the default config for a local node, located at ~/.tmp-dhived
.
Manage Wallets
You can manage your wallets using the dhived binary to store private keys and sign transactions over CLI. To view all keys, use:
Example Output:
You can generate a new key/mnemonic with a $NAME
using:
To export your Dhive key as an Ethereum private key (for use with Metamask, for example):
For more available key commands, use the --help
flag:
Interact with a Network
You can use dhived to query information or submit transactions on the blockchain. Queries and transactions are requests that you send to a Dhive node through the Tendermint RPC.
Tip: To use the CLI, you will need to provide a Tendermint RPC address for the --node
flag. Look for publicly available addresses for testnet and mainnet in the Networks page.
Set Network Config
In the local setup, the node is set to tcp://localhost:26657
. You can view your node configuration with:
Example Output:
You can set your node configuration to send requests to a different network by changing the endpoint with:
Queries
You can query information on the blockchain using dhived query
(short dhived q
). To view account balances stored in the bank module, use:
Example Output:
To view other available query commands, use:
Transactions
You can submit transactions to the network using dhived tx
. To send tokens from an account in the keyring to another address with the bank module, use:
Example Output:
For more transaction commands, use:
Last updated
Was this helpful?