Skip to main content

Set up a project

In this section, you set up a project to use FT4.

Rell setup

To set up a project using Rell, perform the following steps:

  1. Install Chromia CLI and set up PostgreSQL database.

  2. Create a project directory by executing the following command:

    mkdir ft4-demo && cd ft4-demo
  3. Create a Rell project using the chr command:

    chr create-rell-dapp
  4. Generate an admin key pair that'll be used for registering accounts and assets:

    chr keygen > ft4-admin.keypair


    chr keygen --save ft4-admin.keypair

Add *.keypair to your .gitignore if you're in a git folder!

  1. Configure the FT4 module arguments by adding the moduleArgs and libs sections to your chromia.yml (or chromia.yml) file.

    module: main
    admin_pubkey: 03028A31DBA82E46DE26A608249147A6A1A88C62A1A65B640C9B4369D4CAD928BE

    tagOrBranch: v0.1.0r
    path: rell/src/lib/ft4
    rid: x"66BFCFD1A45D58EAB38F167C97259A633E272A6F995860949BCF8EBA69303744"
    insecure: false

    rellVersion: 0.12.0

    - test.arithmetic_test
    - test.data_test
  2. Replace the admin_pubkey value with the generated admin public key in the ft-admin.keypair file. Additionally, you can configure the rate limiter settings. Refer to the rate limiter topic for more details on the configuration.

  3. Install the FT4 Rell library

chr install
  1. Import the FT4 module into the main app module by adding the import statement import ^.lib.ft4.ft4_basic_dev.*; to the main.rell file.

  2. Start the node to verify if the configuration file is set up correctly by running the command chr node start. You can call a query to check if the FT4 module is imported correctly, such as chr query ft4.get_config. The output should look like this if you did not configure the rate limiter:


Client setup with TypeScript

This section discusses how to install and initialize clients.

Install the clients

To install the FT4 client, you can use npm (Node Package Manager) to download and install the required package. Follow the steps below:

  1. Open your terminal or command prompt.
  2. Run the following command:
npm install @chromia/ft4

This command'll download and install the @chromia/ft4 and postchain-client packages from the npm registry.

Initialize the clients

After installing the clients, you can initialize them in your JavaScript code to start interacting with the Postchain network. Here's an example of how to initialize the clients:

const { createClient } = require("postchain-client");
const { createConnection } = require("@chromia/ft4");

const url = "http://localhost:7740";
const client = await createClient({
nodeURLPool: url,
blockchainIID: 0,

const connection = createConnection(client);

In the code snippet above, we import the necessary modules from the postchain-client and @chromia/ft4 packages. Next, we define the url of the Postchain network we want to connect to (in this case, "http://localhost:7740"). We then create an instance of the IClient using the specified URL and the internal ID of the chain, which by default is 0 on a local network.

With the client initialized, you can now utilize its capabilities to interact with the Postchain network and perform various operations, such as sending transactions and querying the blockchain.

We then pass the client to the createConnection method from FT4, which'll allow us to use all of the FT4 feature with ease.