exonum-cli
crate provides an extensible command line interface for Exonum
nodes.
By default, the following CLI subcommands are available:
Command | Description |
---|---|
generate-template | Generate common part of the nodes configuration |
generate-config | Generate public and private configs of the node |
finalize | Generate final node configuration |
run | Run the node with provided node config |
run-dev | Run the node with auto-generated config |
maintenance | Perform different maintenance actions |
help | Prints this message or the help of the given subcommand(s) |
However, new commands can be added to extend the exonum-cli
functionality.
Consult the crate docs for more details.
- Generate common (template) part of the nodes configuration using
generate-template
command. Generated.toml
file must be spread among all the nodes and must be used in the following configuration step. - Generate public and secret (private) parts of the node configuration using
generate-config
command. At this step, Exonum will generate master key, from which consensus and service validator keys are derived. Master key is stored in the encrypted file. Consensus secret key is used for communications between the nodes, while service secret key is used mainly to sign transactions generated by the node. Both secret keys may be encrypted with a password. The public part of the node configuration must be spread among all nodes, while the secret part must be only accessible by the node administrator only. - Generate final node configuration using
finalize
command. Exonum combines secret part of the node configuration with public configurations of every other node, producing a single configuration file with all the necessary node and network settings. - Use
run
command and provide it with final node configuration file produced at the previous step. If the secret keys are protected with passwords, the user need to enter the password. Running node will automatically connect to other nodes in the network using IP addresses from public parts of the node configurations.
exonum-cli
also supports additional CLI commands for performing maintenance
actions by node administrators and easier debugging.
run-dev
command automatically generates network configuration with a single node and runs it. This command can be useful for fast testing of the services during development process.maintenance
command contains only clear-cache functionality at the moment. It allows to clear node's consensus messages cache to fix rare node out-of-sync issues.
Running an Exonum node with default settings:
use exonum_cli::NodeBuilder;
use exonum_cryptocurrency_advanced as cryptocurrency;
fn main() -> anyhow::Result<()> {
exonum::helpers::init_logger().unwrap();
NodeBuilder::new()
.with_service(cryptocurrency::CryptocurrencyService)
.run()
}
Include exonum-cli
as a dependency in your Cargo.toml
:
[dependencies]
exonum-cli = "1.0.0"
exonum-cli
is licensed under the Apache License (Version 2.0).
See LICENSE for details.