Storage Programs Architecture
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 is stored as a row in thegcr_storageprogram table. The user payload lives in the data JSONB column, access rules in the acl JSONB column, and network-managed fields in the metadata JSONB column:
- 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:- owner (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 – Allow lists (
acl.allowed) are stored alongside the program 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 1 MB per program.
- Maximum nesting depth of 64 JSON levels.
Related Guides
- Developer-first overview: SDK Storage Programs
- Implementation recipes: Storage Program Cookbook
- Client operations: SDK Operations Guide