Storage Schema
Every key/value type across all 11 columns with byte layouts
Column Enum
All persistent data is partitioned into 11 column families. Each variant maps to a dedicated RocksDB column family with independent compaction and bloom filters.
Meta, // schema version, node id
Config, // node configuration
Identity, // keypairs per context
State, // shared context state KV
PrivateState, // per-node private KV (not synced)
Delta, // causal deltas (DAG)
Blobs, // content-addressed binary data
Application, // WASM binaries + metadata
Alias, // human-readable name → id
Generic, // uncategorized data
Group, // governance: 20 prefix-partitioned sub-namespaces
}
Context Column Types
Key/value types for the columns that store per-context data: metadata, configuration, shared state, private state, identity, and deltas.
Meta Column
| Key Struct | Key Layout | Value Type | Codec | Description |
|---|---|---|---|---|
| ContextMeta | context_id (32) | ContextMetaValue | Borsh | Context metadata including application info and DAG state |
application: ApplicationMeta, // app_id + version + services
root_hash: Hash, // Merkle root of context state
dag_heads: Vec<[u8; 32]>, // current DAG head delta IDs
}
Config Column
| Key Struct | Key Layout | Value Type | Codec | Description |
|---|---|---|---|---|
| ContextConfig | context_id (32) | ContextConfigValue | Borsh | Per-context revision counters |
application_revision: u64, // incremented on app upgrades
members_revision: u64, // incremented on membership changes
}
Identity Column
| Key Struct | Key Layout | Value Type | Codec | Description |
|---|---|---|---|---|
| ContextIdentity | context_id (32) | ContextIdentityValue | Borsh | Keypair for this node's identity within a context |
private_key: Option<[u8; 32]>, // Ed25519 private key
sender_key: Option<[u8; 32]>, // sender public key
}
State & PrivateState Columns
| Key Struct | Key Layout | Value Type | Codec | Description |
|---|---|---|---|---|
| ContextState | context_id (32)+app_key (var) | Slice | Identity | Shared context state — raw bytes, no serialization overhead |
| ContextPrivateState | context_id (32)+app_key (var) | Slice | Identity | Per-node private state — NOT synced to other nodes |
Delta Column
| Key Struct | Key Layout | Value Type | Codec | Description |
|---|---|---|---|---|
| ContextDagDelta | context_id (32)+delta_id (32) | ContextDagDeltaValue | Borsh | Causal delta with parents, actions, and verification data |
delta_id: [u8; 32],
parents: Vec<[u8; 32]>, // causal parent IDs
actions: Vec<Action>, // state mutations
hlc: HybridTimestamp, // hybrid logical clock
applied: bool, // has been applied to state
expected_root_hash: Hash, // post-apply verification
events: Vec<Event>, // emitted events
}
Group Column Detail
The Group column uses a single-byte prefix to partition logical sub-namespaces within one RocksDB column family. Each prefix isolates a governance concern — membership, capabilities, operations log, upgrades, aliases, and namespace identity.
Membership & Metadata (0x20–0x23)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x20 | GroupMeta | 0x20+group_id (32) | GroupMetaValue | Group metadata (app_key, target_app, upgrade_policy, admin, migration) |
| 0x21 | GroupMember | 0x21+group_id (32)+identity (32) | GroupMemberRole | Member role in group |
| 0x22 | GroupContextIndex | 0x22+group_id (32)+context_id (32) | () | Context belongs to group (presence key) |
| 0x23 | ContextGroupRef | 0x23+context_id (32) | [u8; 32] | Reverse index: context → group_id |
GroupMetaValue definition
app_key: [u8; 32], // application identity
target_application_id: [u8; 32], // target WASM application
upgrade_policy: UpgradePolicy, // auto / manual / frozen
created_at: u64, // unix timestamp
admin_identity: [u8; 32], // group administrator
migration: Option<String>, // migration method name
}
Upgrades & Signing (0x24–0x25)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x24 | GroupUpgradeKey | 0x24+group_id (32) | GroupUpgradeValue | Active upgrade state |
| 0x25 | GroupSigningKey | 0x25+group_id (32)+key_id (32) | GroupSigningKeyValue | Ed25519 signing key for group |
GroupUpgradeValue & GroupUpgradeStatus definitions
from_version: u64,
to_version: u64,
migration: Option<String>, // migration method name
initiated_at: u64, // unix timestamp
initiated_by: [u8; 32], // admin identity
status: GroupUpgradeStatus,
}
InProgress {
total: u64, // total contexts to migrate
completed: u64, // successfully migrated
failed: u64, // failed migrations
},
Completed {
completed_at: u64, // unix timestamp
},
}
private_key: [u8; 32], // Ed25519 private key bytes
}
Capabilities & Defaults (0x26–0x29)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x26 | GroupMemberCapability | 0x26+group_id (32)+identity (32) | GroupMemberCapabilityValue | Per-member capability bitmask |
| 0x29 | GroupDefaultCaps | 0x29+group_id (32) | GroupDefaultCapsValue | Default capabilities for new members |
Capability value definitions
capabilities: u32, // bitmask: bit 0 = manage_members, bit 1 = manage_contexts, ...
}
capabilities: u32, // default bitmask for new members
}
Migration & Nonce (0x2B–0x2C)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x2B | GroupContextLastMigration | 0x2B+group_id (32)+context_id (32) | GroupContextLastMigrationValue | Last migration method applied to this context |
| 0x2C | GroupLocalGovNonce | 0x2C+group_id (32)+signer (32) | u64 | Per-signer monotonic nonce for replay protection |
GroupContextLastMigrationValue definition
method: String, // WASM method name used for migration
}
Aliases (0x2D–0x2F)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x2D | GroupMemberAlias | 0x2D+group_id (32)+identity (32) | String | Human-readable member alias |
| 0x2E | GroupAlias | 0x2E+group_id (32) | String | Group alias (human-readable name) |
| 0x2F | GroupContextAlias | 0x2F+group_id (32)+context_id (32) | String | Context alias within group |
Operation Log & DAG (0x30–0x31)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x30 | GroupOpLog | 0x30+group_id (32)+seq (8 BE) | Vec<u8> | Serialized SignedGroupOp — the governance operation DAG |
| 0x31 | GroupOpHead | 0x31+group_id (32) | GroupOpHeadValue | Latest sequence number + DAG heads |
GroupOpHeadValue definition
sequence: u64, // latest sequence number
dag_heads: Vec<[u8; 32]>, // current DAG head op IDs
}
The sequence number is stored as 8-byte big-endian in the key to enable efficient range scans in chronological order. The DAG heads track the frontier of the governance operation graph for catch-up protocol.
Member-Context Tracking (0x32–0x33)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x32 | GroupMemberContext | 0x32+group_id (32)+identity (32)+context_id (32) | [u8; 32] | Member-context join tracking |
| 0x33 | GroupContextMemberCap | 0x33+group_id (32)+context_id (32)+identity (32) | u8 | Per-context member capability override |
Subgroup Hierarchy (0x35–0x36)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x35 | GroupChildIndex | 0x35+parent_id (32)+child_id (32) | () | Bidirectional index: lists children of a group (presence key). Used by collect_descendant_groups() for cascade operations. |
| 0x36 | GroupParentRef | 0x36+child_id (32) | [u8; 32] | Maps child group → parent group. Used by resolve_namespace() to walk up the tree and find the root (namespace). |
Namespace Identity & Keys (0x37–0x3A)
| Prefix | Key Struct | Key Layout | Value Type | Description |
|---|---|---|---|---|
| 0x37 | NamespaceIdentity | 0x37+namespace_id (32) | NamespaceIdentityValue | Node's Ed25519 keypair for this namespace (root group). Auto-generated on first create/join, shared across all subgroups and contexts in the namespace. |
| 0x38 | NamespaceGovOp | 0x38+namespace_id (32)+delta_id (32) | NamespaceGovOpValue | Namespace governance operation log entry. Stores SignedNamespaceOp or opaque skeleton (for ops the node cannot decrypt). |
| 0x39 | NamespaceGovHead | 0x39+namespace_id (32) | NamespaceGovHeadValue | DAG head tracking for the namespace governance DAG: next nonce and current head delta IDs. |
| 0x3A | GroupKeyEntry | 0x3A+group_id (32)+key_id (32) | Vec<u8> | Per-group encryption key, indexed by key_id. Used for encrypting GroupOp payloads within namespace governance. Rotated on member removal. |
NamespaceIdentityValue fields
public_key: [u8; 32], // Ed25519 public key (node's member identity in namespace)
private_key: [u8; 32], // Ed25519 private key (signs ops, unwraps group keys via ECDH)
sender_key: [u8; 32], // additional sender key for encrypted sync
}
NamespaceGovOpValue & NamespaceGovHeadValue definitions
skeleton_bytes: Vec<u8>, // borsh(SignedNamespaceOp) or OpaqueSkeleton
}
sequence: u64, // next nonce for ops
dag_heads: Vec<[u8; 32]>, // current DAG heads (multi-parent support)
}
Application Services (ApplicationMeta extension)
ApplicationMeta now includes a services: Vec<ServiceMeta> field for multi-service bundles. When empty, the application is single-service (backward compat) and uses the top-level bytecode/compiled fields.
ServiceMeta fields
name: Box<str>, // e.g. "chat", "user-mgmt"
bytecode: BlobMeta, // WASM blob for this service
compiled: BlobMeta, // precompiled WASM blob
}