Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Cloud Standard

The standard module turns the Cloud Standard slots into a typed codec. CloudStandard encodes and seals each slot; CloudReader reads and decrypts them (see Reading); PrismManager orchestrates the high-level prism lifecycle.

Slot identifiers

SLOT_NAMES = {
  key: "dataprism.key", encryption: "dataprism.encryption",
  metadata: "dataprism.metadata", providers: "dataprism.providers",
}
SLOT_IDS = { key, encryption, metadata, providers }   // keccak256 of each name
 
dataId(name: string): DataId          // keccak256(stringToBytes(name))
fileDataId(filename: string): DataId  // a file slot's dataId
isReservedSlot(id: DataId): boolean   // is it one of the dataprism.* slots?

CloudStandard

A codec bound to a DataPrismKey. new CloudStandard(key).

SlotbuildreadEncrypted?
dataprism.keykeySlot(includePrivate?)readKey(payload)clear
dataprism.encryptionencryptionSlot()readEncryption(payload)clear
dataprism.metadatametadataSlot(meta)readMetadata(payload)sealed
dataprism.providersprovidersSlot(providers)readProviders(payload)sealed
filefileSlot(index)readFile(payload)sealed

Each build method returns a SlotWrite = { dataId, payload }, ready to hand to the execution layer. The clear slots are toHex(JSON); the sealed slots go through key.sealJson. The read* methods throw a clear "slot empty / does not exist" error on a 0x payload instead of a cryptic crypto failure.

Other members:

  • initialSlots({ metadata?, providers?, includePrivate? }) → SlotWrite[]: the provisioning slots. Always includes key + encryption; adds metadata / providers only if provided.
  • fileId(filename) → DataId
  • reader(source, cloudId) → CloudReader: build a decrypting reader.
const std = new CloudStandard(key);
const slots = std.initialSlots({ metadata, providers });
await (await client.execution.batchWriteData({
  cloudId,
  dataIds: slots.map(s => s.dataId),
  payloads: slots.map(s => s.payload),
})).wait();

Slot schemas

interface MetadataSlot {
  name: string;
  description: string;
  addresses: Record<Address, string>;   // owner / writer addresses → readable name
}
 
interface ProvidersSlot {
  dataprism_managed?: { service: "dataprism" };
}
 
interface Quorum    { dataShards: number; parityShards: number }
interface ChunkDesc { hash: Hex; len: number; shards: Hex[] }   // shards = content hashes
interface BlobRef   { level: number; size: number; chunks: ChunkDesc[] }
interface FileIndex {
  name: string; size: number; chunkSize: number;
  quorum: Quorum;
  providers: string[];   // ordered provider-ID list, frozen at upload
  root: BlobRef;         // compact Merkle root (≈ a few hundred bytes)
  meta?: Record<string, unknown>;
}
interface SlotWrite { dataId: Hex; payload: Hex }

See File Storage & Resilience for how FileIndex / BlobRef / ChunkDesc describe a file.

PrismManager

High-level lifecycle orchestration, on top of the execution layer + the standard. Build via client.prism(standard, cloudId?) or new PrismManager({ standard, execution, source?, cloudId? }).

Two-step creation

create(args: CreatePrismArgs): Promise<CreatePrismOutcome>

CreatePrismArgs = { fundAmount, salt, metadata?, providers?, includePrivate?, relayerFee?, timestamp? }.

  1. Step 1: createPrism on-chain → cloudId.
  2. Step 2: initializes all four reserved slots (key, encryption, metadata, providers) in one batch (empty defaults if not supplied).

Both steps are awaited; returns { cloudId, create, init }.

const manager = client.prism(new CloudStandard(key));
const { cloudId } = await manager.create({ fundAmount, salt, metadata, providers });

Dedicated slot editors

These write reserved slots intentionally (via modifyData):

MethodEffect
setMetadata(metadata, opts?)replace dataprism.metadata
setProviders(providers, opts?)replace all of dataprism.providers

readMetadata() and readProviders() require a source (the NetworkReader).

await manager.setProviders({ dataprism_managed: { service: "dataprism" } });
await manager.setMetadata({ name: "Acme", description: "v2", addresses });

Guarded generic writes

writeData(dataId, payload, opts?)        // throws if dataId is reserved
modifyData(dataId, payload, opts?)       // throws if dataId is reserved
deleteData(dataId, opts?)                // throws if dataId is reserved
batchWriteData(dataIds, payloads, opts?) // throws if ANY dataId is reserved

Guard: any generic write that targets a reserved slot (dataprism.*) throws. The same guard protects FilePipeline.upload (it rejects a filename that would hash to a reserved slot). To change a reserved slot you must use its dedicated editor.

Copyright © 2026 DataPrism.