cosmos-sdk/x/genutil
samricotta e2c91fc1d7
refactor(genutil,group,mint): remove aliases from types/math.go (#15824)
## Description

Closes part of: https://github.com/cosmos/cosmos-sdk/issues/14405



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

* [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
* [ ] added `!` to the type prefix if API or client breaking change
* [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
* [ ] provided a link to the relevant issue or specification
* [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules)
* [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
* [ ] added a changelog entry to `CHANGELOG.md`
* [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
* [ ] updated the relevant documentation or specification
* [ ] reviewed "Files changed" and left comments if necessary
* [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

* [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
* [ ] confirmed `!` in the type prefix if API or client breaking change
* [ ] confirmed all author checklist items have been addressed 
* [ ] reviewed state machine logic
* [ ] reviewed API design and naming
* [ ] reviewed documentation is accurate
* [ ] reviewed tests and test coverage
* [ ] manually tested (if applicable)
2023-04-13 12:34:47 +00:00
..
client refactor(genutil,group,mint): remove aliases from types/math.go (#15824) 2023-04-13 12:34:47 +00:00
migrations feat: improve genesis migration command (#15679) 2023-04-04 17:31:42 +00:00
testutil refactor!: use KVStoreService in x/auth (#15520) 2023-03-27 18:57:02 +00:00
types refactor(genutil,group,mint): remove aliases from types/math.go (#15824) 2023-04-13 12:34:47 +00:00
collect_test.go feat: add application genesis (#15031) 2023-02-22 10:29:03 +00:00
collect.go chore: remove requirement on user ips (#15316) 2023-03-08 22:44:01 +00:00
doc.go feat: add application genesis (#15031) 2023-02-22 10:29:03 +00:00
genesis.go refactor!: migrate Cosmos SDK to CometBFT (#14897) 2023-02-05 14:51:33 +01:00
gentx_test.go refactor!: migrate Cosmos SDK to CometBFT (#14897) 2023-02-05 14:51:33 +01:00
gentx.go refactor!: migrate Cosmos SDK to CometBFT (#14897) 2023-02-05 14:51:33 +01:00
module.go style: linting (#15704) 2023-04-06 23:25:23 +00:00
README.md feat: improve genesis migration command (#15679) 2023-04-04 17:31:42 +00:00
utils_test.go refactor!: migrate Cosmos SDK to CometBFT (#14897) 2023-02-05 14:51:33 +01:00
utils.go feat: add application genesis (#15031) 2023-02-22 10:29:03 +00:00

x/genutil

Concepts

The genutil package contains a variaety of genesis utility functionalities for usage within a blockchain application. Namely:

  • Genesis transactions related (gentx)
  • Commands for collection and creation of gentxs
  • InitChain processing of gentxs
  • Genesis file validation
  • Genesis file migration
  • CometBFT related initialization
    • Translation of an app genesis to a CometBFT genesis

Client

CLI

The genutil commands are available under the genesis subcommand.

add-genesis-account

Add a genesis account to genesis.json. Learn more here.

collect-gentxs

Collect genesis txs and output a genesis.json file.

simd genesis collect-gentxs

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).

gentx

Generate a genesis tx carrying a self delegation.

simd genesis gentx [key_name] [amount] --chain-id [chain-id]

This will create the genesis transaction for your new chain. Here amount should be at least 1000000000stake. If you provide too much or too little, you will encounter an error when starting a node.

migrate

Migrate genesis to a specified target (SDK) version.

simd genesis migrate [target-version]

:::tip The migrate command is extensible and takes a MigrationMap. This map is a mapping of target versions to genesis migrations functions. 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. :::

validate-genesis

Validates the genesis file at the default location or at the location passed as an argument.

simd genesis validate-genesis

:::warning 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. :::