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

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

MethodReturns
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:

MethodReturnsNote
getData(cloudId, dataId)Payloadraw 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 CloudReader instead of raw getData.

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.

Listload allby slicestreaming
user's prismsgetUserPrisms(user)getUserPrismsSlice(user, offset, limit)iterateUserPrisms(user, sliceSize?)
data keysgetDataKeys(cloudId)getDataKeysSlice(cloudId, offset, limit)iterateDataKeys(cloudId, sliceSize?)
writersgetWriters(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 payload

The 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.

MethodReturnsEncrypted?
key()KeySlotclear
encryption()EncryptionConfigclear
metadata()MetadataSlotdecrypted
providers()ProvidersSlotdecrypted
file(name)FileIndexdecrypted
raw(dataId)Hexraw 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.

Copyright © 2026 DataPrism.