-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(accounts): add genesis account initialization (#20642)
Co-authored-by: unknown unknown <unknown@unknown>
- Loading branch information
1 parent
d3d6448
commit 40492cd
Showing
9 changed files
with
362 additions
and
150 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,48 @@ | ||
# x/accounts | ||
|
||
The x/accounts module provides module and facilities for writing smart cosmos-sdk accounts. | ||
The x/accounts module provides module and facilities for writing smart cosmos-sdk accounts. | ||
|
||
# Genesis | ||
|
||
## Creating accounts on genesis | ||
|
||
In order to create accounts at genesis, the `x/accounts` module allows developers to provide | ||
a list of genesis `MsgInit` messages that will be executed in the `x/accounts` genesis flow. | ||
|
||
The init messages are generated offline. You can also use the following CLI command to generate the | ||
json messages: `simd accounts tx init [account type] [msg] --from me --genesis`. This will generate | ||
a jsonified init message wrapped in an x/accounts `MsgInit`. | ||
|
||
This follows the same initialization flow and rules that would happen if the chain is running. | ||
The only concrete difference is that this is happening at the genesis block. | ||
|
||
For example, given the following `genesis.json` file: | ||
|
||
```json | ||
{ | ||
"app_state": { | ||
"accounts": { | ||
"init_account_msgs": [ | ||
{ | ||
"sender": "account_creator_address", | ||
"account_type": "lockup", | ||
"message": { | ||
"@type": "cosmos.accounts.defaults.lockup.MsgInitLockupAccount", | ||
"owner": "some_owner", | ||
"end_time": "..", | ||
"start_time": ".." | ||
}, | ||
"funds": [ | ||
{ | ||
"denom": "stake", | ||
"amount": "1000" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The accounts module will run the lockup account initialization message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.