Skip to main content

Build and run

In this topic, you'll build and deploy the Hello World dapp with the Chromia Command-line Interface (Chromia CLI). Read more about the features of the Chromia CLI in the Chromia CLI command reference section.

Prerequisites

Run dapp in Chromia CLI

Once you install the Chromia CLI, it's time to create a project.

  1. Create the project folder in a path of your choice and use the chr create-rell-dapp command.

    chr create-rell-dapp

    The chr create-rell-dapp command creates a new Rell structured project my-rell-dapp with the necessary files. A main.rell file, which includes the Hello World query and test files in the src/test/ folder. You also have a standard configuration for your project in the chromia. yml file. For more information, see the project config file.

    my-rell-dapp
    |--chromia.yml
    |--src
    |--main.rell
    |--test
    |--arithmetic_test.rell
    |--data_test.rell

    The next step is to start a node and run your app locally. You can do it in a couple of different ways, but the most straightforward method we recommend is the Chromia CLI.

  2. Start the node using the chr node start command inside the newly created project directory:

    cd my-rell-dapp
    chr node start

    The chr node start command starts a node with your applications running on it. All the blockchains listed in the blockchains key in the chromia.yml file get started.

    blockchains:
    my_rell_dapp: <----- This is the blockchain that starts
    module: main <----- This is the entry point of the chain

    The node should now be running with a local blockchain. The terminal where you ran chr node start will display info messages about committed blocks and transactions. Any print statements in your Rell code will also appear there.

    The last step is to query your dapp and test that the backend works correctly.

  3. Write the following in a new terminal with your project folder as the working directory. Remember to replace the <BlockchainRID> with your Blockchain RID from the node output.

    chr query hello_world
    note

    If your node is running on a URL other than the default http://localhost:7740, use the --api-url option with chr query.

  4. Your terminal should show you the following message.

    "Hello World!"

Great job. The Rell backend is up and running and works as it should. You have now run a Hello World dapp in the Chromia CLI.

Optional Next steps

Now that your Rell backend is running, you can:

;