The Hedera CLI is a powerful command-line tool designed to simplify interactions with the Hedera network. Whether you're building decentralized applications, automating testing workflows, or experimenting with tokenomics, this lightweight interface empowers developers to execute complex operations with minimal setup and maximum efficiency.
Built for speed and usability, the Hedera CLI abstracts away much of the boilerplate code typically required when working with blockchain protocols. Instead of writing extensive scripts, developers can use intuitive commands to manage accounts, deploy tokens, interact with smart contracts (coming soon), and automate multi-step processes—all from the terminal.
Who Should Use the Hedera CLI?
Developers Building and Testing Applications
If you're developing on Hedera, the CLI offers a fast way to spin up test environments. Need 10 test accounts with pre-funded balances? Done. Want to create and configure fungible or non-fungible tokens in seconds? The CLI makes it possible—without touching a single line of application code.
This accelerates prototyping and reduces friction during integration testing, especially when validating logic across multiple network states.
Automation Enthusiasts
For teams leveraging CI/CD pipelines, the Hedera CLI introduces script blocks—a feature that allows chaining of commands with dynamic variable passing. This means you can define reusable workflows that set up environments, run tests, verify balances, and clean up resources—all automatically.
👉 Discover how automation tools can enhance your development workflow.
Experimenters and Learners
New to Hedera? The CLI lowers the barrier to entry. You can explore core functionalities like account creation, token transfers, and topic messaging without diving deep into SDKs or API documentation. It's ideal for validating assumptions about network behavior or learning how different entities interact.
Getting Started with the Hedera CLI
Before using the Hedera CLI, ensure your system meets the following prerequisite:
- Node.js: Version 16.20.2 (LTS) or higher
Once Node.js is installed, you can install the CLI globally via npm:
npm install -g @hashgraph/cliAfter installation, initialize the tool and begin executing commands immediately. Configuration is handled through internal state management, which we’ll explore in detail shortly.
🔍 Tip: Always keep your CLI updated to access the latest features and security improvements.
Core Features of the Hedera CLI
Multi-Network Execution
One of the most valuable features is the ability to switch between Hedera networks seamlessly using the network use command. Whether you're working on mainnet, testnet, or previewnet, you can configure credentials for each and toggle between them as needed.
This flexibility ensures your scripts remain portable and adaptable across environments.
Script Blocks: Automate Complex Workflows
Script blocks let you chain commands together, passing data between steps using variables. This eliminates repetitive manual input and enables full environment provisioning with one execution.
Example 1: Create an Account and Token Dynamically
{
"name": "random-token-create",
"commands": [
"network use testnet",
"account create -a random --args privateKey,myAdminKey --args alias,accountAlias",
"token create -n {{accountAlias}} --symbol rand --decimals 2 --initial-supply 1000 --supply-type infinite --admin-key {{myAdminKey}} --treasury-id 0.0.4536940"
]
}In this script:
- A new account is created with a random alias.
- The private key and alias are stored as
myAdminKeyandaccountAlias. - These variables are then used to create a token where the account acts as the admin.
This kind of automation saves time and reduces human error during testing phases.
Example 2: Advanced Token Workflow with Transfers and Balance Checks
{
"name": "transfer",
"commands": [
"network use testnet",
"account create -a random --args privateKey,privKeyAcc1 --args alias,aliasAcc1 --args accountId,idAcc1",
"account create -a random --args privateKey,privKeyAcc2 --args alias,aliasAcc2 --args accountId,idAcc2",
"account create -a random --args privateKey,privKeyAcc3 --args alias,aliasAcc3 --args accountId,idAcc3",
"token create -n mytoken -s MTK -d 2 -i 1000 --supply-type infinite -a {{privKeyAcc1}} -t {{idAcc2}} -k {{privKeyAcc2}} --args tokenId,tokenId",
"token associate --account-id {{idAcc3}} --token-id {{tokenId}}",
"token transfer -t {{tokenId}} -b 1 --from {{aliasAcc2}} --to {{aliasAcc3}}",
"wait 3",
"account balance --account-id-or-alias {{aliasAcc3}} --token-id {{tokenId}}",
"state view --token-id {{tokenId}}"
]
}This advanced example demonstrates:
- Creation of three accounts.
- Deployment of a custom token.
- Association and transfer of tokens.
- Use of
waitto allow mirror node synchronization. - Final balance verification and state inspection.
Such scripts are perfect for regression testing or setting up consistent demo environments.
👉 Learn how developer tools integrate into modern blockchain ecosystems.
State Management: Remember What Matters
The Hedera CLI maintains an internal state that tracks all created entities—accounts, tokens, topics—with their associated keys and IDs. You can assign meaningful aliases (e.g., adminAccount, rewardToken) instead of managing raw identifiers.
This means:
- No need to manually copy-paste account IDs or private keys.
- Commands automatically resolve aliases to real values and sign transactions securely.
- States can be backed up, shared, or downloaded for team collaboration.
Use state download to pull configurations from remote sources—ideal for CI/CD integration—ensuring every pipeline starts with a known, consistent state.
Local Node Support
Developers can configure the CLI to work with the Hedera Local Node, enabling fully offline testing. This is especially useful for debugging smart contracts or simulating network conditions without incurring transaction fees or relying on external services.
Future Roadmap: What’s Coming?
The Hedera team continues to enhance the CLI based on community feedback. Upcoming features include:
- Telemetry: Anonymous usage data (commands only, no parameters or keys) will help improve UX and prioritize development.
- Smart Contract Integration: Deploy and invoke smart contracts directly via CLI commands.
- Enhanced Signing Module: More flexible key handling, including support for external signers and multi-sig configurations.
These updates aim to make the CLI not just a utility, but a central part of the Hedera development toolkit.
Command Overview by Category
Setup & Configuration
Initialize your environment and manage settings.
Network Commands
Switch between mainnet, testnet, previewnet.
Wait Command
Pause execution—critical for syncing with mirror nodes after transactions.
Account Management
Create, list, import, delete, and view accounts.
account create
account balance
account list
account import
account clear
account delete
account viewToken Operations
Full lifecycle control over tokens.
token create
token associate
token transfer
token create-from-fileTopic Interactions
Work with consensus service topics.
topic create
topic list
topic message submit
topic message findHBAR Transfers
Send native HBAR between accounts.
Backup & State Management
Save and restore your environment state.
backup create
backup restore
state download
state view
state clearScript Execution
Load and manage reusable command sequences.
script load
script list
script deleteFrequently Asked Questions (FAQ)
Q: Is the Hedera CLI secure?
A: Yes. Private keys are stored locally in encrypted state files. No sensitive data leaves your machine unless explicitly exported by you.
Q: Can I use the CLI in production workflows?
A: While primarily designed for development and testing, experienced teams use it in automated pipelines. Always follow security best practices when handling keys.
Q: Does the CLI support NFTs?
A: Yes. The token create command supports both fungible and non-fungible tokens (NFTs) via appropriate flags.
Q: How do I share my state with teammates?
A: Export your state using backup create, then share the file securely. Team members can import it using backup restore.
Q: Can I extend the CLI with custom commands?
A: Not natively yet—but since it's open-source, contributions are welcome on GitHub to add new functionality.
Q: Where can I report bugs or request features?
A: Visit the Hedera CLI GitHub repository to submit issues or contribute code.
Final Thoughts
The Hedera CLI is more than just a convenience tool—it's a productivity multiplier for developers engaging with the Hedera network. By simplifying account management, enabling powerful automation through script blocks, and supporting state persistence across sessions, it removes common pain points in blockchain development.
Whether you're a solo builder or part of a large engineering team, integrating the Hedera CLI into your workflow can significantly reduce development time and increase reliability.
👉 Explore next-generation blockchain development tools today.