Skip to main content

Get a container for your dapp

In this section, you’ll complete the steps needed to obtain a container for your dapp.

Prerequisites

Ensure you have the following before proceeding:

  • tCHR tokens: Required to lease a container. Follow the instructions in Get test tokens (tCHR) to obtain tokens. This step includes creating a Chromia account if you don’t already have one.
  • Chromia CLI and a public-private key pair: Install Chromia CLI using the CLI installation guide, then generate a key pair by following the steps below.

Step 1: Generate a key pair

With Chromia CLI installed, you’ll need to create a public-private key pair. Run the following command and specify a key ID to keep it easily identifiable. For example:

chr keygen --key-id="testnet_container_key"

This command will save your key pair in the .chromia folder:

  • Public key: .chromia/testnet_container_key.pubkey
  • Private key: .chromia/testnet_container_key
info

Using a custom key ID, like "testnet_container_key", helps you manage multiple keys and identify specific purposes (e.g., for testnet use). If you use chr keygen without specifying a key ID, it will default to chromia_key. Be aware that using this default key ID can risk overwriting the key if chr keygen is run again without specifying an ID.

danger

Keep your private key secure. You may share the public key, but the private key should never be shared.

For more information, see the keygen documentation.

Step 2: Lease container space

With tCHR tokens in your account and your key pair ready, you can now lease a container.

  1. Go to the testnet staking page, connect your wallet, and ensure that BNB Smart Chain Testnet is selected as the blockchain.
  2. After connecting, open the Containers tab at the top of the page and select My Containers.
  3. Click Lease a new container.
  4. Choose an available container cluster and follow the prompts.
  5. Enter your public key: Locate your public key at .chromia/testnet_container_key.pubkey (or the filename you specified with --key-id) and enter it when requested.
  6. Complete the leasing process. After this, you’ll receive a Container ID for deploying your dapp.

Keep track of your Container ID

You’ll need your Container ID later to deploy your dapp. Feel free to note it down or retrieve it anytime by going to the testnet staking page and navigating to My Containers.