<commit_before># DCL Mainnet Launch Guide

<!-- markdownlint-disable MD029 -->
This document is a step-by-step guide for DCL Mainnet launch ceremony. It  describes the following stages in details:

* Pre-Ceremony
* Ceremony
* Post-Ceremony

Please see [Running a DCLedger Node](../../../docs/running-node.md) to get the general understanding
of a node setup logic along with requirements for the hardware and operating system.

## I. Pre-Ceremony

The following steps are expected to be done **before** the ceremony.

1. **Configure Validator/Sentry Node**

    1.1. `Ubuntu 20.04 LTS` is recommended.

    1.2. Ensure a DCL user is in sudoers list (required only for the ceremony):

    * Note. by default `ubuntu` user is expected as a running user for the DCL service.
        You can use/create another one if it doesn't work for you. In any case you will need to ensure
        that the user can do `sudo`.

    1.3. Login as a DCL user

    1.4. (Optional) Clean up the system
    * Note. Following steps are needed if you earlier version of DCL installed on the same computer.

    ```bash
    sudo systemctl stop dcld
    sudo rm -f "$(which dcld)"
    rm -rf "$HOME/.dcl"
    ```

    1.5. Get the release artifacts (DCL v0.12.0):

    ```bash
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/dcld
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/cosmovisor
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/cosmovisor.service
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/run_dcl_node
    ```

    1.6. Put `cosmovisor` binary in a folder listed in `$PATH` (e.g. `/usr/bin/`) and set a proper owner and executable permissions.

    ```bash
    sudo cp -f ./cosmovisor -t /usr/bin
    sudo chown "<dcl-user>" /usr/bin/cosmovisor
    sudo chmod u+x /usr/bin/cosmovisor
    ```

    1.7. Configure the firewall

    * p2p and RPC (by default: `26656` and `26657` respectively) should be available for TCP connections.
        For Ubuntu:

        ```bash
        sudo ufw allow 26656/tcp
        sudo ufw allow 26657/tcp
        ```

    * In case of IP filtering rules ensure they allow incoming and outcoming connections from/to other peers.

    * (Optional) you may consider to allow the following ports:
        * gRPC (default: `9090`)
        * REST (default: `1317`)

2. **Initialize Node**

    ```bash
    ./dcld init "<node-name>" --chain-id "main-net"
    ```

    * Naming convention for `<node-name>` is `[company name]-[node type]-[sequence number]` e.g. `<CSA-VN-01>`

3. **Generate Validator NodeAdmin keys (VN only)**

    3.1. Go to VN Node

    3.2. Generate keys

    ```bash
    ./dcld keys add "<admin-account-name>" 2>&1 | tee "<admin-account-name>.dclkey.data"
    ```

    **IMPORTANT** keep generated data (especially the mnemonic) securely.

    3.3. Share generated `address` and `pubkey` (in Slack or in a special doc).

    `address` and `pubkey` can be found in the `dcld keys show --output text "<admin-account-name>"` output.

4. **[Optional] Generate Trustee keys (VN only)**

    4.1. Choose a machine where Trustee keys will be hold (it can be either VN Node, or a separate machine with `dcld` binary)

    4.2. Generate keys

    ```bash
    ./dcld keys add "<trustee-account-name>" 2>&1 | tee "<trustee-account-name>.dclkey.data"
    ```

    **IMPORTANT** keep generated data (especially the mnemonic) securely.

    4.3. Share generated `address` and `pubkey` (in Slack or in a special doc).

    `address` and `pubkey` can be found in the `dcld keys show --output text "<trustee-account-name>"` output.

5. **Share Node info with other Node Admins** (in Slack or in a special doc)

    5.1. Share Sentry Node's (VN's if a sentry node is not used) public IP address

    5.2. Share Sentry Node's (VN's if a sentry node is not used) `id`
    - Get node's `id` using the following command:
        ```bash
        ./dcld tendermint show-node-id
        ```

## II. Ceremony
6. **Wait until the CSA Mainnet infrastructure is up and running**

    6.1. Go to https://dcl.csa-iot.org to access DCL Web UI and follow the ceremony procedure

7. **Run Sentry Node (skip this section if you are not running a sentry node)**

    7.1. Download genesis

    ```bash
    curl -L -O https://raw.githubusercontent.com/zigbee-alliance/distributed-compliance-ledger/master/deployment/persistent_chains/main-net/genesis.json
    ```

    7.2. Prepare `persistent_peers.txt` file 
    - download or copy-paste up-to date `persistent_peers.txt` file to the same directory as `run_dcl_node`

    7.3. Run Sentry Node

    ```bash
    chmod u+x run_dcl_node
    ./run_dcl_node -t private-sentry -c main-net "<node-name>"
    ```
    * Naming convention for `<node-name>` is `[company name]-[node type]-[sequence number]` e.g. `<CSA-SN-01>`<commit_msg>Remove non existing link from mainnet launch doc<commit_after># DCL Mainnet Launch Guide

<!-- markdownlint-disable MD029 -->
This document is a step-by-step guide for DCL Mainnet launch ceremony. It  describes the following stages in details:

* Pre-Ceremony
* Ceremony
* Post-Ceremony

Please see [Running a DCLedger Node](../../../docs/running-node.md) to get the general understanding
of a node setup logic along with requirements for the hardware and operating system.

## I. Pre-Ceremony

The following steps are expected to be done **before** the ceremony.

1. **Configure Validator/Sentry Node**

    1.1. `Ubuntu 20.04 LTS` is recommended.

    1.2. Ensure a DCL user is in sudoers list (required only for the ceremony):

    * Note. by default `ubuntu` user is expected as a running user for the DCL service.
        You can use/create another one if it doesn't work for you. In any case you will need to ensure
        that the user can do `sudo`.

    1.3. Login as a DCL user

    1.4. (Optional) Clean up the system
    * Note. Following steps are needed if you earlier version of DCL installed on the same computer.

    ```bash
    sudo systemctl stop dcld
    sudo rm -f "$(which dcld)"
    rm -rf "$HOME/.dcl"
    ```

    1.5. Get the release artifacts (DCL v0.12.0):

    ```bash
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/dcld
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/cosmovisor
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/cosmovisor.service
    curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/v0.12.0/run_dcl_node
    ```

    1.6. Put `cosmovisor` binary in a folder listed in `$PATH` (e.g. `/usr/bin/`) and set a proper owner and executable permissions.

    ```bash
    sudo cp -f ./cosmovisor -t /usr/bin
    sudo chown "<dcl-user>" /usr/bin/cosmovisor
    sudo chmod u+x /usr/bin/cosmovisor
    ```

    1.7. Configure the firewall

    * p2p and RPC (by default: `26656` and `26657` respectively) should be available for TCP connections.
        For Ubuntu:

        ```bash
        sudo ufw allow 26656/tcp
        sudo ufw allow 26657/tcp
        ```

    * In case of IP filtering rules ensure they allow incoming and outcoming connections from/to other peers.

    * (Optional) you may consider to allow the following ports:
        * gRPC (default: `9090`)
        * REST (default: `1317`)

2. **Initialize Node**

    ```bash
    ./dcld init "<node-name>" --chain-id "main-net"
    ```

    * Naming convention for `<node-name>` is `[company name]-[node type]-[sequence number]` e.g. `<CSA-VN-01>`

3. **Generate Validator NodeAdmin keys (VN only)**

    3.1. Go to VN Node

    3.2. Generate keys

    ```bash
    ./dcld keys add "<admin-account-name>" 2>&1 | tee "<admin-account-name>.dclkey.data"
    ```

    **IMPORTANT** keep generated data (especially the mnemonic) securely.

    3.3. Share generated `address` and `pubkey` (in Slack or in a special doc).

    `address` and `pubkey` can be found in the `dcld keys show --output text "<admin-account-name>"` output.

4. **[Optional] Generate Trustee keys (VN only)**

    4.1. Choose a machine where Trustee keys will be hold (it can be either VN Node, or a separate machine with `dcld` binary)

    4.2. Generate keys

    ```bash
    ./dcld keys add "<trustee-account-name>" 2>&1 | tee "<trustee-account-name>.dclkey.data"
    ```

    **IMPORTANT** keep generated data (especially the mnemonic) securely.

    4.3. Share generated `address` and `pubkey` (in Slack or in a special doc).

    `address` and `pubkey` can be found in the `dcld keys show --output text "<trustee-account-name>"` output.

5. **Share Node info with other Node Admins** (in Slack or in a special doc)

    5.1. Share Sentry Node's (VN's if a sentry node is not used) public IP address

    5.2. Share Sentry Node's (VN's if a sentry node is not used) `id`
    - Get node's `id` using the following command:
        ```bash
        ./dcld tendermint show-node-id
        ```

## II. Ceremony
6. **Wait until the CSA Mainnet infrastructure is up and running**

    6.1. Access DCL Web UI link provided by CSA and follow the ceremony procedure

7. **Run Sentry Node (skip this section if you are not running a sentry node)**

    7.1. Download genesis

    ```bash
    curl -L -O https://raw.githubusercontent.com/zigbee-alliance/distributed-compliance-ledger/master/deployment/persistent_chains/main-net/genesis.json
    ```

    7.2. Prepare `persistent_peers.txt` file 
    - download or copy-paste up-to date `persistent_peers.txt` file to the same directory as `run_dcl_node`

    7.3. Run Sentry Node

    ```bash
    chmod u+x run_dcl_node
    ./run_dcl_node -t private-sentry -c main-net "<node-name>"
    ```
    * Naming convention for `<node-name>` is `[company name]-[node type]-[sequence number]` e.g. `<CSA-SN-01>`
{'fraction_non_alphanumeric': 0.11813925689809741, 'fraction_numerical': 0.02171531028986951, 'mean_word_length': 2.877945152568559, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1217503', 'n_tokens_mistral': 3466, 'n_tokens_neox': 3157, 'n_words': 1192}