mukan-sdk/x/genutil
Mukan Erkin Törük 20afb5db80
Some checks failed
Build SimApp / build (amd64) (push) Waiting to run
Build SimApp / build (arm64) (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Build & Push / build (push) Waiting to run
Run Gosec / Gosec (push) Waiting to run
Lint / golangci-lint (push) Waiting to run
Checks dependencies and mocks generation / Check go mod tidy (push) Waiting to run
Checks dependencies and mocks generation / Check up to date mocks (push) Waiting to run
System Tests / setup (push) Waiting to run
System Tests / test-system (push) Blocked by required conditions
System Tests / test-system-legacy (push) Blocked by required conditions
Tests / Code Coverage / split-test-files (push) Waiting to run
Tests / Code Coverage / tests (00) (push) Blocked by required conditions
Tests / Code Coverage / tests (01) (push) Blocked by required conditions
Tests / Code Coverage / tests (02) (push) Blocked by required conditions
Tests / Code Coverage / tests (03) (push) Blocked by required conditions
Tests / Code Coverage / test-integration (push) Waiting to run
Tests / Code Coverage / test-e2e (push) Waiting to run
Tests / Code Coverage / repo-analysis (push) Blocked by required conditions
Tests / Code Coverage / test-sim-nondeterminism (push) Waiting to run
Tests / Code Coverage / test-clientv2 (push) Waiting to run
Tests / Code Coverage / test-core (push) Waiting to run
Tests / Code Coverage / test-depinject (push) Waiting to run
Tests / Code Coverage / test-errors (push) Waiting to run
Tests / Code Coverage / test-math (push) Waiting to run
Tests / Code Coverage / test-schema (push) Waiting to run
Tests / Code Coverage / test-collections (push) Waiting to run
Tests / Code Coverage / test-cosmovisor (push) Waiting to run
Tests / Code Coverage / test-confix (push) Waiting to run
Tests / Code Coverage / test-store (push) Waiting to run
Tests / Code Coverage / test-log (push) Waiting to run
Tests / Code Coverage / test-x-tx (push) Waiting to run
Tests / Code Coverage / test-x-nft (push) Waiting to run
Tests / Code Coverage / test-x-circuit (push) Waiting to run
Tests / Code Coverage / test-x-feegrant (push) Waiting to run
Tests / Code Coverage / test-x-evidence (push) Waiting to run
Tests / Code Coverage / test-x-upgrade (push) Waiting to run
Tests / Code Coverage / test-tools-benchmark (push) Waiting to run
Build & Push SDK Proto Builder / build (push) Has been cancelled
initial: sovereign Mukan Network fork
2026-05-11 03:18:24 +03:00
..
client initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
migrations initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
testutil initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
types initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
collect.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
collect_test.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
doc.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
genaccounts.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
genesis.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
gentx.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
gentx_test.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
module.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
README.md initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
utils.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00
utils_test.go initial: sovereign Mukan Network fork 2026-05-11 03:18:24 +03:00

x/genutil

Concepts

The genutil package contains a variety 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 creation
  • Genesis file validation
  • Genesis file migration
  • CometBFT related initialization
    • Translation of an app genesis to a CometBFT genesis

Genesis

Genutil contains the data structure that defines an application genesis. An application genesis consist of a consensus genesis (g.e. CometBFT genesis) and application related genesis data.

https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/x/genutil/types/genesis.go#L24-L34

The application genesis can then be translated to the consensus engine to the right format:

https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/x/genutil/types/genesis.go#L126-L136
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-rc.0/server/start.go#L397-L407

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