Docs
chromia.com

Get started with Chromia

On this page

Choose how to set up your Chromia development environment:

  • Dev container — a pre-built Docker environment with Chromia CLI, PostgreSQL, Postchain Management Console, and the Rell VS Code extension already installed and configured. Recommended if you want to start building quickly or keep your host machine clean. Requires Docker and VS Code.
  • GitHub Codespaces — run a cloud-based dev environment directly in your browser without installing anything locally.
  • Local install — install each component directly on your machine. Choose this if you need full control over versions and system configuration, or prefer not to use Docker.

Set up the Chromia dev container

This setup approach provides a fully pre-configured development environment using Docker and development containers, eliminating the need to manually install and configure individual components.

Prerequisites

Before starting, ensure you have the following available on your machine:

Note: This approach also works with JetBrains IDEs (IntelliJ, PyCharm, etc.), but the Ultimate edition is required for the dev container plugin support.

Quick Start

1. Create a new Rell dapp project

Run the following command in your terminal to create a new template project:

Terminal
docker run --rm -u $(id -u):$(id -g) -v "$(pwd):$(pwd)" -w "$(pwd)" registry.gitlab.com/chromaway/core-tools/chromia-cli/chr:latest chr create-rell-dapp --devcontainer project-name

This creates a new template project named "project-name" in your current directory. If you want to use a different name, simply change the project-name value in the command.

Windows Command Prompt users

If you're using Windows Command Prompt (cmd), replace $(pwd) with %CD% and remove the -u $(id -u):$(id -g) flag in the Docker command:

Command prompt
docker run --rm -v "%CD%:%CD%" -w "%CD%" registry.gitlab.com/chromaway/core-tools/chromia-cli/chr:latest chr create-rell-dapp --devcontainer project-name

The $(pwd) syntax works in PowerShell and Unix-based shells (bash, zsh), but Windows Command Prompt uses %CD% for the current directory. The -u $(id -u):$(id -g) flag is not needed on Windows.

2. Open the project

Open the newly created project folder in VS Code.

When you open the project in VS Code and have the Dev Containers extension installed, VS Code will automatically detect that this is a dev container project and suggest you reopen it in a container. You'll see a notification like this:

proposal submission success

Click "Reopen in Container". This will:

  • Build and start the development container
  • Install all necessary dependencies
  • Configure the development environment
  • Provide access to all Chromia development tools

🎉 Congratulations! You're now ready to start developing!

Once the dev container is running, you can use the integrated terminal in VS Code to run Chromia CLI commands like chr test, chr build, and more. The full development environment is ready to use with no additional configuration required.

What's included

The dev container comes pre-configured with:

Benefits

  • No manual installation: All components are pre-installed and configured
  • Consistent environment: Same setup across different machines and team members
  • Isolated development: Development environment is completely isolated from your system
  • Quick setup: Get started in minutes instead of hours
  • Cross-platform: Works on Windows, macOS, and Linux

Set up GitHub Codespaces

Get started immediately in your browser without installing dependencies:

Open in GitHub Codespaces

Or create one manually:

  1. Go to the hello-world-chromia template.
  2. Click the green Use this template button.
  3. Select Open in a codespace.

Install components manually

Set up PostgreSQL database

💡 Why does Chromia use PostgreSQL?

Chromia uses PostgreSQL as its storage layer because blockchains are essentially databases. When you run chr node start, your Rell code runs on top of PostgreSQL, storing all blockchain data in relational tables.

Benefits of this approach:

  • Powerful queries: Leverage SQL's full querying capabilities
  • Familiar tooling: Use standard database tools to inspect blockchain data
  • Efficient storage: Relational databases are optimized for the type of data blockchains store
  • Built-in indexing: No need for separate indexing solutions

This is different from most blockchains but gives you powerful query capabilities right out of the box!

Default database configuration for Rell

  • Database name: postchain
  • User: postchain
  • Password: postchain

PostgreSQL (macOS)

  1. Install Homebrew (if not already installed):

    Output
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install PostgreSQL:

    Terminal
    brew install postgresql@16
    brew services start postgresql@16
    export PATH="$(brew --prefix postgresql@16)/bin:$PATH"
    createuser -s postgres
  3. Prepare the PostgreSQL database:

    Terminal
    psql -U postgres -c "CREATE DATABASE postchain WITH TEMPLATE = template0 LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8' ENCODING 'UTF-8';" -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"
    Fix "invalid LC_COLLATE locale name" issue

    You might see this message if your system doesn't support the 'C.UTF-8' locale. To fix it, follow these steps:

    1. Check which UTF-8 locales your system supports:

      Terminal
      locale -a | grep -i utf-8
    2. Create the database using a valid locale:

      Replace 'C.UTF-8' with your system's valid locale (for both LC_COLLATE and LC_CTYPE):

      Terminal
      psql -U postgres -c "CREATE DATABASE postchain WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';" -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"

    Typical macOS UTF-8 locales:

    • en_US.UTF-8
    • en_GB.UTF-8

    After running the command with a supported locale, your database should be created successfully.

    Fix peer authentication failed

    If you get an error saying peer authentication failed, change the authentication method from peer to md5 in the pg_hba.conf file.


Chromia CLI (macOS)

  1. Install Homebrew (if needed):

    Output
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Tap Chromia:

    Terminal
    brew tap chromia/core https://gitlab.com/chromaway/core-tools/homebrew-chromia.git
  3. Install CLI:

    Terminal
    brew install chromia/core/chr
  4. Verify:

    Terminal
    chr --version

PostgreSQL (Linux)

  1. Update your package manager and install PostgreSQL:

    Terminal
    sudo apt update
    sudo apt install postgresql-16
  2. Start PostgreSQL and set up the database:

    Terminal
    sudo service postgresql start
    sudo -u postgres psql -c "CREATE DATABASE postchain WITH TEMPLATE = template0 LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8' ENCODING 'UTF-8';" -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"
    Fix "invalid LC_COLLATE locale name" issue

    You might see this message if your system doesn't support the 'C.UTF-8' locale. To fix it, follow these steps:

    1. Check which UTF-8 locales your system supports:

      Terminal
      locale -a | grep -i utf-8
    2. Create the database using a valid locale:

      Replace 'C.UTF-8' with your system's valid locale (for both LC_COLLATE and LC_CTYPE):

      Output
      sudo -u postgres psql -c "CREATE DATABASE postchain WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';" -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"

    Typical Linux UTF-8 locales:

    • en_US.UTF-8
    • en_GB.UTF-8
    • C.UTF-8

    After running the command with a supported locale, your database should be created successfully.


Chromia CLI (Linux)

  1. Trust Chromia apt key:

    Terminal
    curl -fsSL https://apt.chromia.com/chromia.gpg | sudo tee /usr/share/keyrings/chromia.gpg >/dev/null

    To check it, run gpg --show-keys /usr/share/keyrings/chromia.gpg. The fingerprint must be 8F4A 0EA8 F036 6411 4AEA D02A 17D0 120D E6D7 0A71.

  2. Add repo:

    Terminal
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/chromia.gpg] https://apt.chromia.com stable main" | sudo tee /etc/apt/sources.list.d/chromia.list
  3. Update:

    Terminal
    sudo apt-get update
  4. Install:

    Terminal
    sudo apt-get install chr
  5. Verify:

    Terminal
    chr --version

PostgreSQL (Windows)

Option 1: Using WSL (Windows Subsystem for Linux) within Windows

  1. Install WSL and a Linux distribution (e.g., Ubuntu) from the Microsoft Store.

  2. Open the WSL terminal and install PostgreSQL:

    Terminal
    sudo apt update
    sudo apt install postgresql-16
  3. Start PostgreSQL and set up the database:

    Terminal
    sudo service postgresql start
    sudo -u postgres psql -c "CREATE DATABASE postchain WITH TEMPLATE = template0 LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8' ENCODING 'UTF-8';"
    sudo -u postgres psql -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"
    Fix "invalid LC_COLLATE locale name" issue

    You might see this message if your system doesn't support the 'C.UTF-8' locale. To fix it, follow these steps:

    1. Check which UTF-8 locales your system supports:

      Terminal
      locale -a | grep -i utf-8
    2. Create the database using a valid locale:

      Replace 'C.UTF-8' with your system's valid locale (for both LC_COLLATE and LC_CTYPE):

      Output
      sudo -u postgres psql -c "CREATE DATABASE postchain WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';"
      sudo -u postgres psql -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"

    Typical WSL UTF-8 locales:

    • en_US.UTF-8
    • en_GB.UTF-8
    • C.UTF-8

    After running the command with a supported locale, your database should be created successfully.

  1. Download the PostgreSQL installer from the official website.

  2. Install the executable and add the PostgreSQL folder containing the binaries to your environment variables. Open the Windows PowerShell using Run as administrator and run the following command, ensuring that you set the path to your binaries correctly and replace the <version> placeholder with the actual version number:

    Command prompt
    setx POSTGRESQL "C:\Program Files\PostgreSQL\<version>\bin" /M
  3. Check if the environment variables are set correctly:

    Command prompt
    echo %POSTGRESQL%
  4. Open a new Windows PowerShell as normal user to make sure the environment variables are in effect. Prepare the PostgreSQL database by running the following two commands sequentially:

    Terminal
    psql -U postgres -c "CREATE DATABASE postchain WITH TEMPLATE = template0 LOCALE_PROVIDER icu ICU_LOCALE = 'und-u-kf-upper' LC_COLLATE = 'und-u-kf-upper' LC_CTYPE = 'und-u-kf-upper' ENCODING 'UTF-8';"
    psql -U postgres -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"
    Fix "invalid ICU locale name" issue

    You might see this message if your system doesn't support the ICU locale configuration. To fix it, create the database without the LOCALE_PROVIDER parameters:

    Terminal
    psql -U postgres -c "CREATE DATABASE postchain WITH TEMPLATE = template0 ENCODING 'UTF-8';"
    psql -U postgres -c "CREATE ROLE postchain LOGIN ENCRYPTED PASSWORD 'postchain'; GRANT ALL ON DATABASE postchain TO postchain;"

    After running the command with a supported locale, your database should be created successfully.


Chromia CLI (Windows)

  1. Open PowerShell as Administrator and allow scripts:

    PowerShell
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  2. Install Scoop:

    PowerShell
    Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
  3. Add buckets:

    PowerShell
    scoop bucket add chromia https://gitlab.com/chromaway/core-tools/scoop-chromia.git
    scoop bucket add java
  4. Install CLI:

    PowerShell
    scoop install chr
  5. Verify:

    PowerShell
    chr --version

PostgreSQL (Docker)

Using Docker is a simple and reliable way to set up PostgreSQL. It avoids platform-specific issues and ensures a consistent environment.

  1. Install Docker Desktop for your operating system.

  2. Run the following command to pull and start a PostgreSQL container:

    Terminal
    docker run --name postgres -e POSTGRES_USER=postchain -e POSTGRES_PASSWORD=postchain -p 5432:5432 -d postgres:16.3-alpine3.20
  3. Verify that the container is running:

    Terminal
    docker ps

Chromia CLI (Docker)

Using Docker is a great way to run Chromia CLI because it gives you an isolated, consistent environment.

Install Docker

Install Docker on your host OS:

Make sure PostgreSQL is running/configured (see section above).

Run the CLI via Docker

Run the latest CLI image and invoke chr:

Terminal
docker run --rm -v "$(pwd):$(pwd)" -w "$(pwd)" registry.gitlab.com/chromaway/core-tools/chromia-cli/chr:latest chr

Database host settings when using Docker

Configure chromia.yml depending on your OS:

Operating systemDatabase host configuration
macOSSet database:host to host.docker.internal
WindowsSet database:host to 172.17.0.1
LinuxUse --network=host in the Docker run command

For more details, see the database section of the chromia.yml configuration file.

Wrapper script (optional)

To avoid having to repeat the full docker run … chr prefix every time, you can use a wrapper script like the following:

Terminal
#!/bin/sh

# Allocate a pseudo-TTY when run in interactive mode
if [ -t 0 ] && [ -t 1 ] ; then TTY="--tty"; else TTY=""; fi

docker run \
  --network=host \
  -e TZ=$(cat /etc/timezone) \
  --user $(id -u):$(id -g) \
  --mount type=bind,source="/etc/passwd",target=/etc/passwd,readonly \
  --mount type=bind,source="/etc/group",target=/etc/group,readonly \
  -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
  --volume "$SSH_AUTH_SOCK:$SSH_AUTH_SOCK" \
  --mount type=bind,source="${HOME}/.ssh",target=${HOME}/.ssh,readonly \
  --mount type=bind,source="${HOME}/.config/jgit",target=${HOME}/.config/jgit \
  --mount type=bind,source="$(pwd)",target="$(pwd)" \
  --workdir "$(pwd)" \
  --interactive ${TTY} \
  --rm \
  registry.gitlab.com/chromaway/core-tools/chromia-cli/chr:${CHR_VERSION:-latest} chr "$@"

IDE Plugins

For a smoother editing experience, install the Rell extension in VS Code or a compatible IDE (such as Cursor or Windsurf).

  1. Click the Extensions icon in the Activity Bar on the side of VS Code or go to the menu View | Extensions.
  2. Enter 'Rell' in the search box, and you should see the extension named Rell in the list.
  3. Press the Install button.
chromia architecture

To install the Rell plugin:

  1. Open Settings | Plugins.
  2. Click the Marketplace tab and type 'Rell' in the search box, and you should see the extension named Rell in the list.
  3. Press the Install button.
rell intellij plugin installation