Get a container for your dapp
In this topic, you'll go through the steps of getting a container for your dapp.
Prerequisites
Before you begin, ensure you have the following:
- Chromia CLI
- Project config file (
chromia.yml
) - Your key pair (
privkey
andpubkey
)
Step 1: Generate a key pair
Begin with generating a public and private key pair. Use the chr keygen --key-id=TEXT
command to create key pair
(privkey
and pubkey
) files in the .chromia
folder. You'll need the keys to lease a container and deploy your dapp.
If your TEXT
string is myKey
then the public key is stored as myKey.pubkey
and private key as myKey
. To use a
key pair by its key ID, set the property key.id = <key_id>
in your Chromia configuration (.chromia/config
) file. If
the config file does not exist, then you can create one in the .chromia
folder.
- Windows:
C:\Users\<YourUsername>\.chromia\config
- macOS and Linux:
/Users/<YourUsername>/.chromia/config
or/home/<YourUsername>/.chromia/config
For more information, refer to the keygen command.
You can copy and share the public key, while the private key should always be kept secret.
Once you have your key pair, you must use CHR token to lease a container and deploy a dapp to the Mainnet.
Step 2: Create a Chromia account
When you lease a container, you must pay the network in native CHR tokens. These fees are collected into a resource pool and distributed to network providers and stakeholders. You need a Chromia account with CHR tokens to pay for the container lease.
To create a Chromia account, you must deposit CHR from either BNB Smart Chain or Ethereum Mainnet to the Chromia Economy Chain:
-
Prepare your wallet: Ensure you have at least 10 CHR tokens on either BNB Smart Chain or Ethereum Mainnet in a compatible wallet (e.g., MetaMask).
-
Visit the Chromia Vault: Go to https://vault.chromia.com/en/deposit.
-
Connect your wallet: Connect your EVM-compatible wallet to the Vault interface.
-
Select your source network: Choose either BNB Smart Chain or Ethereum Mainnet as your source network.
-
Deposit CHR: Follow the deposit process to transfer CHR from your chosen network to the Chromia Economy Chain.
-
Account activation: Your Chromia account will be created and activated automatically during the deposit process.
Next, you use the Chromia account to lease a container for your dapp.
Step 3: Lease container space
Chromia checks your account for any ongoing leases. If you don't have any existing lease, it asks you to lease a new container.
-
On the Container lease page, click the Lease a container button.
-
Select your container cluster.
-
Next, you configure and lease container space by entering your public key, adjusting for SCUs, storage, and duration. You can also enable auto-renewal for the lease.
-
Once you accept the total price for the given configuration, click Lease. A payment is initiated for the given amount. Then, you are allocated the container lease.
Once the process is complete, note down your Container ID, which will be used in the deployment process.
If the container lease process fails for some reason, a refund is initiated for the same amount.