Storage Programs Architecture
Warning: Storage Programs are still being developed; this documentation is a preview and might not work correctly.Storage Programs are first-class key–value containers that live inside the Demos Network’s Global Change Registry (GCR). This document describes how the network stores, validates, and serves Storage Program data so backend operators understand the moving pieces.
Network Responsibilities
- Deterministic provisioning – Addresses are derived from deployer metadata, allowing replicas to agree on identifiers before the program exists on-chain.
- Consensus validation – Create, write, access-control updates, and delete operations are executed through the transaction pipeline and require consensus signatures.
- Immediate query availability – The query subsystem can serve reads directly from the replicated database without waiting for block production.
- Permission enforcement – Access rules are enforced server-side during both mutation and read paths, keeping unauthorized clients from observing private data.
Data Flow
Persistence Model
Each Storage Program row is serialized into theGCR_Main.data JSONB column with two top-level objects:
- variables – Arbitrary JSON payload managed by the deployer.
- metadata – Network-managed fields that clients can rely on for auditing and access checks.
Deterministic Addressing
Storage Program identifiers are derived on the client and verified by the network:Access Control Enforcement
During transaction execution the validator layer enforces the configured mode:- private / deployer-only – Only the deploying address may create, read, or mutate data.
- public – Anyone can issue read RPCs; only the deployer can commit writes.
- restricted – Membership lists are stored in metadata and validated during both read and write phases.
Resource Limits
To keep Storage Programs fast to replicate and query, the backend validates:- Maximum serialized payload of 128 KB per program.
- Maximum nesting depth of 64 JSON levels.
- Maximum key length of 256 characters.
Related Guides
- Developer-first overview: SDK Storage Programs
- Implementation recipes: Storage Program Cookbook
- Client operations: SDK Operations Guide