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

SDK Overview

@dataprism/sdk is the client-side core of DataPrism, in TypeScript, embeddable anywhere (browser, Node backend, or a script). It exposes a single API for three jobs:

  • Drive the blockchain: create prisms, read/write slots, whether or not the user pays gas.
  • Encrypt / decrypt: keys derived from a wallet signature, never stored.
  • Store files: chunking, encryption, content addressing, and managed object storage.

It is ESM, strict TypeScript, and pulls in no heavy cloud SDK. Dependencies: viem (peer, ≥ 2.0), @noble/curves, @noble/ciphers, @noble/hashes.

Install

npm install @dataprism/sdk viem

Quick start

import { DataPrismClient, DataPrismNetwork, DEMO } from "@dataprism/sdk";
 
const network = new DataPrismNetwork(DEMO, "https://rpc.example.com");
 
// wallet mode (default) - the user pays gas
const client = new DataPrismClient(network, { walletClient });
 
// api mode - the relayer fronts the gas (reimbursed in DPC)
const client = new DataPrismClient(network, { walletClient, apiUrl, mode: "api" });
 
// read-only - no wallet
const client = new DataPrismClient(network);

The entry point is DataPrismClient, a lazy facade that builds its sub-clients on first access:

GetterTypeNeeds a wallet
readerNetworkReaderno
executionExecutionLayeryes
signerDataPrismSigneryes
prism(std, cloudId?)PrismManageryes

Layered architecture

                 YOUR APPLICATION

   ┌───────────────────▼───────────────────────────────────────┐
   │ STANDARD   CloudStandard / CloudReader  - prism slots      │  standard/
   ├────────────────────────────────────────────────────────────┤
   │ CRYPTO     DataPrismKey - keys + seal/open                 │  crypto/
   ├────────────────────────────────────────────────────────────┤
   │ FILES      FilePipeline + ReedSolomon                      │  files/
   │ STORAGE    StorageProvider (Managed, Memory)               │  storage/
   ├────────────────────────────────────────────────────────────┤
   │ EXECUTION  ExecutionLayer (wallet | api)  - writes         │  execution/
   │ READING    NetworkReader     SIGNING  DataPrismSigner       │  network/, signing/
   ├────────────────────────────────────────────────────────────┤
   │ NETWORK    DataPrismNetwork (chainId, RPC, addresses)      │  network/
   └────────────────────────────────────────────────────────────┘

   DataPrismCloud.sol · DataPrismCloudForwarder.sol  (on-chain)

   DataPrism-managed object storage  ←  encrypted file shards

Golden rule: each layer only knows the one directly beneath it.

Importable modules (subpaths)

The SDK is published wagmi/viem-style: everything is re-exported from the root @dataprism/sdk, and each module is also importable on its own subpath.

import { DataPrismClient }            from "@dataprism/sdk";            // facade
import { DataPrismNetwork, DEMO }     from "@dataprism/sdk/network";
import { walletExecution }            from "@dataprism/sdk/execution";
import { DataPrismSigner }            from "@dataprism/sdk/signing";
import { ApiWriter }                  from "@dataprism/sdk/api";
import { DataPrismKey }               from "@dataprism/sdk/crypto";
import { CloudStandard, CloudReader } from "@dataprism/sdk/standard";
import { PrismManager }               from "@dataprism/sdk/prism";
import { ManagedStorageProvider }    from "@dataprism/sdk/storage";
import { FilePipeline }               from "@dataprism/sdk/files";
import { DataPrismCloudAbi }          from "@dataprism/sdk/abi";
SubpathRoleMain exportsDocs
/networkthe "where" (chain, RPC, addresses) + low-level reads/writesDataPrismNetwork, DEMO, NetworkReader, NetworkWriter, computeCloudIdNetwork & Client, Reading
/executionunified write layerExecutionLayer, BaseExecutionLayer, WalletExecution, ApiExecutionExecution Layer
/signingEIP-712 signaturesDataPrismSigner, hashBytes32Array, hashPayloadsArrayExecution Layer
/apidataprism-api REST clientApiWriter, extractCloudIdExecution Layer
/cryptoprism keys + encryptionDataPrismKey, seal, openCryptography
/standardprism slots (codec + decrypting reads)CloudStandard, CloudReader, SLOT_IDSCloud Standard
/prismhigh-level prism lifecyclePrismManagerCloud Standard
/storagestorage connectorsStorageProvider, ManagedStorageProvider, MemoryProviderStorage Providers
/filesfile pipelineFilePipeline, ReedSolomon, FastCDCChunker, convergentSealFile Pipeline
/abicontract ABIsDataPrismCloudAbi, DataPrismCloudForwarderAbi-

End-to-end at a glance

// 1. key derived from a wallet signature (message derived from the cloudId; add `:${password}` for extra security)
const sig = await walletClient.signMessage({ message: `dataprism:key:${cloudId}` });
const key = DataPrismKey.fromSignature(sig, { curve: "secp256k1", algorithm: "aes-256-gcm" });
const std = new CloudStandard(key);
 
// 2. create a prism + initialize its 4 reserved slots
const manager = client.prism(std);
const { cloudId } = await manager.create({ fundAmount, salt, metadata, providers });
 
// 3. upload a file to managed storage, index written on-chain
const storage = [new ManagedStorageProvider({
  apiUrl: "https://api.dataprism.co",
  projectId: cloudId,
  getAccessToken,
})];
const pipeline = new FilePipeline({ providers: storage, standard: std,
                                    execution: client.execution, cloudId });
await pipeline.upload("report.pdf", bytes, { chunkSize: 65536, dataShards: 1, parityShards: 0 });
 
// 4. read it back
const view  = std.reader(client.reader, cloudId);
const index = await view.file("report.pdf");
const bytes = await pipeline.download(index);

Each step is detailed in the pages that follow.

Copyright © 2026 DataPrism.