decl_storage documentation specifies how to define type-safe, persistent data that needs to be stored on-chain.
For cryptocurrencies, storage might consist of a mapping between account keys and corresponding balances.
More generally, blockchains provide an interface to store and interact with data in a verifiable and globally irreversible way. In this context, data is stored in a series of snapshots, each of which may be accessed at a later point in time, but, once created, snapshots are considered irreversible.
The previous single-value storage recipe showed how a single value can be stored in runtime storage. In this section, we cover
- caching values rather than calling to storage multiple times
- storing sets, checking membership, and iteration
- ordered lists with basic maps and linked maps
- efficient subgroup removal by key prefix with double maps
- configurable module constants