Use the decl_storage macro 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.

Generally speaking, you may store arbitrary data, as long as its data type is serializable in Substrate i.e. implements Encode and Decode traits.


More Resources