Credits & Payments
Every on-chain operation in DataPrism is paid for in DPC, the protocol's credit token. This page explains what DPC is, how users acquire it, and how it funds a prism.
The credit token (DPC)
Credits are an ERC-20 token internal to the protocol, DPC (defined in
dataprism-protocol, 18 decimals). DPC pays for:
- Protocol fees: every on-chain write / modify / delete of data consumes DPC, priced by the FeeController.
- Relayer fees: when the user does not pay gas themselves, a relayer fronts the
transaction in exchange for a commission in DPC (the
relayerFee).
Topping up
A user funds their DPC balance in one of two ways.
By card (Stripe)
User ──card payment──► Stripe ──webhook──► dataprism-payment-relayer
│
payment confirmed?
│ yes
▼
buys DPC on the Exchange (with USDC)
and transfers it on-chain to the userThe dataprism-payment-relayer listens for confirmed Stripe
payments. On confirmation, it acquires the matching amount of DPC (buying it on the
Exchange with USDC) and transfers it to the user's wallet, at
the rate corresponding to the amount paid.
By crypto (USDC)
The user can also fund their balance directly in USDC, without Stripe, approving USDC and
calling Exchange.buyTokens() on-chain (or a single atomic batch on EIP-5792-capable wallets).
The default rate is 1 USDC → 1000 DPC.
Assigning credits to a prism
Once DPC is on the wallet, the user assigns it to a prism. A prism's DPC balance is what funds all of its on-chain operations (index writes, relayer fees). A prism with no credits cannot write anything.
wallet (DPC) ──fundPrism──► prism balance ──consumed by──► writes + relayer feesSingle-transaction funding (EIP-2612 permit)
DataPrismCloud pulls DPC from the wallet with token.transferFrom(owner, cloud, amount).
The cloud is not a token operator (only DataPrism is),
so that pull needs an allowance. Rather than a separate approve transaction, the SDK has
the user sign an EIP-2612 permit (a free, off-chain signature) and the contract runs the
permit and the funding in one transaction:
- Wallet path:
createPrismWithPermit(fundAmount, salt, deadline, v, r, s)/fundPrismWithPermit(...): a single tx, no approve (the user pays gas). - API path: the request carries a
PermitParams; the Forwarder callstoken.permit(...)beforecreatePrismAs(...): gasless and approve-free.
The permit domain is the DPC token (name = "DataPrism Token", version = "1", nonce
token.nonces(owner)); the spender is the DataPrismCloud address and the value is the
funded amount.
The fee model in practice
| Fee | Unit | Paid by | When |
|---|---|---|---|
| Gas | ETH | the user | wallet execution path |
relayerFee | DPC | the prism balance → relayer | API execution path |
| Protocol fee | DPC | the prism balance | every write / modify / delete |
In practice the protocol fee is 100 DPC (0.1 USDC) per data operation (write, modify, or delete) and 1000 DPC (1 USDC) to create a prism; funding, transferring, and deleting a prism are free.
On the API (gasless) path the user pays no ETH; instead they set a relayerFee in DPC when
signing, which compensates the relayer for fronting the gas. On the wallet path the user pays
gas in ETH directly and relayerFee is irrelevant. See the
SDK execution layer for how this is exposed in code, and the
Exchange contract for the on-chain swap mechanics.

