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

Protocol Overview

dataprism-protocol contains the Solidity smart contracts that form the on-chain core of DataPrism. Users own personal vaults (prisms) where they write, modify, and delete arbitrary byte payloads, paying for each operation in the native DPC token.

Tech stack

  • Build system: Foundry
  • Language: Solidity 0.8.29 (via_ir = true, optimizer enabled, 200 runs)
  • Deployment tooling: TypeScript + viem (scripts/deploy.ts), Node ≥ 18
  • External dependency: Morpho Blue for the yield strategy
  • License: BUSL-1.1 (Business Source License 1.1)

Project structure

dataprism-protocol/
├── src/                              # Core smart contracts
│   ├── Token.sol                     # ERC-20 DPC token
│   ├── FeeController.sol             # Protocol fee registry
│   ├── DataPrism.sol                 # Storage layer (bytes32 prism IDs)
│   ├── DataPrismCloud.sol            # Application layer (bytes16 cloud IDs)
│   ├── DataPrismCloudForwarder.sol   # Meta-transaction relayer
│   ├── exchange/
│   │   ├── Exchange.sol              # ERC-20 ↔ DPC converter
│   │   └── strategies/
│   │       └── MorphoStrategy.sol    # Yield strategy via Morpho Blue
│   └── interfaces/                   # All contract interfaces
├── scripts/
│   ├── Factory.sol                   # CREATE2 factory for deterministic deploys
│   ├── deploy.ts                     # Main deployment script
│   ├── vanity.ts                     # Vanity salt finder
│   └── deployments.json              # Deployed contract addresses
├── test/                             # Forge tests
└── foundry.toml                      # Foundry configuration

The two storage layers

DataPrism separates raw persistence from application logic:

  • DataPrism: the raw storage layer. Prisms are identified by bytes32 IDs (keccak256(owner, salt)). Only the owner can write. Fees are deducted from the prism's DPC balance on every operation.
  • DataPrismCloud: the application layer built on top of DataPrism. It introduces cloud IDs (bytes16, the first 16 bytes of the prism ID, cheaper in calldata), writers (delegated write access with optional expiration), two-step transfers, and on-chain enumeration of prisms, data keys, and writers.

DataPrismCloud is the msg.sender for all calls to DataPrism. Its *As functions (e.g. writeDataAs) are only callable by DataPrismCloudForwarder.

Gasless meta-transactions

DataPrismCloudForwarder lets users operate without holding gas: they sign an EIP-712 message off-chain and a relayer submits the transaction on their behalf in exchange for a relayerFee in DPC. See Contracts → DataPrismCloudForwarder for the full flow and relayer economics.

Compile, test, deploy

# Compile (output in /out)
forge build
 
# Run tests
forge test
 
# Install deployment tooling
pnpm install
 
# (optional) Find vanity salts for deterministic addresses
pnpm run vanity -- --factory <FactoryAddr> --contract Token --args "<owner>" --prefix 0000
 
# Deploy (set PRIVATE_KEY first)
export PRIVATE_KEY=0x...
pnpm run deploy

The deploy script deploys all contracts via a CREATE2 Factory, wires the Forwarder into DataPrismCloud, configures token permissions, sets up the Exchange with USDC, and writes addresses to scripts/deployments.json. See Deployments for the deployed Sepolia addresses and post-deployment steps.

Security model

  • Solidity 0.8.29 built-in overflow/underflow checks
  • EIP-712 signed meta-transactions with per-user nonce replay protection
  • ERC-2612 permit for gasless approvals
  • ERC-1271 support for smart-contract signers
  • ECDSA malleability check (s ≤ secp256k1_n / 2)
  • Two-step ownership transfers on all owned contracts
  • Role-based access (minters, burners, operators) with per-address min/max bounds

To report a vulnerability, send a transaction to the owner address with details encoded as UTF-8 calldata.

Copyright © 2026 DataPrism.