For developers: mapping concepts to the SDK
This page is the bridge from Architecture and main components to the canonical PoD SDK documentation on GitHub. It repeats a few facts on purpose so engineers can verify mental models quickly.
For a guided first implementation, read Tutorials: building Privacy on Demand (PoD) dApps to pick the integration model, then follow Tutorial: private Adder on Sepolia for a primitive-only Solidity + TypeScript walkthrough (Sepolia presets).
Official reading order (SDK)
The upstream docs recommend:
Then deep dives:
Contract references: Data types, Patterns and checklist, Request builder and remote calls, Fees, gas, and oracle
Component → source file map
Inbox
IInbox.sol and cross-domain flow in the domain model diagram.
Callback guard
InboxUser.sol (onlyInbox) — see Features.
PodLib
PodLib.sol and width-specific libraries (PodLib64, PodLib128, PodLib256).
PodUser / presets
PodUser.sol, network mixins such as PodUserSepolia.sol.
Types (it*, ct*, gt*)
MpcCore.sol in @coti-io/coti-contracts (not published inside the npm SDK). See Data types.
Custom COTI calls
MpcAbiCodec.sol and the custom mode section of Writing privacy contracts.
Client crypto
coti-pod-crypto.ts via CotiPodCrypto (TypeScript integration).
Type model at a glance
gt* / ct* / it* types live in @coti-io/coti-contracts MpcCore.sol. The npm package @coti-io/pod-sdk publishes TypeScript only (dist) — it does not ship Solidity or a vendored MpcCore.
In the current revision:
gtUint8…gtUint256andgtBoolare user‑defined value types (type gtUint256 is uint256). Pass and assign them likeuint256— nomemory/calldataongt*parameters or locals.ctUint8…ctUint128are also user‑defined value types (singleuint256word).ctUint256is a struct{ ctUint128 ciphertextHigh; ctUint128 ciphertextLow; }— decoded locals and callback variables must use amemorylocation, and off‑chain reads return the two limbs as a tuple.itUint*(user encrypted inputs,ciphertext + signature),utUint*(dual‑ciphertext),gtStringandctStringremain structs — keep theircalldata/memorylocations.
Import Solidity types from @coti-io/coti-contracts/contracts/utils/mpc/MpcCore.sol. Off‑chain decryption uses @coti-io/coti-sdk-typescript@^1.0.7, which exposes decryptUint256({ ciphertextHigh, ciphertextLow }, accountAesKey) for the 256‑bit lane (also wrapped by CotiPodCrypto.decrypt in @coti-io/pod-sdk).
Implementation checklist (condensed)
Derived from the SDK’s Writing privacy contracts and Async execution:
Classify data — public metadata vs
it*inputs vsct*outputs vs internalgt*(COTI-only).Pick integration mode —
PodLibhelpers vs customMpcAbiCodec+ COTI contract.Model async state — persist
requestId, track pending/completed/failed.Harden callbacks —
onlyInbox, correctabi.decodetuple, validate peer context when applicable.Configure routing safely — gated
configure/configureCoti/ inbox updates.Budget fees — understand
msg.valueandcallbackFeeLocalWei; use Inbox fee views where available (Fees doc).Test failure paths — spoofed callback must revert, error callbacks must mark failures, decrypt integration must match widths.
Relationship to native COTI “build” documentation
If you build directly on COTI V2 with precompiles and private types, start from Build on COTI. PoD adds the Inbox-mediated cross-chain angle; many cryptographic ideas rhyme, but deployment and UX differ.
Do not confuse the PoD cross-chain Privacy Portal (Fuji/Sepolia host pTokens) with the native COTI Privacy Portal (PrivateERC20 on COTI).
Package install
TypeScript:
@coti-io/pod-sdkSolidity:
@coti-io/coti-contracts(PodLib,PodUserSepolia,MpcCore, …) — the npm SDK does not ship contract sources
Use contract MyApp is PodLib, PodUserSepolia with imports from @coti-io/coti-contracts/contracts/pod/mpc/....
Last updated
Was this helpful?