Overview
The store package provides interfaces for persisting application state in Cosmos SDK. It implements a multi-store pattern with support for IAVL trees, transient storage, and state commitment.Core Interfaces
Store
store/types/store.go:17-20
Committer
store/types/store.go:23-32
KVStore
CommitKVStore
MultiStore
MultiStore Interface
store/types/store.go:115-148
CommitMultiStore
store/types/store.go:157-200
Manages multiple substores with atomic commits.
Store Keys
StoreKey Types
Creating Store Keys
Store Types
- IAVL: Merkle tree for committed state
- Transient: Reset after each block (for temporary state)
- Memory: In-memory only, not persisted
Gas Metering
GasMeter
Gas Configuration
Usage Examples
Mounting Stores in BaseApp
Using KVStore in Keeper
Iterating Over Keys
Using Prefix Store
Gas Meter Usage
Store Upgrades
Caching and Branching
Related APIs
- Context - Accessing stores from context
- BaseApp - Store mounting and loading
- Keeper Patterns - Using stores in keepers