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 network fees and no credits.

NetworkReader

Build it via client.reader, or directly with new NetworkReader(network).

Prism state

MethodReturns
getPrismOwner(cloudId)Address
getPrismTokens(cloudId)bigint (DPC balance)
getPrismInfo(cloudId)PrismInfo, the above in one parallel call

Slot payloads

Raw, still-encrypted slot values:

MethodReturnsNote
getData(cloudId, dataId)Payloadraw payload
getDataWithTimestamp(cloudId, dataId){ payload, timestamp }plus the write timestamp
getDataFrom(cloudId, dataIds[])Payload[]several in one call
dataExists(cloudId, dataId)boolean

Account metadata

getNonce(account) returns the account's current request nonce, used by the signing layer for delegated execution.

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 (for example 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
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.