Introduction to Chromia CLI
Chromia CLI simplifies the development cycle and deployment of Rell dapps, where all the needed capability is available in one CLI. It's a command-line tool that provides a way to interact with the Chromia blockchain using a set of commands.
The Chromia CLI tool is designed to be user-friendly and easy to use. It provides a set of commands that can be used in a terminal or console window and supports a range of options and flags to customize the behavior of the commands.
For information about installing Chromia CLI, see Install Chromia CLI. Once installed, you can use Chromia CLI to interact with the Chromia blockchain and build decentralized applications and services.
You can use Chromia CLI in Gitlab CI and Bitbucket Pipeline. Read the continuous integration article for more information.
How the CLI Works
The Chromia CLI is your main tool for building and deploying dapps. Understanding how different commands work together will help you build more efficiently.
Local Development vs Remote Operations
Local commands (work with your local node):
chr node start- Starts a local blockchain node on your machinechr query- Queries a local or remote blockchainchr test- Runs your test fileschr build- Builds your blockchain configuration
Remote commands (work with Testnet/Mainnet):
chr deployment create- Deploys your dapp to a remote networkchr deployment update- Updates an existing deployment
Common Development Workflow
Here's a typical workflow when building a Chromia dapp:
1. Create your project
chr create-rell-dapp
This generates a new Rell project with a basic structure including chromia.yml, main.rell, and test files.
2. Start local node (requires PostgreSQL)
chr node start
This compiles your Rell code and starts a blockchain locally. You'll see a Blockchain RID in the output - save this! You'll need it to interact with your dapp.
3. Query your dapp
chr query --blockchain-rid <BRID> your_query_name
Use this to test queries against your running node. The Blockchain RID tells the CLI which blockchain to query.
4. Run tests
chr test
Execute your Rell test files to verify your dapp works correctly.
5. Deploy to Testnet
chr deployment create
Once your dapp is ready, deploy it to Chromia's public Testnet for others to interact with.
Database Requirement
Most CLI commands require PostgreSQL because Chromia stores blockchain data in a relational database. The CLI uses the
--use-db flag by default.
Use --no-db flag only for commands that don't need database access (like chr build or chr generate).
Why PostgreSQL? Chromia is built on relational blockchain technology, leveraging the power of SQL databases for efficient data storage and querying.
Understanding Key Management
The CLI automatically manages keys stored in ~/.chromia/. When you run deployment commands, the CLI uses your
configured key to sign transactions.
Keys are used to:
- Sign transactions when deploying or updating dapps
- Authenticate operations on the blockchain
- Prove ownership of accounts
See Key Pair Management for detailed information on generating and managing keys.