From e72cb4948524b334e033630d4f472f8ed4cb2f42 Mon Sep 17 00:00:00 2001 From: Eric Mokaya <4112301+ziscky@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:04:56 +0300 Subject: [PATCH] docs: Module account address documentation (#22289) (cherry picked from commit 3ba4661dc7cf9a3ee6517764d6b0b5c7268ed33c) --- docs/learn/beginner/03-accounts.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/learn/beginner/03-accounts.md b/docs/learn/beginner/03-accounts.md index 99c9b30267f8..3d626f0d2d56 100644 --- a/docs/learn/beginner/03-accounts.md +++ b/docs/learn/beginner/03-accounts.md @@ -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. + +```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 +``` + ### 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: