Tiers of Storage - LibertyDSNP/frequency GitHub Wiki

Frequency has and uses a variety of tiers of storage and each has a different use case. When adding new data to any storage it is important to think about the cost and availability guarantees of that tier and think if another tier would be better suited.

On-chain state storage: Read and Writable

Data that can/will be used in future on-chain interactions

Cost

  • Maximum

Availability

  • Current Version Always

Examples:

  • Public Key to MSA
  • Balances

On-chain storage: Writable Only

Data that is written in a transaction, but is NOT used for processing other data or reading

Cost

  • Currently maximum, but may be able to be reduced through future pruning and sharding ideas

Availability

  • Current Version Always

Examples

  • Messages (aka DSNP Announcements)
  • Private Graph

Substrate Events

Streaming data. Great for knowing knowing state changed, but not getting historical data

Cost

  • Minimal, but can waste block space

Availability

  • Effectively time-limited
  • Not historically available (post pruning plan)

Examples

  • Per block notification of new messages in a schema
  • MSA key or delegation changes

Off-chain Node Storage

Great for providing an off-chain RPC of on-chain state data indexed in a different way Could store and process events Could also be anchored to on-chain state

Cost

  • Moderate
  • Not every node may need to use it, but those that do require additional node space and computation

Availability

  • No guarantees

Examples

  • Expected to be used for MSA Id to Public Key RPC call

Other Chain Storage

Crust, Filecoin, etc… Could be useful for archiving or additional service availability tiers

Cost

  • Varies

Availability

  • Dependent on the host chain and storage contract

Examples

  • None currently in use

Off-chain IPFS Storage

Great for larger data storage Content Addressed Does not have a built in discovery system. Must be be discovered via other storage systems

Cost

  • Hosting and bandwidth

Availability

  • Secure only if one or more servers are pinning the data and those servers are available

Examples

  • DSNP Batch Publication Files in parquet format

Off-chain HTTP Storage

aka the normal Internet. Does not have a built in discovery system. Must be be discovered via other storage systems.

Cost

  • Hosting and bandwidth

Availability

  • Only if the DNS and host are working

Examples

  • Videos
  • Photos
  • Websites