Skip to main content

Deploy your dapp to Testnet

This topic covers deploying and updating a dapp with the Chromia CLI to the public Testnet. For more information, see deploy command.


Deploy the dapp

The important files for the deployment of a dapp are as follows:

Begin with generating a public and private key pair that's available in a .secret file.

  1. Write the following command to create a .secret file with a generated key pair (privkey and pubkey).
chr keygen --save .secret

You find the public and private key in the created .secret file. You can copy and share the public key, while the private key should be kept as a secret in the .secret file.

#Keypair generated using...

Once you have your key pair, you need to stake Chroma token to deploy a dapp to the current testnet.

  1. To stake Chroma token, follow the instructions on the Staking Page. Once you stake a minimum of 100 CHR, you can request a container ID. You need to use this container ID to deploy your dapp in the following example.

The current public testnet has limited capacity; therefore, it requires staking. This might change as we increase the capacity of the testnet.

Once you receive the container ID, the container gets deleted from the network unless you deploy a dapp within 48 hours. If that happens, you can return to the staking page and request a new container ID if there is still capacity.

Note that this is a testnet, and data may not persist between testnet updates.

  1. Copy the deployments key in the config.yml file example below into your config file. Replace the <ContainerID> with the Container ID you got from the staking page.
hello: #Name of the blockchain
module: main #Entrypoint to the project
testnet: #Deployment Target name
brid: x"E657470405E234386DBF287FC4658580613A8FAF62DCE0EAE503C4A794CCFEC4" #Blockchain RID for the testnet management chain
url: #Target URL for one of the nodes in the testnet
container: <ContainerID> #Container ID
  1. To deploy a specific chain to a specific target, write the following command.
chr deploy --settings config.yml --target testnet --blockchain hello --secret .secret

If you get an error while deploying your dapp then make some changes to your dapp code. Chromia uses dapp configuration and code to create the Blockchain RID, which must be unique for each dapp.

After a sucessful deployment, you get the dapp Blockchain RID as a prompt in the terminal. It identifies your dapp for future deployments (updates). The prompt could look as follows.

Add the following to your project settings file
hello: x"<BlockchainRID>" #Dapp Blockchain RID
  1. Add the chains key with the dapp name: Blockchain RID from the prompt to the config.yml file. This is important for updating your dapp in the future.

Great. You have now done your first deployment. Please see the section Configure Client for Chromia Network if you want to configure the client code to connect to your deployed dapp.

Update the dapp

Once you have done your first deployment, you can perform an update of your dapp.


The limitations on updating Rell entities are available here.

Your config.yml must now have the chains config included.

module: main
brid: x"E657470405E234386DBF287FC4658580613A8FAF62DCE0EAE503C4A794CCFEC4"
container: <ContainerID>
hello: x"<BlockchainRID>" #Dapp Blockchain RID
  1. To update your dapp, write the following command.
chr deploy --settings config.yml --target testnet --blockchain hello --secret .secret

When updating a dapp, you use the same command as for deployment but with the dapp Blockchain RID included in the config.yml file. You aren't prompted with anything this time, but a snapshot file gets created which is also the case for deployment.