github.com/cosmos/cosmos-sdk@v0.50.10/x/genutil/README.md (about)

     1  # `x/genutil`
     2  
     3  ## Concepts
     4  
     5  The `genutil` package contains a variety of genesis utility functionalities for usage within a blockchain application. Namely:
     6  
     7  * Genesis transactions related (gentx)
     8  * Commands for collection and creation of gentxs
     9  * `InitChain` processing of gentxs
    10  * Genesis file creation
    11  * Genesis file validation
    12  * Genesis file migration
    13  * CometBFT related initialization
    14      * Translation of an app genesis to a CometBFT genesis
    15  
    16  ## Genesis
    17  
    18  Genutil contains the data structure that defines an application genesis.
    19  An application genesis consist of a consensus genesis (g.e. CometBFT genesis) and application related genesis data.
    20  
    21  ```go reference
    22  https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/x/genutil/types/genesis.go#L24-L34
    23  ```
    24  
    25  The application genesis can then be translated to the consensus engine to the right format:
    26  
    27  ```go reference
    28  https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/x/genutil/types/genesis.go#L126-L136
    29  ```
    30  
    31  ```go reference
    32  https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/server/start.go#L397-L407
    33  ```
    34  
    35  ## Client
    36  
    37  ### CLI
    38  
    39  The genutil commands are available under the `genesis` subcommand.
    40  
    41  #### add-genesis-account
    42  
    43  Add a genesis account to `genesis.json`. Learn more [here](https://docs.cosmos.network/main/run-node/run-node#adding-genesis-accounts).
    44  
    45  #### collect-gentxs
    46  
    47  Collect genesis txs and output a `genesis.json` file.
    48  
    49  ```shell
    50  simd genesis collect-gentxs
    51  ```
    52  
    53  This will create a new `genesis.json` file that includes data from all the validators (we sometimes call it the "super genesis file" to distinguish it from single-validator genesis files).
    54  
    55  #### gentx
    56  
    57  Generate a genesis tx carrying a self delegation.
    58  
    59  ```shell
    60  simd genesis gentx [key_name] [amount] --chain-id [chain-id]
    61  ```
    62  
    63  This will create the genesis transaction for your new chain. Here `amount` should be at least `1000000000stake`.
    64  If you provide too much or too little, you will encounter an error when starting a node.
    65  
    66  #### migrate
    67  
    68  Migrate genesis to a specified target (SDK) version.
    69  
    70  ```shell
    71  simd genesis migrate [target-version]
    72  ```
    73  
    74  :::tip
    75  The `migrate` command is extensible and takes a `MigrationMap`. This map is a mapping of target versions to genesis migrations functions.
    76  When not using the default `MigrationMap`, it is recommended to still call the default `MigrationMap` corresponding the SDK version of the chain and prepend/append your own genesis migrations.
    77  :::
    78  
    79  #### validate-genesis
    80  
    81  Validates the genesis file at the default location or at the location passed as an argument.
    82  
    83  ```shell
    84  simd genesis validate-genesis
    85  ```
    86  
    87  :::warning
    88  Validate genesis only validates if the genesis is valid at the **current application binary**. For validating a genesis from a previous version of the application, use the `migrate` command to migrate the genesis to the current version.
    89  :::