-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Module account address documentation #22289
Changes from all commits
d813d94
e0735b7
b6a45d6
ac1a4bc
2ea67e6
62a4e54
69cb74c
0f1d89b
73865eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,26 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/codec/address/bech32_co | |
| Validator Operator | cosmosvaloper | | ||
| Consensus Nodes | cosmosvalcons | | ||
|
||
|
||
### Module Accounts | ||
|
||
Module accounts are special accounts used by modules to perform specific operations within the blockchain. These accounts are not controlled by users but by the modules themselves. Each module account has a unique name and a set of permissions that define what operations it can perform. Examples of module accounts include the distribution module account, which handles the distribution of staking rewards and the governance module account, which manages the funds related to governance proposals. | ||
|
||
|
||
#### Address Generation | ||
|
||
Module account addresses are generated deterministically from the module name, as defined in [ADR-028](../../architecture/adr-028-public-key-addresses.md) | ||
|
||
Definition of account permissions is done during the app initialization. | ||
Comment on lines
+106
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add practical examples of module account address generation. The documentation should include:
Example addition: Module account addresses are generated deterministically from the module name, as defined in [ADR-028](../../architecture/adr-028-public-key-addresses.md)
+
+For example, to generate a module account address for the "mint" module:
+```go
+mintModuleAddr := authtypes.NewModuleAddress("mint")
+fmt.Printf("Mint module address: %s\n", mintModuleAddr)
+```
+
+Common module account names include:
+- "fee_collector": Collects transaction fees
+- "distribution": Handles reward distribution
+- "bonded_tokens_pool": Manages staked tokens
+- "not_bonded_tokens_pool": Manages unstaked tokens |
||
|
||
```go reference | ||
https://github.com/cosmos/cosmos-sdk/blob/3a03804c148d0da8d6df1ad839b08c50f6896fa1/simapp/app.go#L130-L141 | ||
``` | ||
|
||
```go reference | ||
https://github.com/cosmos/cosmos-sdk/blob/3a03804c148d0da8d6df1ad839b08c50f6896fa1/simapp/app.go#L328 | ||
``` | ||
Comment on lines
+110
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add context to code references. The code references need explanatory text to help readers understand:
Example addition: +The following code demonstrates how module accounts are initialized in a Cosmos SDK application:
+
```go reference
https://github.com/cosmos/cosmos-sdk/blob/3a03804c148d0da8d6df1ad839b08c50f6896fa1/simapp/app.go#L130-L141 +This initialization process:
|
||
|
||
### Public Keys | ||
|
||
Public keys in Cosmos SDK are defined by `cryptotypes.PubKey` interface. Since public keys are saved in a store, the `cryptotypes.PubKey` extends the `proto.Message` interface: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have an intro on module accounts as well