Skip to content

Commit 6f2de1e

Browse files
authored
chore: Improve genesis override documentation in the CLI docs (#4782)
1 parent 03848aa commit 6f2de1e

File tree

1 file changed

+59
-6
lines changed

1 file changed

+59
-6
lines changed

docs/docs/08-configuration/01-config.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,59 @@ to describe the development environment for your blockchain.
1414
Only a default set of parameters is provided. If more nuanced configuration is
1515
required, you can add these parameters to the `config.yml` file.
1616

17+
## Genesis
18+
19+
The genesis file is the initial block of your blockchain. It is required to launch a chain because it contains important
20+
information such as token balances and modules' state.
21+
By default, genesis is stored at `$DATA_DIR/config/genesis.json`.
22+
23+
Since the genesis file is frequently reinitialized during development, you can persistently set options using the
24+
`genesis` property in your `config.yml`:
25+
26+
```yml
27+
genesis:
28+
app_state:
29+
staking:
30+
params:
31+
bond_denom: "denom"
32+
```
33+
34+
To discover which properties the genesis file supports, initialize a chain and inspect the generated genesis file in the
35+
data directory.
36+
37+
### Overriding Genesis Parameters (e.g., chain_id, balances, etc.)
38+
39+
You may need to customize specific parameters in the genesis file, such as `chain_id`, token balances, module
40+
parameters, or custom state.
41+
42+
To override genesis values with Ignite CLI, persistently set overrides in the `genesis`property of your `config.yml`.
43+
Any YAML structure under `genesis` will be merged into the generated `genesis.json` during initialization.
44+
45+
Eg: Changing `chain_id` and `staking` parameters
46+
47+
```yml
48+
genesis:
49+
chain_id: "my-custom-chain"
50+
app_state:
51+
staking:
52+
params:
53+
bond_denom: "mytoken"
54+
bank:
55+
balances:
56+
- address: "cosmos1..."
57+
coins:
58+
- denom: "mytoken"
59+
amount: "1000000"
60+
```
61+
62+
- `chain_id`: Sets the chain ID for your blockchain.
63+
- `app_state`: Allows you to modify module states (e.g., staking, bank, etc.).
64+
65+
> ⚠️ If you set `chain_id` in the `genesis`, it will persist across `ignite chain init` or `ignite chain serve` runs.
66+
67+
The `genesis` property supports deep merging and can override any field present in the generated genesis file.
68+
For more complex setups, you can use the `include` field in `config.yml` to split overrides into multiple files.
69+
1770
## Validation
1871

1972
Ignite uses the `validation` field to determine the kind of validation
@@ -41,9 +94,9 @@ A list of user accounts created during genesis of the blockchain.
4194
```yml
4295
accounts:
4396
- name: alice
44-
coins: ['20000token', '200000000stake']
97+
coins: [ '20000token', '200000000stake' ]
4598
- name: bob
46-
coins: ['10000token', '100000000stake']
99+
coins: [ '10000token', '100000000stake' ]
47100
```
48101

49102
Ignite uses information from `accounts` when initializing the chain with `ignite
@@ -80,7 +133,7 @@ address of this key pair.
80133
```yml
81134
accounts:
82135
- name: bob
83-
coins: ['20000token', '200000000stake']
136+
coins: [ '20000token', '200000000stake' ]
84137
address: cosmos1s39200s6v4c96ml2xzuh389yxpd0guk2mzn3mz
85138
```
86139

@@ -91,7 +144,7 @@ address will be derived from a mnemonic.
91144
```yml
92145
accounts:
93146
- name: bob
94-
coins: ['20000token', '200000000stake']
147+
coins: [ '20000token', '200000000stake' ]
95148
mnemonic: cargo ramp supreme review change various throw air figure humble soft steel slam pole betray inhale already dentist enough away office apple sample glue
96149
```
97150

@@ -114,7 +167,7 @@ can use the `cointype` field to provide the integer value
114167
```yml
115168
accounts:
116169
- name: bob
117-
coins: ['20000token', '200000000stake']
170+
coins: [ '20000token', '200000000stake' ]
118171
cointype: 7777777
119172
```
120173

@@ -212,7 +265,7 @@ The faucet service sends tokens to addresses.
212265
```yml
213266
faucet:
214267
name: bob
215-
coins: ["5token", "100000stake"]
268+
coins: [ "5token", "100000stake" ]
216269
```
217270

218271
`name` refers to a key name in the `accounts` list. This is a required property.

0 commit comments

Comments
 (0)