Docs
chromia.com

Library commands

On this page

The Library commands provide a CLI interface for discovering and installing libraries from the Chromia library registry. These commands allow developers to browse available Rell libraries and integrate them into their projects.

library list

List all available libraries in the registry.

Usage:

Terminal
chr library list [options]

Options:

  • --limit <number>, -l <number>: Maximum number of libraries to display (default: 10)
  • --offset <number>, -o <number>: Number of libraries to skip (default: 0)
  • --sort-by <order>: Sort order (asc or desc, default: desc)

Example:

Terminal
chr library list

library view

View detailed information about a specific library.

Usage:

Terminal
chr library view <library_id> [options]

Arguments:

  • library_id: ID of the library to view

Example:

Terminal
chr library view com.chromia.ft4

library versions

List all versions of a specific library.

Usage:

Terminal
chr library versions <library_id> [options]

Arguments:

  • library_id: ID of the library to list versions for

Options:

  • --limit <number>, -l <number>: Maximum number of versions to display (default: 10)
  • --offset <number>, -o <number>: Number of versions to skip (default: 0)

Example:

Terminal
chr library versions com.chromia.ft4

library install

Install libraries from the registry to your local project.

The library install command reads your chromia.yml file and installs all libraries defined in the libs section. It supports both library-chain libraries (published to Chromia's library registry) and external Git libraries.

Usage:

Terminal
chr library install <library_id> [options]

Arguments:

  • library_id (optional): Specific library ID to install. If not provided, all configured libraries in chromia.yml will be installed.

Options:

  • --force, -f: Force installation even if RID verification fails (use with caution)

Configuration

Libraries are configured in your chromia.yml file using the libs section:

Library-chain libraries

Published to Chromia's library registry:

YAML
libs:
  com.chromia.ft4: # Library from Chromia's library-chain registry
    version: 0.0.1

Configuration options:

  • version: Version of the library to install

External Git libraries

Hosted in Git repositories:

YAML
libs:
  ft4: # External library from Git
    registry: https://gitlab.com/chromaway/ft4-lib.git
    path: rell/src/lib/ft4
    tagOrBranch: v1.2.0r
    rid: x"E96915FD7C9A5DD4E183D86F4A5B4BB5083A7CC1EDEB1465EDFFC926E67C93F6"
    insecure: false

Configuration options:

  • registry: Git repository URL
  • path: Path within the repository to the library
  • tagOrBranch: Git tag or branch to use
  • rid: Expected RID for verification
  • insecure: Skip RID verification (not recommended)

Installation examples

Install all configured libraries:

Terminal
chr library install

Install a specific library:

Terminal
chr library install com.chromia.ft4

Install a specific version:

Terminal
chr library install com.chromia.ft4@1.0.0

Install latest version:

Terminal
chr library install com.chromia.ft4

Force installation:

Terminal
chr library install com.chromia.ft4 --force

Using installed libraries

Once installed, you can import and use libraries in your Rell code. Libraries are imported using their simple name:

Rell
import ft4;

// Use library functions
val result = ft4.some_function();

Common options

All library commands inherit common options for connecting to the library-chain:

Connection options:

  • --url <url>: URL to the target node. Only required if library-chain is deployed on a custom network (e.g., https://custom-network). Defaults to Chromia's mainnet if not provided.
  • --brid <hex>: Blockchain RID of the library-chain. Only required if library-chain is deployed on a custom network.

Examples of common usage patterns:

Terminal
chr library <command> [options]