Set up a project
In this section, you set up a project to use FT3.
First, you clone FT3's bootstrap project repository:
git clone https://bitbucket.org/chromawallet/develop-chromia.git
Create a new directory for your project, and copy the
Rell directories to your project. The remaining
an example for Single Sign-On (SSO) feature so that you can return to it later.
Set up blockchain
Config dapp description
- Go to
postchain/config/nodes/, and you'll see a
devdirectory. This is the postchain config directory.
- Inside the
devdirectory, copy the file
blochains/app/config.template.xml, and put the copy inside the
- Change the settings in the
config.ymlfor your chain:
"YOUR_CHAIN_NAME": #Name of the blockchain
module: main #Entrypoint to the project
Name of your chain.
"Main page" URL of your dapp.
Description of your dapp.
The following arguments are settings for the rate limiter (spam
prevention). The client accumulates one "operation point" every
rate_limit_recovery_time milliseconds, up to
You spend one operation point for each operation.
0 for not active (no spam prevention) or 1 to activate the rate limit. Note that even if the rate limiter isn't active, you must set some values in the following args.
The maximum amount of operation points that are possible to accumulate (and therefore the maximum number of transactions that you can do at once).
(In milliseconds) period of cooling down before an account can receive one operation point.
The points that an account has at the moment of its creation (0 is min).
Please note that if you use Single Sign-On, an account need to perform one
operation immediately at the moment of creation to add disposable
auth_descriptor (e.g., SSO needs
at a minimum of one). Refer to the SSO Section for more information.
Set up database
Follow the instructions in Set up PostgreSQL database. Update the
postchain/config/nodes/dev/node-config.properties file to
match your database settings.
Run the chain
From the root of the blockchain, start your chain:
chr start -s config.yml
You can see the generated blockchain ID of the blockchain in the terminal that looks like this:
INFO 2120-01-01 23:59:59.999 [main] BaseConfigurationDataStore - Creating initial configuration for chain 1 with BC RID:
Note down the blockchain ID; you need to use it to connect to the chain.
Postchain generates a blockchain ID for dapp based on its codebase. Whenever you change the blockchain code of the dapp, you need to wipe the database by adding the
-wipe option to get a new blockchainID:
chr start --wipe
If you missed the log-in console, you could always see the previous log in the
Verify the chain is working
Go to the Chain Explorer, click the dropdown next to Vault, then choose add custom chain:
In the following popup, enter your chain's information using
the information you entered in
config.template.xml and the chain BRID:
If you see the chain's information displayed, then your chain is working properly:
If chain explorer can't connect to your chain, it indicates something
is wrong with your settings from previous steps. Verify that the host and ports and your blockchainID are correct (
7743 is the default port from
With that, the blockchain side is ready. We can go on to the client side.
Set up client
client directory you use in the Bootstrap project is an example client which works with the current chain. This section discusses how to create a client that connects to the chain.
client directory for your project, run
npm init (or
bootstrap a project using a generator,
Add dependencies to the
npm i --save ft3-lib
npm i --save postchain-client
Add other libraries to your liking.
Set config variables
Choose your method to set these important config variables:
export const blockchainRID = "<YOUR CHAIN BRID>";
export const blockchainUrl = "http://localhost:7743/"; // This is default value in node-config.properties file
export const vaultUrl = "https://dev.vault.chromia-development.com"; // Vault's url for SSO
That concluded the project setup process. In the next section, we can
continue working with the client library and discuss the features of the
ft3-lib npm package.