Commands with Cosmos SDK blockchain built with Ignite

Commands with Cosmos SDK blockchain built with Ignite

Commands for your Blockchain

After scaffolding a Cosmos SDK blockchain using Ignite CLI, you gain access to a comprehensive command suite. These commands help you initialize, configure, manage, and interact with your blockchain network. Below is an overview of each command’s purpose and a brief guide on how to use them effectively.


Comet

Command: comet

Purpose: The comet command provides access to CometBFT (Tendermint) subcommands, which are integral for managing consensus and node states. CometBFT is the consensus engine that secures block finality and coordinates nodes.

Usage Insight: This command is mostly used by advanced users or for troubleshooting low-level consensus issues. It’s helpful when diving deeper into the node's consensus and communication layers.

Completion

Command: completion

Purpose: Generates shell-specific autocompletion scripts, enhancing productivity by suggesting commands as you type.

Best Use: Run completion for your shell (bash, zsh, etc.) to save time when typing commands. This is especially useful for beginners who need guidance on available options without memorizing each command.

Example:

exampled completion bash > ~/.bash_completion

Config

Command: config

Purpose: Helps manage application configurations like node settings, RPC details, and chain parameters.

Best Use: Use config when setting up your node for the first time or tweaking its parameters for optimization. This command is often combined with init to create an optimized setup.

Debug

Command: debug

Purpose: Offers tools for debugging, which is essential when diagnosing issues in your application.

Usage Insight: Ideal during development or testing phases. It’s worth exploring the specific debug options available to tailor the insights it provides based on the problem.

Export

Command: export

Purpose: Exports the blockchain state to JSON format.

Best Use: Run this command when you need to create snapshots of the chain state, back up data, or migrate it to another environment. Particularly useful for testing or forensics on state data.

Genesis

Command: genesis

Purpose: Manages genesis files and parameters, essential for defining the initial state of your blockchain.

Usage Insight: This command is fundamental during the network setup phase. Configure the genesis file accurately to ensure a smooth deployment of the initial blockchain state across nodes.

Help

Command: help

Purpose: Displays detailed information on each available command and subcommand.

Best Use: Type exampled help for an overview or exampled <command> --help for specifics on a given command. Perfect for when you’re learning the CLI.

In-Place-Testnet

Command: in-place-testnet

Purpose: Allows updating of the application and consensus state with validator information, useful for testing. Spin up a new testnet in no time.

Usage Insight: Use this when preparing your testnet setup. It ensures your node state is aligned with provided validator configurations, which streamlines testing for new chain configurations.

Init

Command: init

Purpose: Initializes all necessary configuration files for a new node, including private validator keys, peer-to-peer details, and genesis files.

Best Use: Essential during initial setup. Run this command first to create a standardized setup environment before adding other customizations.

Example:

exampled init

Keys

Command: keys

Purpose: Manages application keys, which are critical for node security and account management.

Usage Insight: Use keys to securely create, view, and manage public and private keys associated with your blockchain accounts. Critical for wallet management and validator keys.

Module-Hash-By-Height

Command: module-hash-by-height

Purpose: Fetches module hashes at specific blockchain heights.

Best Use: This command is useful for comparing state consistency at specific blocks, which can assist in tracking state evolution over time or troubleshooting inconsistencies.

Prune

Command: prune

Purpose: Removes older blockchain states to save disk space and improve performance.

Usage Insight: Run this periodically in production environments to reduce storage costs and maintain node performance. Ideal for full nodes not intended to retain historical states indefinitely.

Query

Command: query

Purpose: Provides subcommands to retrieve blockchain data, such as account balances, transaction history, and block information.

Best Use: Use query whenever you need to interact with the blockchain for reading state data. The range of subcommands here is broad, covering most aspects of blockchain state.

Rollback

Command: rollback

Purpose: Reverts the application state by one block, allowing for quick recovery from recent issues.

Usage Insight: Use this if an issue arises shortly after a block is committed. It’s particularly useful for development testing to undo the last state transition.

Snapshots

Command: snapshots

Purpose: Manages local blockchain snapshots, which can be used to speed up node syncing.

Best Use: Take snapshots periodically to improve recovery time for nodes. This is helpful in production to minimize downtime if a node falls behind.

Start

Command: start

Purpose: Starts the full node, which begins participating in the network, validating transactions, and syncing blocks.

Best Use: Once all initial configurations are complete, run start to make your node active. This command is central to node operations in a live network.

Status

Command: status

Purpose: Queries a remote node for its current status, useful for monitoring.

Usage Insight: Use this to check the health and connectivity of nodes, especially when monitoring multiple nodes in a network.

Tx

Command: tx

Purpose: Transaction-related subcommands that handle creating and sending transactions on the network.

Best Use: Use tx when testing or executing transactions, such as transfers, staking, or voting. It’s especially helpful in development environments to test different transaction scenarios.

Version

Command: version

Purpose: Displays the current version of the application binary.

Usage Insight: Check the version to ensure consistency across network nodes, particularly useful when upgrading or maintaining network compatibility.

Example:

exampled version

Best Practices for Command Usage

  1. Initial Setup: Run init to set up configuration files and config to fine-tune settings. Follow up with genesis for initial parameters.
  2. Automation: Use completion to streamline command entry. If you’re managing multiple nodes, automate configuration files with config.
  3. Debugging: Utilize debug in development to troubleshoot or track issues in transaction processing.
  4. Resource Management: Regularly prune old states to save disk space. Use snapshots to take consistent backups.
  5. Monitoring: The status and query commands provide insights into your node's state and network health, which is key for operations.

This command suite will guide you through all stages of blockchain development, testing, deployment, and maintenance, making it an essential toolkit for any Cosmos SDK project!