Chromia
Start Building

09 / 20Module 1: A Rell backend with FT4 accounts

Configure FT4 accounts

This page covers installing the FT4 library and setting up FT4 accounts in your project.

Install the FT4 library

FT4 account management depends on the FT4 library. Start by adding this configuration to your chromia.yml file:

chromia.yml
libs:  ft4:    registry: https://gitlab.com/chromaway/ft4-lib.git    path: rell/src/lib/ft4    tagOrBranch: v1.2.0r    rid: x"E96915FD7C9A5DD4E183D86F4A5B4BB5083A7CC1EDEB1465EDFFC926E67C93F6"    insecure: false  iccf:    registry: https://gitlab.com/chromaway/core/directory-chain    path: src/lib/iccf    tagOrBranch: 1.87.0    rid: x"9C359787B75927733034EA1CEE74EEC8829D2907E4FC94790B5E9ABE4396575D"    insecure: false

Next, install the library with this command:

bash
chr install

Once the command finishes, your project directory should contain a new src/lib/ft4 folder holding the FT4 library code.

Configure FT4 accounts

Using FT4 accounts in your application begins with importing the required modules, which give you extended authentication and account management features.

Put these imports in your main Rell file:

src/main.rell
module;import lib.ft4.accounts.{ account: account };import ft4_auth: lib.ft4.auth;import lib.ft4.accounts.strategies.open;

The FT4 accounts documentation explains FT4 account permissions and usage in more depth.

Update chromia.yml for testing

To run tests, place the test section under the blockchains tag in your chromia.yml file. The result should match this configuration:

chromia.yml
blockchains:  tic_tac_toe:    module: main    moduleArgs:        lib.ft4.core.admin:          admin_pubkey: x"023BEE5A479CE5AF31F6F64EDE7BEAD394E92E4D973E1727782DB577A55E878563" # It can be completely random for learning purposes.compile:  rellVersion: 0.14.9database:  schema: schema_tic_tac_toetest:  modules:    - test.tic_tac_toe  moduleArgs:      lib.ft4.core.admin:        admin_pubkey: x"023BEE5A479CE5AF31F6F64EDE7BEAD394E92E4D973E1727782DB577A55E878563" # It can be completely random for learning purposes.libs:  ft4:    registry: https://gitlab.com/chromaway/ft4-lib.git    path: rell/src/lib/ft4    tagOrBranch: v1.2.0r    rid: x"E96915FD7C9A5DD4E183D86F4A5B4BB5083A7CC1EDEB1465EDFFC926E67C93F6"    insecure: false  iccf:    registry: https://gitlab.com/chromaway/core/directory-chain    path: src/lib/iccf    tagOrBranch: 1.87.0    rid: x"9C359787B75927733034EA1CEE74EEC8829D2907E4FC94790B5E9ABE4396575D"    insecure: false

With this chromia.yml in place, your blockchain project, database schema, FT4 library, and tests are all configured correctly. The Chromia project configuration documentation covers further project configuration options.

Written for this site from Chromia’s public course. Code samples are the course’s own.