Chromia
Start Building

03 / 04Advanced

Explore the chat agent

You will start the chat agent and work with it from a browser. It accepts natural-language requests, so you can manage Chromia accounts and try out blockchain operations without writing code.

Steps to run the agent

  1. Start the development server: From your project directory, run:

    bash
    npm run dev

    Open the URL the server prints (for example, http://localhost:3000) in your browser.

  2. Connect MetaMask: At the prompt, use MetaMask to connect an EVM account. That account must be linked to a Chromia account that holds tCHR.

Use the chat agent

The agent understands requests for several blockchain operations. Try the examples below.

Check your balance

Send the agent this request:

plaintext
What is my balance?

It responds with the tCHR balance of the connected Chromia account.

Transfer tCHR tokens

To move tCHR tokens to a different Chromia account, enter:

plaintext
Transfer [amount] to <your-second-chromia-account>

First, the agent asks you to confirm the transfer details. Next, MetaMask prompts you to sign the transfer. After you sign, the agent submits the transaction and returns a Chromia Explorer link where you can verify it.

Verify updated balances

Check your own balance after the transfer with:

plaintext
What is my balance now?

To see the recipient's balance, enter:

plaintext
What is the balance of <your-second-chromia-account>?

Get real-time CHR price

Ask for the current CHR price like this:

plaintext
What is the price of CHR?

Transfer a dollar-equivalent amount

To send CHR tokens matching a given USD value, enter:

plaintext
Transfer 10 dollars' worth of CHR to <your-second-chromia-account>

The agent converts the USD amount to CHR using the current price. Confirm the transfer, then sign the message in MetaMask to finish the transaction.

Experiment and explore

Go beyond the examples: query balances of other Chromia accounts, check token price trends, or start transfers with different amounts or currencies. Trying varied requests shows you what the agent can do and where you might customize it.

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