Reading Data
All reads go through one or more RPC endpoints via client.reader (a NetworkReader).
They consume no gas and no credits. Reads target DataPrismCloud and the Forwarder
only, never the core DataPrism contract.
NetworkReader
Build it via client.reader, or directly with new NetworkReader(network).
Contract metadata
getOwner(), getPendingOwner(), getForwardContract(), getDomainSeparator(),
getNonce(account).
Prism state
| Method | Returns |
|---|---|
getPrismOwner(cloudId) | Address |
getPrismPendingOwner(cloudId) | Address |
getPrismTokens(cloudId) | bigint (DPC balance) |
getProtocolId(cloudId) | Bytes32 (the core prism ID) |
getPrismInfo(cloudId) | PrismInfo, all of the above in one call (parallel) |
Slot payloads
Raw (still-encrypted) slot values, read through DataPrismCloud:
| Method | Returns | Note |
|---|---|---|
getData(cloudId, dataId) | Payload | raw payload |
getDataWithTimestamp(cloudId, dataId) | { payload, timestamp } | + on-chain timestamp |
getDataFrom(cloudId, dataIds[]) | Payload[] | several in one call |
dataExists(cloudId, dataId) | boolean |
To read and decrypt a slot in one step, use the
CloudReaderinstead of rawgetData.
Forwarder / relayer
getForwarderOwner(), getForwarderPendingOwner(), getCloudAddress(),
isOfficialRelayer(relayer), getProtocolTreasury(), getPriorityWindow(),
getRelayerShareBps(), getVouchers(relayer).
Paginated enumerations
For lists whose size is unpredictable (a prism can hold millions of files), never load everything at once. Each list comes in three forms: load-all (convenience), by-slice, and streaming iterator.
| List | load all | by slice | streaming |
|---|---|---|---|
| user's prisms | getUserPrisms(user) | getUserPrismsSlice(user, offset, limit) | iterateUserPrisms(user, sliceSize?) |
| data keys | getDataKeys(cloudId) | getDataKeysSlice(cloudId, offset, limit) | iterateDataKeys(cloudId, sliceSize?) |
| writers | getWriters(cloudId) | getWritersSlice(cloudId, offset, limit) | iterateWriters(cloudId, sliceSize?) |
The raw *Count / *ByIndex getters (e.g. getDataCount, getDataKeyByIndex) are also
available.
A slice is:
interface Slice<T> { items: T[]; offset: number; limit: number; total: bigint; hasMore: boolean }The iterators (iterate*) are async generators that walk the whole list across several
requests (default sliceSize = 200), reading each window in parallel, without holding it all
in memory.
for await (const dataId of client.reader.iterateDataKeys(cloudId)) {
// process one key at a time
}Decrypted reads (CloudReader)
The NetworkReader returns ciphertext. To read a slot and decrypt it in one step, pair a
CloudStandard (which holds the key) with a SlotSource and a cloudId. Build
it via std.reader(source, cloudId), source is anything with a getData(cloudId, dataId)
method, and NetworkReader satisfies it.
const view = std.reader(client.reader, cloudId);
const keySlot = await view.key(); // clear
const enc = await view.encryption(); // clear
const metadata = await view.metadata(); // decrypted
const providers = await view.providers(); // decrypted
const fileIndex = await view.file("report.pdf"); // decrypted
const ciphertext = await view.raw(dataId); // raw payloadThe providers slot contains only the public dataprism_managed service marker. Storage access
is authorized separately with the current user session, so this slot contains no credentials.
| Method | Returns | Encrypted? |
|---|---|---|
key() | KeySlot | clear |
encryption() | EncryptionConfig | clear |
metadata() | MetadataSlot | decrypted |
providers() | ProvidersSlot | decrypted |
file(name) | FileIndex | decrypted |
raw(dataId) | Hex | raw ciphertext |
A public-only key reads the clear slots fine but throws on the sealed ones, this is the
access-control boundary. The SlotSource interface also accepts optional getDataFrom and
dataExists methods for richer sources.

