Client Configuration Guide
Dhive Node and Client Configuration Guide
This document provides a comprehensive guide for configuring a Dhive node and client. A node is responsible for running the blockchain network, producing blocks, and validating transactions. The client serves as a gateway for interacting with the blockchain by submitting transactions and querying the network state. Additionally, we will cover the setup of the JSON-RPC server.
Proper configuration of these components is crucial as it directly impacts the performance, security, and functionality of the node. Therefore, understanding and correctly setting up your Dhive node and client is essential.
Configuration and Data Directory
By default, configuration files and data are stored in the ~/.dhived
directory. You can modify this default location using the --home
flag. Multiple home directories can be created to represent different blockchain instances.
To specify a custom Dhive configuration and data storage directory, use the following global flag:
Node Configuration
The Cosmos SDK generates two primary configuration files in ~/.dhived/config/
:
config.toml
: Configures Tendermint. Refer to the official Tendermint documentation for details.app.toml
: Generated by the Cosmos SDK, this file is used to configure various aspects such as state pruning strategies, telemetry, gRPC, REST servers, state synchronization, and JSON-RPC settings.
These files contain extensive comments for reference. One key configuration to consider is the minimum-gas-prices
field in app.toml
, which defines the minimum gas fee that the validator node accepts for transaction processing. This acts as an anti-spam mechanism.
If left empty, the node will halt on startup. Ensure the field has a value, such as:
State Pruning
There are four available pruning strategies, applicable only to state data (not block storage). The pruning setting is configured in ~/.dhived/config/app.toml
:
everything
: Removes all saved states except the current state.nothing
: Retains all states indefinitely.default
: Retains the last 100 states and the state of every 10,000th block.custom
: Allows manual configuration usingpruning-keep-recent
,pruning-keep-every
, andpruning-interval
parameters.
By default, nodes operate in default
mode, which is recommended for most environments. To change the pruning strategy during initialization, use:
Warning: When pruning is enabled, querying historical block heights outside the retained range will not be possible.
Client Configuration
To view the default client settings, use the following command:
Example output:
Configuration settings can be modified using:
Example modified output:
Alternatively, configurations can be directly modified in client.toml
located in ~/.dhived/config/client.toml
.
Running the JSON-RPC Server
The JSON-RPC server allows external applications to interact with the Dhive blockchain. It supports multiple transport layers, including HTTP and WebSocket. A server with a minimum 8-core CPU and 64GB of RAM is recommended. Ensure ports 8545
and 8546
are open in your firewall.
Enabling the JSON-RPC Server
To enable the server, use:
Defining Namespaces
By default, eth
, net
, and web3
namespaces are enabled. Additional namespaces can be added in app.toml
:
Setting a Gas Cap
The eth_call
and eth_estimateGas
methods impose a global gas cap to prevent DoS attacks. The default value (25,000,000) can be modified in app.toml
:
Enabling CORS
For browser access, Cross-Origin Resource Sharing (CORS) must be enabled in app.toml
:
Pruning Considerations for JSON-RPC
To enable all JSON-RPC methods, the node must maintain a full copy of the blockchain. Disable pruning in app.toml
:
WebSocket Server Configuration
WebSockets provide bidirectional communication between the client and server. They are efficient for handling a high volume of requests and event subscriptions. The WebSocket server can be enabled in app.toml
:
By following these configuration steps, you can ensure that your Dhive node and client are properly set up for optimal performance, security, and functionality.
Last updated
Was this helpful?