Install the Chromia CLI
This topic contains instructions to install and update the Chromia CLI.
Prerequisite
- Install PostgreSQL database; see Set up PostgreSQL database.
Install
Before you install the Chromia CLI, make sure that you have installed the Java Development Kit (open JDK) and have at least Java 11. For more information, see JDK Installation Guide.
You can download and install the latest Chromia CLI from here or via a package manager:
- Mac
- Linux
brew tap chromia/core https://gitlab.com/chromaway/core-tools/homebrew-chromia.git
brew install chr
Download public key of apt-repo and add it to your local keyrings
curl -fsSL https://chromaway.gitlab.io/core-tools/apt-repository-chromia/chromia.gpg | sudo tee /usr/share/keyrings/chromia.gpg
Add the repository to your list of package sources
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/chromia.gpg] https://chromaway.gitlab.io/core-tools/apt-repository-chromia stable main" | sudo tee /etc/apt/sources.list.d/chromia.list
Update apt-get and install
sudo apt-get update
sudo apt-get install chr
Update
You can download and install the latest Chromia CLI from here, or if you have installed the Chromia CLI via a package manager, you can update it with:
- Mac
- Linux
brew update
brew upgrade chr
sudo apt-get update
sudo apt-get install chr
Docker
You can use Docker to run a standalone Linux container with the Chromia CLI pre-installed. Make sure that you have set up the PostgreSQL database.
To use the published Docker images, you first need to have Docker installed and configured on your host machine. Please refer to the Docker documentation on how to install Docker on Windows, Mac, and Linux.
Start the Docker container with Chromia CLI pre-installed
To run the latest version of the Chromia CLI, use the docker run
command and specify the CLI docker image name and chr
.
docker run --rm -v $(pwd):/usr/app registry.gitlab.com/chromaway/core-tools/chromia-cli/chr:0.4.0 chr
You see the following prompt in the terminal:
Usage: chr [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit
-h, --help Show this message and exit
Commands:
init Generates a template project
test Run tests in working directory
repl Run rell commands in shell
node Interract with a test node
deploy Deploy blockchain into container
build Build an application and create a blockchain configuration
query Make a query towards a running node
tx Make a transaction
keygen Generates public/private key pair
For information about updating or uninstalling the Docker image, see the Docker command line reference.