Skip to content
Blockchain Association of Cameroon
BAC-L2-COSMOS-107Cosmos SDKAdvanced

Designing state and storage

Designing a key space that stays queryable at millions of entries, and where every byte is justified.

Level
L2Appchain developer
Duration
4 h
Track
Cosmos SDK
Maintainer
Cosmos Lead Architect

Learning objectives

  • 01Design key prefixes that support efficient iteration
  • 02Serialise state in a stable, versionable way
  • 03Assess the replication cost of a modelling choice

Guided lab

Model the state of a cocoa traceability chain and implement its access paths.

Independent lab

Load a million entries and measure the cost of iteration queries.

Security angle

Unbounded iteration inside a message handler: the denial of service you inflict on yourself.

Assessment

Documented state model with performance measurements attached.