How cosmos/cosmos-sdk works
Cosmos SDK is a modular framework for building sovereign application-specific blockchains. A chain developer composes modules and configures application state; clients construct and broadcast transactions, which the application processes through BaseApp and its module/message routing, then commits state for later queries. The repository also provides client-side query and key tools, shared application and storage abstractions, and snapshot/pruning support. The README documents interoperability and CometBFT compatibility; the sampled excerpts do not establish the wiring of every module or integration.
Main entry points: baseapp.go BaseApp · msg_service_router.go Message routing · manager.go Execution state · abci.go ABCI lifecycle
Components 21
Application runtime
- BaseApp
baseapp/baseapp.go - ABCI lifecycle
baseapp/abci.go - Message routing
baseapp/msg_service_router.go - Module framework
core/appmodule/module.go
Transactions and clients
- Transaction builder
client/tx/tx.go - Transaction broadcast
client/broadcast.go - Query client
client/query.go
Chain capabilities
- Bank capability
x/bank/types/query.pb.go - Staking capability
x/staking/types/query.pb.go - Governance API
api/cosmos/gov/v1/query.pulsar.go
State and persistence
- Execution state
baseapp/state/manager.go - Block storage views
internal/blockstm/storage.go - Snapshot manager
store/snapshots/manager.go - Pruning manager
store/pruning/manager.go - State collections
collections/collections.go
APIs and integration
- Generated service APIs
api/cosmos/tx/v1beta1/service_grpc.pb.go
Other components
- Chain developer
- Chain operator
- Transaction user
- CometBFT
- IBC integration
Connections 18
- Chain developer → Module framework: composes modules
- Module framework → BaseApp: configures application
- Transaction user → Transaction builder: builds transaction
- Transaction builder → Transaction broadcast: provides transaction
- Transaction broadcast → CometBFT: broadcasts transaction
- CometBFT → ABCI lifecycle: invokes lifecycle
- ABCI lifecycle → BaseApp: runs application
- BaseApp → Message routing: dispatches messages
- Message routing → Bank capability: routes module messages
- Message routing → Staking capability: routes module messages
- BaseApp → Execution state: selects execution state
- Execution state → Block storage views: exposes store views
- Chain operator → Snapshot manager: manages snapshots
- Snapshot manager → Pruning manager: announces snapshot heights
- Execution state → State collections: uses state abstractions
- Query client → Generated service APIs: issues service queries
- Chain developer → IBC integration: adds interoperability
- Governance API → Generated service APIs: defines query messages