# Deploy your dapp to Mainnet · Chromia Docs (concept)

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

Source: https://docs.chromia.com/build/deployment/mainnet/deploy-dapp/

# Deploy your dapp to Mainnet

On this page

* [Prerequisites](#prerequisites)
* [Deploy the dapp](#deploy-the-dapp)
* [Update the dapp](#update-the-dapp)

This topic covers deploying and updating a dapp with the Chromia CLI to the public Mainnet. For more information, see
the [deployment command](https://docs.chromia.com/build/cli/commands/deployment/).

info

For information on deploying your dapp to Testnet, see the
[Deploy your dapp to Testnet](https://docs.chromia.com/get-started/create-dapp/deploy-to-testnet/) topic.

## Prerequisites

* Install Chromia CLI; see [Install and configure Chromia CLI](https://docs.chromia.com/get-started/installation/).
* Build a dapp that compiles; see
  [Build and run the Hello World dapp with Chromia CLI](https://docs.chromia.com/get-started/create-dapp/run-dapp-cli/).
* Container ID (follow the instructions on the [Get a container for your dapp](https://docs.chromia.com/build/deployment/mainnet/get-container/)
  page to lease a container).

Pre-deploy checklist

Ensure your `chromia.yml` includes: `deployments.mainnet.brid`, `url`, `container`, and that `chains` is empty for first
deployment.

## Deploy the dapp

1. Copy the `deployments` key in the `chromia.yml` file example below into your config file. Replace the `<ContainerID>`
   with the Container ID you got from the [Chromia Vault](https://vault.chromia.com/en/containers/) when you leased a container.

YAML

```
blockchains:
   hello: #Name of the blockchain
     module: main #Entrypoint to the project
 deployments:
   mainnet: #Deployment Target name
     container: <ContainerID> # Container ID (Example - container: 15ddfcb25dcb43577ab311fe78aedab14fda25757c72a787420454728fb80304)
```

Using `mainnet` as the deployment name automatically configures the `brid` and `url` for you. A custom deployment name
would require these to be specified manually. See
[deployment configuration](https://docs.chromia.com/build/configuration/project-config/#deployments) for more details.

2. Execute the following command to deploy a specific chain to a specific target.

   Terminal

   ```
   chr deployment create --settings chromia.yml --network mainnet --blockchain hello
   ```

   By default, this command reads the `keyId` from the configuration file located at `.chromia/config`.

   * **Windows:** `C:\Users\<YourUsername>\.chromia\config`
   * **macOS and Linux:** `/Users/<YourUsername>/.chromia/config` or `/home/<YourUsername>/.chromia/config`

   If you prefer to use a different configuration file, you can specify the path using the `--config` option:

   Terminal

   ```
   chr deployment create --settings chromia.yml --network mainnet --blockchain hello --config <config file path>
   ```

   This allows you to set the `keyId` in a specific config file instead of the global configuration.

   info

   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 successful 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:

   YAML

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

Great. You have now done your first deployment. Please see the
[Hello World Quickstart](https://docs.chromia.com/build/clients/postchain-clients/javascript-typescript/hello-world-quickstart/) 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.

info

The limitations on updating [Rell](https://docs.chromia.com/rell/rell-intro/) entities are available
[here](https://docs.chromia.com/rell/language-features/modules/entity/#changing-entity-definitions).

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

YAML

```
blockchains:
  hello:
    module: main
deployments:
  mainnet:
    container: <ContainerID>
    chains:
      hello: x"<BlockchainRID>" #Dapp Blockchain RID
```

Run the following command to update your dapp:

Terminal

```
chr deployment update --settings chromia.yml --network mainnet --blockchain hello
```

To learn more about developing production-ready dapps, visit the [Chromia course page](https://chromia.com/learn/).

[View this page on docs.chromia.com](https://docs.chromia.com/build/deployment/mainnet/deploy-dapp/)Content mirrored from the live docs
