Skip to main content

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.

tip

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 machine
  • chr query - Queries a local or remote blockchain
  • chr test - Runs your test files
  • chr build - Builds your blockchain configuration

Remote commands (work with Testnet/Mainnet):

  • chr deployment create - Deploys your dapp to a remote network
  • chr 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. In main.rell you will see some basic Rell code, including the query hello_world

2. Start local node (requires PostgreSQL)

chr node start

This compiles your Rell code and starts a blockchain locally.

3. Query your dapp

chr query hello_world

Tests a query against your running node. When running a single local blockchain, no additional options are needed—chr query targets the local node by default. 4. Run tests

chr test

Execute your Rell test files to verify your dapp works correctly.

5. Deploy to Testnet See how to deploy your code to testnet here.

chr deployment create

Once your dapp is ready, deploy it to Chromia's public Testnet for others to interact with.

Database Requirement

Chromia is built on relational blockchain technology, leveraging SQL databases for efficient data storage and querying. For local development, this means you need a running database when using CLI commands that interact with a local blockchain.

See Database setup for installation instructions.

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.