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 Chroma (CHR) token to lease a container and deploy a dapp to the mainnet.
Step 2: Create a Chromia account
Once you have your key pair, you need to lease a container on the testnet using test Chroma token (tCHR). You can get tCHR through a faucet by following the instructions on the Staking Page. As a spam prevention measure, you must stake a small amount of real CHR (10 CHR), which will enable you to ask for new test tokens weekly from the faucet. To learn more about Chromia's container lease model, visit the hosting fee overview topic.
If you are participating in the Incentivized Testing Program, you can deploy to several testnets. Select the appropriate network when going through the flow on the Staking page:
- ProjectNet: Select this network to deploy a dapp for learning, testing, and demo purposes.
- HackNet: Select this network if you are participating in the bug bounty and deploying a dapp as part of your search for bugs and security vulnerabilities.
Note that these are testnets; data may not persist between testnet updates.
-
Navigate to the Staking page and click the Container lease link.
-
Connect your wallet by clicking the Connect wallet button.
Once you connect your wallet. Chromia checks whether you have a Chromia account and if it already has a lease connected to it. If you don't have an account, it asks you to sign up for a Chromia account.
-
Create your Chromia account by clicking the Create Chromia account button.
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 new container button.
-
Select your container cluster.
-
Follow the steps on on the Container lease page, selecting the appropriate network. Once you stake, get tCHR, and lease a container, you'll receive a container ID.
-
Once the process is complete, note down your Container ID, which will be used in the deployment process.