BAC-L2-SUB-107Substrate / Polkadot SDK
Designing on-chain storage
Every byte stored is replicated by every node, forever. On-chain storage is designed as a scarce resource, not as a database.
- Level
- L2 — Appchain developer
- Duration
- 4 h
- Maintainer
- Polkadot / Substrate Lead Architect
Learning objectives
- 01Choose between a value, a map and a double map based on the access profile
- 02Bound every variable-length structure
- 03Assess the replication cost of a storage decision
Guided lab
Model the storage of an agricultural traceability registry and justify each structure chosen.
Independent lab
Reduce a supplied pallet's storage footprint without losing functionality.
Security angle
Storage exhaustion: how an unbounded user fills the chain for a trivial cost.
Assessment
Documented storage model, assessed on its bounds and replication cost.
