# Get started with Chromia · Chromia Docs (concept)

> Choose how to set up your Chromia development environment:

Source: https://docs.chromia.com/get-started/installation/

# Get started with Chromia

On this page

* [Dev container](#set-up-the-chromia-dev-container)
* [Set up the Chromia dev container](#set-up-the-chromia-dev-container)
* [Prerequisites](#prerequisites)
* [Quick Start](#quick-start)
* [What's included](#whats-included)
* [Benefits](#benefits)
* [GitHub Codespace](#set-up-github-codespaces)
* [Set up GitHub Codespaces](#set-up-github-codespaces)
* [Local install](#install-components-manually)
* [Install components manually](#install-components-manually)
* [Set up PostgreSQL database](#set-up-postgresql-database)
* [PostgreSQL (macOS)](#postgresql-macos)
* [Chromia CLI (macOS)](#chromia-cli-macos)
* [PostgreSQL (Linux)](#postgresql-linux)
* [Chromia CLI (Linux)](#chromia-cli-linux)
* [PostgreSQL (Windows)](#postgresql-windows)
* [Chromia CLI (Windows)](#chromia-cli-windows)
* [PostgreSQL (Docker)](#postgresql-docker)
* [Chromia CLI (Docker)](#chromia-cli-docker)
* [IDE Plugins](#ide-plugins)

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:

* **[Docker](https://docs.docker.com/get-started/get-docker)**
* **[VS Code](https://code.visualstudio.com/)** or a VS Code-based IDE (Cursor, Windsurf, etc.)
* **[Dev Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)**
  in your VS Code

> **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 line

```
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](https://docs.chromia.com/img/dev-container.png)

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:

* [Rell Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=ChromaWay.rell-language-extension)
* PostgreSQL
* [Chromia CLI](https://docs.chromia.com/build/cli/introduction/)
* [Postchain Management Console (PMC)](https://docs.chromia.com/ecosystem/providers/pmc/)
* Proper environment configuration

## 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](https://github.com/codespaces/badge.svg)](https://codespaces.new/ChromiaProject/hello-world-chromia)

Or create one manually:

1. Go to the [hello-world-chromia](https://github.com/ChromiaProject/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](https://brew.sh/) (if not already installed):

   Terminal

   ```
   /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](https://brew.sh/) (if needed):

   Terminal

   ```
   /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
   ```

Java Runtime (RELL\_JAVA)

Chromia CLI requires Java Runtime Environment (version 21 or later). Package managers handle this automatically. To
control the Java runtime explicitly, set the `RELL_JAVA` environment variable to a valid Java installation path.

## 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):

      Terminal

      ```
      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
   ```

   info

   The Chromia apt key has been rotated. If this step fails with `NO_PUBKEY 17D0120DE6D70A71`, your machine still has
   the previous key: run step 1 again to download the current one, then repeat this step.
4. Install:

   Terminal

   ```
   sudo apt-get install chr
   ```
5. Verify:

   Terminal

   ```
   chr --version
   ```

Java Runtime (RELL\_JAVA)

Chromia CLI requires Java Runtime Environment (version 21 or later). Package managers handle this automatically. To
control the Java runtime explicitly, set the `RELL_JAVA` environment variable to a valid Java installation path.

## 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):

      Terminal

      ```
      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.

#### Option 2: Using native installer (Windows 11 recommended)

1. Download the PostgreSQL installer from the [official website](https://www.postgresql.org/download/windows/).
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 line

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

   Command line

   ```
   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.

   warning

   Windows native PostgreSQL installation is not recommended for production use. Depending on your Windows version, you
   may encounter issues related to permissions or Rell runtime errors. If this happens, use
   [Docker setup](https://docs.chromia.com/get-started/installation/) to deploy PostgreSQL instead.

  

## 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
   ```

Java Runtime (RELL\_JAVA)

Chromia CLI requires Java Runtime Environment (version 21 or later). Package managers handle this automatically. To
control the Java runtime explicitly, set the `RELL_JAVA` environment variable to a valid Java installation path.

## 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](https://www.docker.com/products/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
   ```

   note

   We use the Alpine version of PostgreSQL because it provides the correct collation settings by default. The
   `POSTGRES_INITDB_ARGS` environment variable explicitly sets these options.

   Terminal

   ```
   POSTGRES_INITDB_ARGS="--lc-collate=C.UTF-8 --lc-ctype=C.UTF-8 --encoding=UTF-8"
   ```
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:

* Docs: <https://docs.docker.com/get-docker/>

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 system | Database host configuration |
| --- | --- |
| **macOS** | Set `database:host` to `host.docker.internal` |
| **Windows** | Set `database:host` to `172.17.0.1` |
| **Linux** | Use `--network=host` in the Docker run command |

For more details, see the [database section](https://docs.chromia.com/build/configuration/project-config/#database) 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 "$@"
```

How to use

Save the script as a file named `chr`, make it executable (`chmod +x chr`), and put it in a folder on your `PATH` (for
example `~/.local/bin` or `/usr/local/bin`). On Windows you would need to adapt the script accordingly and save it as
`chr.bat` instead.

After that, you can run `chr build`, `chr test`, etc. without repeating the full Docker prefix.

  

### IDE Plugins

warning

Security Notice for Cursor and Windsurf Users Only install Chromia extensions from official sources and verify the publisher is Chromia — malicious extensions
can compromise your development environment. Report suspicious extensions to Chromia support. See
[Kaspersky's report on malicious AI extensions](https://www.kaspersky.com/blog/malicious-extensions-for-cursor-ai/53802)
for more.

For a smoother editing experience, install the
[Rell extension](https://marketplace.visualstudio.com/items?itemName=ChromaWay.rell-language-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](https://docs.chromia.com/img/vs-extension_install.png)

To install the [Rell plugin](https://plugins.jetbrains.com/plugin/22585-rell):

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](https://docs.chromia.com/img/rell-intellij-plugin-install.png)

note

To install a specific version, go to the plugin page in [JetBrains Marketplace](https://plugins.jetbrains.com/),
download and install it as described in
[Install plugin from disk](https://www.jetbrains.com/help/rider/Managing_Plugins.html#install_plugin_from_disk). For
example, you can do it if the most recent version of the plugin is broken.

[View this page on docs.chromia.com](https://docs.chromia.com/get-started/installation/)Content mirrored from the live docs
